diff --git a/test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_expect.pkl b/test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_expect.pkl index 9a9207b7360..df07bea5c74 100644 Binary files a/test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_expect.pkl and b/test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_expect.pkl differ diff --git a/test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_fpn_expect.pkl b/test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_fpn_expect.pkl index 9be3d021af6..1fa8647e40e 100644 Binary files a/test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_fpn_expect.pkl and b/test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_fpn_expect.pkl differ diff --git a/torchvision/models/detection/faster_rcnn.py b/torchvision/models/detection/faster_rcnn.py index 1529298b1bc..5e90dc58763 100644 --- a/torchvision/models/detection/faster_rcnn.py +++ b/torchvision/models/detection/faster_rcnn.py @@ -372,7 +372,7 @@ def fasterrcnn_resnet50_fpn(pretrained=False, progress=True, def fasterrcnn_mobilenet_v3_large(pretrained=False, progress=True, num_classes=91, pretrained_backbone=True, - trainable_backbone_layers=None, min_size=320, max_size=640, **kwargs): + trainable_backbone_layers=None, min_size=320, max_size=320, **kwargs): """ Constructs a Faster R-CNN model with a MobileNetV3-Large backbone. It works similarly to Faster R-CNN with ResNet-50 FPN backbone. See `fasterrcnn_resnet50_fpn` for more details. @@ -402,7 +402,7 @@ def fasterrcnn_mobilenet_v3_large(pretrained=False, progress=True, num_classes=9 backbone = mobilenet_backbone("mobilenet_v3_large", pretrained_backbone, False, trainable_layers=trainable_backbone_layers) - anchor_sizes = ((16, 32, 64, 128, 256), ) + anchor_sizes = ((8, 16, 32, 64, 128, ), ) aspect_ratios = ((0.5, 1.0, 2.0), ) model = FasterRCNN(backbone, num_classes, rpn_anchor_generator=AnchorGenerator(anchor_sizes, aspect_ratios), @@ -414,7 +414,7 @@ def fasterrcnn_mobilenet_v3_large(pretrained=False, progress=True, num_classes=9 def fasterrcnn_mobilenet_v3_large_fpn(pretrained=False, progress=True, num_classes=91, pretrained_backbone=True, - trainable_backbone_layers=None, min_size=320, max_size=640, **kwargs): + trainable_backbone_layers=None, min_size=320, max_size=320, **kwargs): """ Constructs a Faster R-CNN model with a MobileNetV3-Large FPN backbone. It works similarly to Faster R-CNN with ResNet-50 FPN backbone. See `fasterrcnn_resnet50_fpn` for more details. @@ -444,7 +444,7 @@ def fasterrcnn_mobilenet_v3_large_fpn(pretrained=False, progress=True, num_class backbone = mobilenet_backbone("mobilenet_v3_large", pretrained_backbone, True, trainable_layers=trainable_backbone_layers) - anchor_sizes = ((16, 32, 64, 128, 256, ), ) * 3 + anchor_sizes = ((8, 16, 32, 64, 128, ), ) * 3 aspect_ratios = ((0.5, 1.0, 2.0),) * len(anchor_sizes) model = FasterRCNN(backbone, num_classes, rpn_anchor_generator=AnchorGenerator(anchor_sizes, aspect_ratios),