Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weights/NLCDetection weight-loading fails #19

Closed
JulieChoo opened this issue Nov 8, 2023 · 7 comments
Closed

weights/NLCDetection weight-loading fails #19

JulieChoo opened this issue Nov 8, 2023 · 7 comments
Labels
good first issue Good for newcomers

Comments

@JulieChoo
Copy link

Hello, this problem occurred when using the latest weights you provided. Can you help me?

weights/HRNet weight-loading succeeds: weights/HRNet/225000.pth
weights/HRNet_params: 6361208
weights/NLCDetection weight-loading fails
weights/NLCDetection_params: 528923

@pbernabeup
Copy link

I have encountered the same problem, When removing the try/except block it returns the following error:

RuntimeError: Error(s) in loading state_dict for DataParallel: Missing key(s) in state_dict: "module.getmask.getmask.0.weight", "module.getmask.getmask.0.bias", "module.getmask.getmask.2.weight", "module.getmask.getmask.2.bias". Unexpected key(s) in state_dict: "module.FPN_LOC.smooth_s4.0.weight", "module.FPN_LOC.smooth_s4.0.bias", "module.FPN_LOC.smooth_s4.1.weight", "module.FPN_LOC.smooth_s4.1.bias", "module.FPN_LOC.smooth_s3.0.weight", "module.FPN_LOC.smooth_s3.0.bias", "module.FPN_LOC.smooth_s3.1.weight", "module.FPN_LOC.smooth_s3.1.bias", "module.FPN_LOC.smooth_s2.0.weight", "module.FPN_LOC.smooth_s2.0.bias", "module.FPN_LOC.smooth_s2.1.weight", "module.FPN_LOC.smooth_s2.1.bias", "module.FPN_LOC.smooth_s1.0.weight", "module.FPN_LOC.smooth_s1.0.bias", "module.FPN_LOC.smooth_s1.1.weight", "module.FPN_LOC.smooth_s1.1.bias", "module.FPN_LOC.fpn1.0.weight", "module.FPN_LOC.fpn1.1.weight", "module.FPN_LOC.fpn1.1.bias", "module.FPN_LOC.fpn1.1.running_mean", "module.FPN_LOC.fpn1.1.running_var", "module.FPN_LOC.fpn1.1.num_batches_tracked", "module.FPN_LOC.fpn2.0.weight", "module.FPN_LOC.fpn2.1.weight", "module.FPN_LOC.fpn2.1.bias", "module.FPN_LOC.fpn2.1.running_mean", "module.FPN_LOC.fpn2.1.running_var", "module.FPN_LOC.fpn2.1.num_batches_tracked", "module.FPN_LOC.fpn3.0.weight", "module.FPN_LOC.fpn3.1.weight", "module.FPN_LOC.fpn3.1.bias", "module.FPN_LOC.fpn3.1.running_mean", "module.FPN_LOC.fpn3.1.running_var", "module.FPN_LOC.fpn3.1.num_batches_tracked", "module.FPN_LOC.fpn4.0.weight", "module.FPN_LOC.fpn4.1.weight", "module.FPN_LOC.fpn4.1.bias", "module.FPN_LOC.fpn4.1.running_mean", "module.FPN_LOC.fpn4.1.running_var", "module.FPN_LOC.fpn4.1.num_batches_tracked", "module.getmask.conv_1.weight", "module.getmask.conv_1.bias", "module.getmask.conv_2.weight", "module.getmask.conv_2.bias". size mismatch for module.getmask.g.weight: copying a param with shape torch.Size([1024, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([288, 288, 1, 1]). size mismatch for module.getmask.g.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([288]). size mismatch for module.getmask.theta.weight: copying a param with shape torch.Size([1024, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([288, 288, 1, 1]). size mismatch for module.getmask.theta.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([288]). size mismatch for module.getmask.phi.weight: copying a param with shape torch.Size([1024, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([288, 288, 1, 1]). size mismatch for module.getmask.phi.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([288]). size mismatch for module.getmask.W_s.weight: copying a param with shape torch.Size([64, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([18, 18, 1, 1]). size mismatch for module.getmask.W_s.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([18]). size mismatch for module.branch_cls_level_1.branch_cls.0.weight: copying a param with shape torch.Size([32, 317, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 271, 3, 3]).

@CHELSEA234
Copy link
Owner

CHELSEA234 commented Nov 8, 2023

@JulieChoo @pabberpe
the localization_only file is HiFi_Net_loc.py, which calls models/NLCDetection_loc.py, and the corresponding weights can be found here
the localization and detection file is HiFi_Net.py, which calls models/NLCDetection_api.py. The corresponding weights are sitting here
Let me know if this can solve your concerns.

@JulieChoo
Copy link
Author

Hello author, thank you for your reply. I followed the steps here and used the corresponding weights to get the visualization. But when I use Casiav1's forged images for visualization, the effect I get is not good. May I ask where I went wrong?
result

@CHELSEA234
Copy link
Owner

CHELSEA234 commented Nov 9, 2023

@JulieChoo @pabberpe
If you are only doing localization on dataset such as CASIA, please follow this loc.
if you want to produce result on HiFi-IFDL dataset, please go to det_and_loc, which uses different data preprocessing steps.

@pbernabeup
Copy link

pbernabeup commented Nov 9, 2023

@JulieChoo @pabberpe the localization_only file is HiFi_Net_loc.py, which calls models/NLCDetection_loc.py, and the corresponding weights can be found here
the localization and detection file is HiFi_Net.py, which calls models/NLCDetection_api.py. The corresponding weights are sitting here
Let me know if this can solve your concerns.

This solved my issue. I hadn't seen there were two different download links. Thank you!

@JulieChoo
Copy link
Author

JulieChoo commented Nov 10, 2023

@JulieChoo @pabberpe If you are only doing localization on dataset such as CASIA, please follow this loc. if you want to produce result on HiFi-IFDL dataset, please go to det_and_loc, which uses different data preprocessing steps.

Hello author, thank you for your efforts and reply. I solved the problem and can visualize the results on the CASIA dataset.

@CHELSEA234
Copy link
Owner

CHELSEA234 commented Nov 10, 2023

@JulieChoo In fact, you can find both numerical results csv file and visualization in the same section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants