SarahwXU / HiSup

MIT License
128 stars 18 forks source link

Fine tuning pretrained models but it turns out the pretrained model does not have encoder part. #14

Open YunyaGaoTree opened 1 year ago

YunyaGaoTree commented 1 year ago

Dear Sarah,

I would like to kindly ask how to use pretrained model (e.g. hrnet-w48-v2 backbone) as the following screenshot shows. issue1

What I have done is loading this pretrained model and then use the train function to start fine-tuning. As this screenshot shows: issue0

However, it always has an error 'BuildingDetector' object has no attribute 'encoder' as the following shows: issue

I run these experiments in Google CoLab now with a support of an A100 GPU. I have used the pretrained model for inference. It works quite well. That is why I would like to fine-tune it to improve its performance further.

Thanks so much for providing this great work and look forward to your reply : )

XJKunnn commented 1 year ago

Hi,

We have only set the encoder module for training mode as shown in the code below. https://github.com/SarahwXU/HiSup/blob/69e0cb3c7039bd038139ae0b95ea4ef03b2e5162/hisup/detector.py#L69-L71 so if you want to finetune from the pretrained models, you need to disable testing mode. https://github.com/SarahwXU/HiSup/blob/69e0cb3c7039bd038139ae0b95ea4ef03b2e5162/hisup/detector.py#L234

YunyaGaoTree commented 1 year ago

Hi,

We have only set the encoder module for training mode as shown in the code below.

https://github.com/SarahwXU/HiSup/blob/69e0cb3c7039bd038139ae0b95ea4ef03b2e5162/hisup/detector.py#L69-L71

so if you want to finetune from the pretrained models, you need to disable testing mode. https://github.com/SarahwXU/HiSup/blob/69e0cb3c7039bd038139ae0b95ea4ef03b2e5162/hisup/detector.py#L234

Hello XJKunn,

Thanks so much for your prompt reply. Now it works after setting test as False.

KInd regards