HiSup icon indicating copy to clipboard operation
HiSup copied to clipboard

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

Open YunyaGaoTree opened this issue 1 year ago • 2 comments

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 : )

YunyaGaoTree avatar Jun 12 '23 14:06 YunyaGaoTree

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

XJKunnn avatar Jun 13 '23 03:06 XJKunnn

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

YunyaGaoTree avatar Jun 13 '23 07:06 YunyaGaoTree