IDEA-Research / DINO

[ICLR 2023] Official implementation of the paper "DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection"
Apache License 2.0
2.24k stars 250 forks source link

Is it necessary to load pretrained backbone via 'backbone_dir' argument for pertained model? #68

Closed morgankohler closed 2 years ago

morgankohler commented 2 years ago

Getting "AttributeError: 'ConfigDict' object has no attribute 'backbone_dir'" error when trying to load config files. Is this necessary? Seems like loading pretrained model would just write over these weights anyway? Is this a bug?

I just commented out the backbone loading parts and it works fine. So seems like a hold out from training maybe.

HaoZhang534 commented 2 years ago

@morgankohler "backbone_dir" is only necessary for Swin-L or Convnext models. The backbone checkpoint will not write over the pre-trained weight appointed by --resume. If you run R50 model or resume from a checkpoint, you can ignore 'backbone_dir' or just comment the backbone loading parts.

morgankohler commented 2 years ago

Is this needed though? The weights are simply reloaded by the pertained model after loading the backbone weights. I'm getting good results without loading the backbone model first. Is the DINO with Swin-L not meant to contain the backbone weights? Because it does. But that wouldn't make sense as it is fine-tuned is it not?

If it's just a code thing imo it's worth it to add a check for whether or not you are loading from a full pretrained model so you don't require both backbone model and DINO model if backbone model is not used.

HaoZhang534 commented 2 years ago

@morgankohler "backbone_dir" is not necessary if you set --resume. Our code currently does not check whether you are loading from a full pre-trained model. We will support that in the next version.