Closed E-Dreamer-LQ closed 4 years ago
I guess this is because of the inconsistent definition in your two dataset definition codes, i.e. 'sim10k.py' and 'city.py'. The number of categories in these two files maybe not identical, three classes in one file and two classes in another file.
You can refer to the codes in ./lib/model/adaptive_faster_rcnn/resnet.py, line 261-265: self.RCNN_cls_score = nn.Linear(2048, self.n_classes) if self.class_agnostic: self.RCNN_bbox_pred = nn.Linear(2048, 4) else: self.RCNN_bbox_pred = nn.Linear(2048, 4 * self.n_classes) The inconsistency of category number in source and target domain can cause the inconsistency of model's parameter in these two fc layers.
emmm , Thank you for your reply, In my 'sim10k.py': self._classes = ('background', # always index 0 'car','motorbike') in my 'city.py' : self._classes = ('background', # always index 0 'car') The solution is "remove 'motorbike' "?
Yep, or add 'motorbike' to 'city.py', but you have to include the motorbike annotations in this way. Also you may have to re-train your model when you add this class, since the categories on two domains must be identical.
@ChrisAllenMing , hello , I have some problems about the test results , Why is the training getting worse? The test result of the first epoch was the peak ( map : 0.4158) , Is something wrong? thank you .
In my runs, the peak performance exists in the 5th or 6th epoch, maybe you can try to adjust the learning rate and other hyper-parameters.
你好,我跑了下你的代码,为什么sim10k.py中没有加入motorbike类,但是跑train_baseline的时候会报错KeyError:'motorbike'呢
Since there is no 'motorbike' definition in 'sim10k.py' , I think there should be something wrong in your annotation files. In specific, you should check whether you have precluded the annotations of the classes other than 'car'.
hello, there was some problems when I try to reproduction your code. According to your Readme, I test my model. The problem is :
size mismatch for RCNN_cls_score.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([2]). size mismatch for RCNN_cls_score.weight: copying a param with shape torch.Size([3, 2048]) from checkpoint, the shape in current model is torch.Size([2, 2048]). size mismatch for RCNN_bbox_pred.bias: copying a param with shape torch.Size([12]) from checkpoint, the shape in current model is torch.Size([8]). size mismatch for RCNN_bbox_pred.weight: copying a param with shape torch.Size([12, 2048]) from checkpoint, the shape in current model is torch.Size([8, 2048]).
My target domain dataset was set 'city', and when i set 'sim10k' ,it can be tested. @ChrisAllenMing