dlyldxwl / fssd.pytorch

Pytorch re-implementation of Fssd
67 stars 27 forks source link

resume_net未定义以及测试加载的模型 #5

Open jamesbondzhou opened 5 years ago

jamesbondzhou commented 5 years ago

您好,我有两个问题想请教一下。 第一个是train.py第114行,torch.load(resume_net)这里的resume_net没定义吧 第二个问题是test.py运行时报错RuntimeError: Error(s) in loading state_dict for FSSD:size mismatch for conf.0.bias: copying a param with shape torch.Size([126]) from checkpoint, the shape in current model is torch.Size([486])........ 这里net.load_state_dict(new_state_dict)加载fssd_voc_79_74.pth导致了size不匹配

dlyldxwl commented 5 years ago
  1. resume_net is defined in line 36; parser.add_argument('--resume_net', default=None, help='resume net for retraining')
  2. I believe you utilize the pruned model while not modify the version on the test.py when testing. parser.add_argument('-v', '--version', default='FSSD_VGG', help='version.')
jamesbondzhou commented 5 years ago

非常感谢回答! 关于第二个问题。是要把parser.add_argument('-v', '--version', default='FSSD_VGG', help='version.')default这里的FSSD_VGG换成FSSD_VGG_prune么,我试过了,错的更加离谱啦。 这是FSSD_VGG下完整的报错 RuntimeError: Error(s) in loading state_dict for FSSD: size mismatch for conf.0.bias: copying a param with shape torch.Size([126]) from checkpoint, the shape in current model is torch.Size([486]). size mismatch for conf.0.weight: copying a param with shape torch.Size([126, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([486, 512, 3, 3]). size mismatch for conf.1.bias: copying a param with shape torch.Size([126]) from checkpoint, the shape in current model is torch.Size([486]). size mismatch for conf.1.weight: copying a param with shape torch.Size([126, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([486, 512, 3, 3]). size mismatch for conf.2.bias: copying a param with shape torch.Size([126]) from checkpoint, the shape in current model is torch.Size([486]). size mismatch for conf.2.weight: copying a param with shape torch.Size([126, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([486, 256, 3, 3]). size mismatch for conf.3.bias: copying a param with shape torch.Size([126]) from checkpoint, the shape in current model is torch.Size([486]). size mismatch for conf.3.weight: copying a param with shape torch.Size([126, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([486, 256, 3, 3]). size mismatch for conf.4.bias: copying a param with shape torch.Size([84]) from checkpoint, the shape in current model is torch.Size([324]). size mismatch for conf.4.weight: copying a param with shape torch.Size([84, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([324, 256, 3, 3]). size mismatch for conf.5.bias: copying a param with shape torch.Size([84]) from checkpoint, the shape in current model is torch.Size([324]). size mismatch for conf.5.weight: copying a param with shape torch.Size([84, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([324, 256, 3, 3]).

dlyldxwl commented 5 years ago

126 = 21×6 486= 81×6 I guess you use the class number of coco(81) rather than VOC(21)

jamesbondzhou commented 5 years ago

嗯嗯,极有可能!感谢!!

dlyldxwl commented 5 years ago

OK, if you think this repo is useful for you, you can give it a "star", -.- and then, I will release a project about stronger one-stage detector based on ssd /yolo v3, which integrate much tricks, for example, mix up, GIOU and so on. If you are interested in it, please give more attention.

jamesbondzhou commented 5 years ago

持续关注大佬中!!!

ZCCDL commented 5 years ago

我想问一下你是怎么加的BN,为什么我加的时候出错,在加入到VGG主干网络中怎么和原预训练模型匹配呢?谢谢,能交流一下吗?qq2497431867