tiancity-NJU/da-faster-rcnn-PyTorch

how to run batch_demo.py?

twinkleShen opened this issue · 2 comments

I have successfully run the python file test.py and da_trainval_net.py,but failed to run batch_demo.py,I dont known the reason.
I met with such question:

RuntimeError: Error(s) in loading state_dict for vgg16: Unexpected key(s) in state_dict: "RCNN_imageDA.Conv1.weight", "RCNN_imageDA.Conv2.weight", "RCNN_instanceDA.dc_ip1.weight", "RCNN_instanceDA.dc_ip1.bias", "RCNN_instanceDA.dc_ip2.weight", "RCNN_instanceDA.dc_ip2.bias", "RCNN_instanceDA.clssifer.weight", "RCNN_instanceDA.clssifer.bias". While copying the parameter named "RCNN_cls_score.weight", whose dimensions in the model are torch.Size([21, 4096]) and whose dimensions in the checkpoint are torch.Size([9, 4096]). While copying the parameter named "RCNN_cls_score.bias", whose dimensions in the model are torch.Size([21]) and whose dimensions in the checkpoint are torch.Size([9]). While copying the parameter named "RCNN_bbox_pred.weight", whose dimensions in the model are torch.Size([84, 4096]) and whose dimensions in the checkpoint are torch.Size([36, 4096]). While copying the parameter named "RCNN_bbox_pred.bias", whose dimensions in the model are torch.Size([84]) and whose dimensions in the checkpoint are torch.Size([36]).

how can I observe the transform phenomenon?can someone tell me?

This problem may because the class number is different between the checkpoint and your test dataset, so you just need to change the class number, it will be work

modify line197 fasterRCNN.load_state_dict(checkpoint['model'],strict=False)could solve this problem