Cannot run Visual Genome VGG16 model
See original GitHub issueWhenever I try to run VGG16 trained on Visual Genome, I get errors of dimensions mismatches between the models.
I use this command to launch the test:
python demo.py --net vgg16 --dataset vg --checksession 1 --checkepoch 19 --checkpoint 48611 --cuda --load_dir ./data/pretrained_model
but I obtain the following error:
Traceback (most recent call last): File "demo.py", line 197, in <module> fasterRCNN.load_state_dict(checkpoint['model']) File "/root/faster-rcnn.pytorch/.venv/lib/python3.5/site-packages/torch/nn/modules/module.py", line 721, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for vgg16: While copying the parameter named "RCNN_rpn.RPN_cls_score.weight", whose dimensions in the model are torch.Size([18, 512, 1, 1]) and whose di mensions in the checkpoint are torch.Size([24, 512, 1, 1]). While copying the parameter named "RCNN_rpn.RPN_cls_score.bias", whose dimensions in the model are torch.Size([18]) and whose dimensions in t he checkpoint are torch.Size([24]). While copying the parameter named "RCNN_rpn.RPN_bbox_pred.weight", whose dimensions in the model are torch.Size([36, 512, 1, 1]) and whose di mensions in the checkpoint are torch.Size([48, 512, 1, 1]). While copying the parameter named "RCNN_rpn.RPN_bbox_pred.bias", whose dimensions in the model are torch.Size([36]) and whose dimensions in t he checkpoint are torch.Size([48]). While copying the parameter named "RCNN_cls_score.weight", whose dimensions in the model are torch.Size([21, 4096]) and whose dimensions in t he checkpoint are torch.Size([2501, 4096]). While copying the parameter named "RCNN_cls_score.bias", whose dimensions in the model are torch.Size([21]) and whose dimensions in the check point are torch.Size([2501]). While copying the parameter named "RCNN_bbox_pred.weight", whose dimensions in the model are torch.Size([84, 4096]) and whose dimensions in t he checkpoint are torch.Size([10004, 4096]). While copying the parameter named "RCNN_bbox_pred.bias", whose dimensions in the model are torch.Size([84]) and whose dimensions in the check point are torch.Size([10004]).
Am I missing something?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:5
Top GitHub Comments
It appears that two problems led to my error: The different dimensions of “RCNN_rpn.RPN_cls_score.bias” (18, 24) are caused by the default ANCHOR_SCALES parameter used in demo.py. Model trained on COCO dataset has anchor_scales [4,8,16,32], while demo uses the same [8,16,32] for all datasets as defined here. Thus, to run demo on model trained on COCO, change that line to [4,8,16,32]. The different dimensions of “RCNN_rpn.RPN_cls_score.bias” (21, 11) can be fixed by changing this line to the classes in your own dataset.
may I ask you a question?How do you make vg dataset?I follow the process of bottom-up-attention, but can not get dataset as the project asked