i want to test mAP of mobilenet(V1 or V2), but it seemed that the test code works only for darknet. would you please figure out that how to solve this problem? thank you.
error:
`Model Summary: 97 layers, 6216150 parameters, 6216150 gradients
Traceback (most recent call last):
File "test.py", line 293, in
evaluate(args.cfg,
File "test.py", line 76, in evaluate
model.load_state_dict(torch.load(weights, map_location=device)["state_dict"])
File "/home/dsd/local/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Darknet:
Missing key(s) in state_dict: "module_list.9.Conv2d.weight", "module_list.9.BatchNorm2d.weight", "module_list.9.BatchNorm2d.bias", "module_list.9.BatchNorm2d.running_mean", "module_list.9.BatchNorm2d.running_var", "module_list.16.Conv2d.weight", "module_list.16.BatchNorm2d.weight", "module_list.16.BatchNorm2d.bias", "module_list.16.BatchNorm2d.running_mean", "module_list.16.BatchNorm2d.running_var", "module_list.20.Conv2d.weight", "module_list.20.BatchNorm2d.weight", "module_list.20.BatchNorm2d.bias", "module_list.20.BatchNorm2d.running_mean", "module_list.20.BatchNorm2d.running_var", "module_list.27.Conv2d.weight", "module_list.27.BatchNorm2d.weight", "module_list.27.BatchNorm2d.bias", "module_list.27.BatchNorm2d.running_mean", "module_list.27.BatchNorm2d.running_var", "module_list.29.Conv2d.bias", "module_list.35.Conv2d.weight", "module_list.35.BatchNorm2d.weight", "module_list.35.BatchNorm2d.bias", "module_list.35.BatchNorm2d.running_mean", "module_list.35.BatchNorm2d.running_var", "module_list.36.Conv2d.bias".
size mismatch for module_list.2.Conv2d.weight: copying a param with shape torch.Size([16, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([64, 32, 1, 1]).
size mismatch for module_list.2.BatchNorm2d.weight: copying a param with shape torch.Size([16]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for module_list.2.BatchNorm2d.bias: copying a param with shape torch.Size([16]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for module_list.2.BatchNorm2d.running_mean: copying a param with shape torch.Size([16]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for module_list.2.BatchNorm2d.running_var: copying a param with shape torch.Size([16]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for module_list.3.Conv2d.weight: copying a param with shape torch.Size([96, 16, 1, 1]) from checkpoint, the shape in current model is torch.Size([64, 1, 3, 3]).
size mismatch for module_list.3.BatchNorm2d.weight: copying a param with shape torch.Size([96]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for module_list.3.BatchNorm2d.bias: copying a param with shape torch.Size([96]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for module_list.3.BatchNorm2d.running_mean: copying a param with shape torch.Size([96]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for module_list.3.BatchNorm2d.running_var: copying a param with shape torch.Size([96]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for module_list.4.Conv2d.weight: copying a param with shape torch.Size([96, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 64, 1, 1]).
size mismatch for module_list.4.BatchNorm2d.weight: copying a param with shape torch.Size([96]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.4.BatchNorm2d.bias: copying a param with shape torch.Size([96]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.4.BatchNorm2d.running_mean: copying a param with shape torch.Size([96]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.4.BatchNorm2d.running_var: copying a param with shape torch.Size([96]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.5.Conv2d.weight: copying a param with shape torch.Size([24, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 1, 3, 3]).
size mismatch for module_list.5.BatchNorm2d.weight: copying a param with shape torch.Size([24]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.5.BatchNorm2d.bias: copying a param with shape torch.Size([24]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.5.BatchNorm2d.running_mean: copying a param with shape torch.Size([24]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.5.BatchNorm2d.running_var: copying a param with shape torch.Size([24]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.6.Conv2d.weight: copying a param with shape torch.Size([144, 24, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 128, 1, 1]).
size mismatch for module_list.6.BatchNorm2d.weight: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.6.BatchNorm2d.bias: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.6.BatchNorm2d.running_mean: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.6.BatchNorm2d.running_var: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.7.Conv2d.weight: copying a param with shape torch.Size([144, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 1, 3, 3]).
size mismatch for module_list.7.BatchNorm2d.weight: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.7.BatchNorm2d.bias: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.7.BatchNorm2d.running_mean: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.7.BatchNorm2d.running_var: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.8.Conv2d.weight: copying a param with shape torch.Size([24, 144, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 128, 1, 1]).
size mismatch for module_list.8.BatchNorm2d.weight: copying a param with shape torch.Size([24]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.8.BatchNorm2d.bias: copying a param with shape torch.Size([24]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.8.BatchNorm2d.running_mean: copying a param with shape torch.Size([24]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.8.BatchNorm2d.running_var: copying a param with shape torch.Size([24]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.10.Conv2d.weight: copying a param with shape torch.Size([144, 24, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).
size mismatch for module_list.10.BatchNorm2d.weight: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.10.BatchNorm2d.bias: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.10.BatchNorm2d.running_mean: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.10.BatchNorm2d.running_var: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.11.Conv2d.weight: copying a param with shape torch.Size([144, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 1, 3, 3]).
size mismatch for module_list.11.BatchNorm2d.weight: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.11.BatchNorm2d.bias: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.11.BatchNorm2d.running_mean: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.11.BatchNorm2d.running_var: copying a param with shape torch.Size([144]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for module_list.12.Conv2d.weight: copying a param with shape torch.Size([32, 144, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 256, 1, 1]).
size mismatch for module_list.12.BatchNorm2d.weight: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.12.BatchNorm2d.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.12.BatchNorm2d.running_mean: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.12.BatchNorm2d.running_var: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.13.Conv2d.weight: copying a param with shape torch.Size([192, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 1, 3, 3]).
size mismatch for module_list.13.BatchNorm2d.weight: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.13.BatchNorm2d.bias: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.13.BatchNorm2d.running_mean: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.13.BatchNorm2d.running_var: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.14.Conv2d.weight: copying a param with shape torch.Size([192, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
size mismatch for module_list.14.BatchNorm2d.weight: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.14.BatchNorm2d.bias: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.14.BatchNorm2d.running_mean: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.14.BatchNorm2d.running_var: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.15.Conv2d.weight: copying a param with shape torch.Size([32, 192, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 1, 3, 3]).
size mismatch for module_list.15.BatchNorm2d.weight: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.15.BatchNorm2d.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.15.BatchNorm2d.running_mean: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.15.BatchNorm2d.running_var: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.17.Conv2d.weight: copying a param with shape torch.Size([192, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 1, 3, 3]).
size mismatch for module_list.17.BatchNorm2d.weight: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.17.BatchNorm2d.bias: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.17.BatchNorm2d.running_mean: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.17.BatchNorm2d.running_var: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.18.Conv2d.weight: copying a param with shape torch.Size([192, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
size mismatch for module_list.18.BatchNorm2d.weight: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.18.BatchNorm2d.bias: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.18.BatchNorm2d.running_mean: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.18.BatchNorm2d.running_var: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.19.Conv2d.weight: copying a param with shape torch.Size([32, 192, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 1, 3, 3]).
size mismatch for module_list.19.BatchNorm2d.weight: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.19.BatchNorm2d.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.19.BatchNorm2d.running_mean: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.19.BatchNorm2d.running_var: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.21.Conv2d.weight: copying a param with shape torch.Size([192, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 1, 3, 3]).
size mismatch for module_list.21.BatchNorm2d.weight: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.21.BatchNorm2d.bias: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.21.BatchNorm2d.running_mean: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.21.BatchNorm2d.running_var: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.22.Conv2d.weight: copying a param with shape torch.Size([192, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
size mismatch for module_list.22.BatchNorm2d.weight: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.22.BatchNorm2d.bias: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.22.BatchNorm2d.running_mean: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.22.BatchNorm2d.running_var: copying a param with shape torch.Size([192]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.23.Conv2d.weight: copying a param with shape torch.Size([64, 192, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 1, 3, 3]).
size mismatch for module_list.23.BatchNorm2d.weight: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.23.BatchNorm2d.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.23.BatchNorm2d.running_mean: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.23.BatchNorm2d.running_var: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.24.Conv2d.weight: copying a param with shape torch.Size([384, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([1024, 512, 1, 1]).
size mismatch for module_list.24.BatchNorm2d.weight: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.24.BatchNorm2d.bias: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.24.BatchNorm2d.running_mean: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.24.BatchNorm2d.running_var: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.25.Conv2d.weight: copying a param with shape torch.Size([384, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([1024, 1, 3, 3]).
size mismatch for module_list.25.BatchNorm2d.weight: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.25.BatchNorm2d.bias: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.25.BatchNorm2d.running_mean: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.25.BatchNorm2d.running_var: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.26.Conv2d.weight: copying a param with shape torch.Size([64, 384, 1, 1]) from checkpoint, the shape in current model is torch.Size([1024, 1024, 1, 1]).
size mismatch for module_list.26.BatchNorm2d.weight: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.26.BatchNorm2d.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.26.BatchNorm2d.running_mean: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.26.BatchNorm2d.running_var: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for module_list.28.Conv2d.weight: copying a param with shape torch.Size([384, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 256, 3, 3]).
size mismatch for module_list.28.BatchNorm2d.weight: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.28.BatchNorm2d.bias: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.28.BatchNorm2d.running_mean: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.28.BatchNorm2d.running_var: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for module_list.29.Conv2d.weight: copying a param with shape torch.Size([384, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([75, 512, 1, 1]).
size mismatch for module_list.32.Conv2d.weight: copying a param with shape torch.Size([384, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 256, 1, 1]).
size mismatch for module_list.32.BatchNorm2d.weight: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.32.BatchNorm2d.bias: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.32.BatchNorm2d.running_mean: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.32.BatchNorm2d.running_var: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for module_list.36.Conv2d.weight: copying a param with shape torch.Size([384, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([75, 256, 1, 1]).
❓ How to test mAP on mobilenet?
i want to test mAP of mobilenet(V1 or V2), but it seemed that the test code works only for darknet. would you please figure out that how to solve this problem? thank you.
error: `Model Summary: 97 layers, 6216150 parameters, 6216150 gradients Traceback (most recent call last): File "test.py", line 293, in
evaluate(args.cfg,
File "test.py", line 76, in evaluate
model.load_state_dict(torch.load(weights, map_location=device)["state_dict"])
File "/home/dsd/local/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Darknet:
Missing key(s) in state_dict: "module_list.9.Conv2d.weight", "module_list.9.BatchNorm2d.weight", "module_list.9.BatchNorm2d.bias", "module_list.9.BatchNorm2d.running_mean", "module_list.9.BatchNorm2d.running_var", "module_list.16.Conv2d.weight", "module_list.16.BatchNorm2d.weight", "module_list.16.BatchNorm2d.bias", "module_list.16.BatchNorm2d.running_mean", "module_list.16.BatchNorm2d.running_var", "module_list.20.Conv2d.weight", "module_list.20.BatchNorm2d.weight", "module_list.20.BatchNorm2d.bias", "module_list.20.BatchNorm2d.running_mean", "module_list.20.BatchNorm2d.running_var", "module_list.27.Conv2d.weight", "module_list.27.BatchNorm2d.weight", "module_list.27.BatchNorm2d.bias", "module_list.27.BatchNorm2d.running_mean", "module_list.27.BatchNorm2d.running_var", "module_list.29.Conv2d.bias", "module_list.35.Conv2d.weight", "module_list.35.BatchNorm2d.weight", "module_list.35.BatchNorm2d.bias", "module_list.35.BatchNorm2d.running_mean", "module_list.35.BatchNorm2d.running_var", "module_list.36.Conv2d.bias".
`