Error while implenting the Faster R-CNN Object detection algorithm
I am trying to implement the Faster R-CNN object detection algorithm and I have an unusual error.
While trying to call the train_one_epoch function in this colab tutorial I had an error in the loss_dict = model(images, targets)which is mentioned here .
The exact error that i had is :
    101         cell_anchors = self.cell_anchors
    102         assert cell_anchors is not None
--&gt; 103         assert len(grid_sizes) == len(strides) == len(cell_anchors)
    104 
    105         for size, stride, base_anchors in zip(

AssertionError:

Anyone have an idea ? And thanks in advance !

Finally, I was able to solve this problem and it's just by adding adjusting the size of the AnchorGenerator and their corresponding aspect ratios in the Faster R-CNN function
ft_anchor_generator = AnchorGenerator(
    sizes=((32, 64, 128),), aspect_ratios=((0.5, 1.0, 2.0),)
)
ft_model = FasterRCNN(
    backbone=ft_backbone,
    num_classes=num_classes,
    rpn_anchor_generator=ft_anchor_generator)

