megvii-research / AnchorDETR

An official implementation of the Anchor DETR.
Other
338 stars 36 forks source link

Load pretrained model AnchorDETR-DC5. #28

Closed NguyenVanThanhHust closed 2 years ago

NguyenVanThanhHust commented 2 years ago

I'm trying to train with my custom data from your pretrained model. I tested successfully with pre-trained model AnchorDETR-C5 with num_feature_levels = 1 . But when I try with AnchorDETR-DC5 with num_feature_levels=3 . I get this error: RuntimeError: Error(s) in loading state_dict for AnchorDETR: size mismatch for input_proj.0.0.weight: copying a param with shape torch.Size([256, 2048, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 512, 3, 3]). When I check, it seems that pretrained model for AnchorDETR-DC5 just use num_feature_levels=1. When I look at file size, they are the same. I suppose if model is trained with multi level feature, input_proj layer should be larger -> model size is larger.

So released AnchorDETR-DC5 is just for num_feature_levels=1. Is this correct? If so, can you release pretrained for num_feature_levels=3 too?

tangjiuqi097 commented 2 years ago

Hi, AnchorDETR-DC5 only use the single ResNet-DC5 feature, so that you should not set the num_feature_levels to 3. The code with multiple feature levels is just a simple example which should not be optimal, and we will not release the model with multiple level features.

NguyenVanThanhHust commented 2 years ago

Tks.