sovit-123 / fasterrcnn-pytorch-training-pipeline

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

TypeError: __init__() got an unexpected keyword argument 'weights' #119

Closed CharisWg closed 10 months ago

CharisWg commented 10 months ago

Building model from scratch... Traceback (most recent call last): File "train.py", line 571, in main(args) File "train.py", line 306, in main model = build_model(num_classes=NUM_CLASSES, pretrained=True) File "/datashare3/charis/code/recaps/fasterRcnn/fasterrcnn-pytorch-training-pipeline-main/models/create_fasterrcnn_model.py", line 6, in return_fasterrcnn_resnet50_fpn model = fasterrcnn_resnet50_fpn.create_model( File "/datashare3/charis/code/recaps/fasterRcnn/fasterrcnn-pytorch-training-pipeline-main/models/fasterrcnn_resnet50_fpn.py", line 7, in create_model model = torchvision.models.detection.fasterrcnn_resnet50_fpn( File "/datashare3/charis/anaconda/envs/m2/lib/python3.8/site-packages/torchvision/models/detection/faster_rcnn.py", line 368, in fasterrcnn_resnet50_fpn model = FasterRCNN(backbone, num_classes, **kwargs) TypeError: init() got an unexpected keyword argument 'weights'

sovit-123 commented 10 months ago

Hi. May I know your PyTorch version? This seems to be an issue with older PyTorch versions. The library supports PyTorch 1.12.0 and higher.

CharisWg commented 10 months ago

My PyTorch version is 1.9

sovit-123 commented 10 months ago

Okay. I think updating the PyTorch version to 1.12.0 or higher will solve the issue.

sovit-123 commented 10 months ago

Hi. I hope your issue has been solved. I am closing the issue for now. Please reopen if necessary.