Open csisc-yolo opened 11 hours ago
You can download the weights for the PvT series of models from this repository, including pvtv2-b4 https://github.com/whai362/PVT/tree/v2/classification
“Missing keys in the loaded weights” is displayed. What could be the problem?
Author
Can you better articulate your question? I think this is a basic principle of asking someone a coding question. For example what model weights are loaded and also you better make sure you download the right weights.
I am a university student who wants to use Noisy-COD for research and have just started using GitHub. In my eagerness to use Noisy-COD as soon as possible, I ended up asking an impolite question. Below are the details of the error.
===================================================================== [Title] Model Loading Failure in Test.py of PNet.
[Issue] The process at line 37 in Test.py located in Noisy-COD-main/code/TrainPNet fails:
model.load_state_dict(weights_dict)
[Error Message]
File "/home/Noisy-COD-main/code/TrainPNet/Test.py", line 40, in
model.load_state_dict(weights_dict, strict=False)
File "/opt/conda/lib/python3.11/site-packages/torch/nn/modules/module.py", line 2584, in load_state_dict
raise RuntimeError(
RuntimeError: Error(s) in loading state_dict for Network:
size mismatch for GPM.branch_main.1.conv.weight: (... truncated)
[Steps to Reproduce] Run Test.py using the pvt_v2_b4.pth file obtained from https://github.com/whai362/PVT/tree/v2/classification.
[Environment] OS: Ubuntu 22.04 Python: 3.11.10 PyTorch: 2.5.1 CUDA: 12.1 CUDNN: 9
=====================================================================
I am a university student who wants to use Noisy-COD for research and have just started using GitHub. In my eagerness to use Noisy-COD as soon as possible, I ended up asking an impolite question. Below are the details of the error.
===================================================================== [Title] Model Loading Failure in Test.py of PNet.
[Issue] The process at line 37 in Test.py located in Noisy-COD-main/code/TrainPNet fails:
model.load_state_dict(weights_dict)
[Error Message] File "/home/Noisy-COD-main/code/TrainPNet/Test.py", line 40, in model.load_state_dict(weights_dict, strict=False) File "/opt/conda/lib/python3.11/site-packages/torch/nn/modules/module.py", line 2584, in load_state_dict raise RuntimeError( RuntimeError: Error(s) in loading state_dict for Network: size mismatch for GPM.branch_main.1.conv.weight: (... truncated)
[Steps to Reproduce] Run Test.py using the pvt_v2_b4.pth file obtained from https://github.com/whai362/PVT/tree/v2/classification.
[Environment] OS: Ubuntu 22.04 Python: 3.11.10 PyTorch: 2.5.1 CUDA: 12.1 CUDNN: 9
=====================================================================
My guess is that you didn't load the right weights, pvt v2 b4 is just the weights for the backbone network, the inference weights I provided for downloading at any of these connections below correspond to each of our four methods, which you can find in the table above Reference inside the readme. In fact, I suggest you read the readme, and even better if you read the paper.
中文:我猜测你是没加载对权重,pvt v2 b4只是骨干网络的权重,我提供的推理权重在下面这些连接的任意一个进行下载,分别对应了我们的四种方法,你可以在readme里面Reference上面的表格中找到。实际上,我建议你把readme读一下,如果你阅读了论文的话那更好了。
https://drive.google.com/file/d/18f2h8FZSa_KYKMgvGVOKAR15KepY8uCQ/view
https://drive.google.com/file/d/1uikuI2LDJ-K2VvGlnz57HCgJq1IA3CmF/view?usp=drive_link
https://drive.google.com/file/d/1aWaypg0dh6PnLs8lfMYKEzc4tmn6PhQa/view
https://drive.google.com/file/d/12Hmz7cwsxB-ssN9ZYmRucmV3xYSiNb1h/view
Hi @zhangjinCV , Where can I get pvt_v2_b4.pth? Thanks