sovit-123 / fasterrcnn-pytorch-training-pipeline

PyTorch Faster R-CNN Object Detection on Custom Dataset
MIT License
217 stars 70 forks source link

Use pretrained weights from Torchvision models #149

Closed joshua-atolagbe closed 2 months ago

joshua-atolagbe commented 2 months ago

@sovit-123 Please how do I use pretrained weights from torch vision as initialization weights to train the fasterRCNN on my custom data? I don’t want to build the model from scratch.

sovit-123 commented 2 months ago

Hi, you do not need to build model from scratch. Whenever a pretrained model is used, the weights are loaded. For example, if you use fasterrcnn_resnet50_fpn_v2, then the respective pretrained weights are loaded.

UPDATE: I have modified the print statement to "Building model from models folder..." during training so that its less confusing.

joshua-atolagbe commented 2 months ago

Thank you so much for your hard work @sovit-123 . Also, I am having issue when making inference. The finetuned fasterrcnn_resnet50_fpn_v2 model detects multiple objects even though it is trained to identify just one object type. Say if the number of that objects that i want to detect in an image is 2, the model detects about 1000 of that object in the image. What could be the issue?

Also, how can i use the finetune model with SAHI to perform tiled inference?

sovit-123 commented 2 months ago

I think it may boil down to the training. May I know what is the dataset, how many epochs you are training for, and what mAP you are getting?

joshua-atolagbe commented 2 months ago

Sorry for the earlier confusion @sovit-123 . I had a test mAP@50 of 77% using the eval.py. The issue stems from me trying to perform SAHI inference with the finetune model.

sovit-123 commented 2 months ago

Oh. Understood. So, is the issue solved for you now. Can I close it?