-
Notifications
You must be signed in to change notification settings - Fork 7.1k
assert error len(grid_sizes) == len(strides) == len(cell_anchors) #3246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi ! I think this error is fixed on master. #2971 #2960 #2983 #2947. This would be error message on master / next release
In short, you need to pass a Also, I think we should change Line 121 from FRCNN to It think that above line is causing confusion |
@alpha-gradient As @oke-aditya mentioned, the error message has been updated to make the situation less confusing. Here is a simplified version of the code that you are quoting: backbone = torchvision.models.mobilenet_v2(pretrained=True).features
backbone.out_channels = 1280
anchor_generator = AnchorGenerator(sizes=((32, 64, 128, 256, 512),),
aspect_ratios=((0.5, 1.0, 2.0),))
model = FasterRCNN(backbone, num_classes=2, rpn_anchor_generator=anchor_generator) The above snippet uses On the other hand the default anchors used in faster-rcnn is vision/torchvision/models/detection/faster_rcnn.py Lines 186 to 188 in 8ebfd2f
Why is that? This is because by default it uses a Feature Pyramid as a backbone which returns 5 outputs (intermediate layers of the original backbone). The error message that you got basically indicates that the number of outputs on the backbone should match the number of levels of anchor sizes. |
Closing following @oke-aditya and @datumbox great answers. |
It looks like a bug. When I do not set the AnchorGenerator() in FasterRCNN, the default anchor_sizes in ### detection/faster_rcnn.py line182 shows that 'anchor_sizes = ((32,), (64,), (128,), (512,))' which cause len(cell_anchors) == 5. And I found that in the detection/faster_rcnn.py line120 the anchor_size set '((32, 64, 128, 256, 512), )' and len(cell_anchors) == 1
The text was updated successfully, but these errors were encountered: