If k = 0 and self.featmap_names=[0] shouldn't k in self.featmap_names be True? Getting False

Hello People,

i’m trying to get Faster Rcnn to run according to the tutorial given in

.
I get

Traceback (most recent call last):
File “/home/hmmmm/PycharmProjects/pythonProject3/identitymodul.py”, line 296, in
out = model(images)
File “/home/hmmmm/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py”, line 722, in _call_impl
result = self.forward(*input, **kwargs)
File “/home/hmmmm/anaconda3/lib/python3.8/site-packages/torchvision/models/detection/generalized_rcnn.py”, line 99, in forward
detections, detector_losses = self.roi_heads(features, proposals, images.image_sizes, targets)
File “/home/hmmmm/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py”, line 722, in _call_impl
result = self.forward(*input, **kwargs)
File “/home/hmmmm/anaconda3/lib/python3.8/site-packages/torchvision/models/detection/roi_heads.py”, line 751, in forward
box_features = self.box_roi_pool(features, proposals, image_shapes)
File “/home/hmmmm/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py”, line 722, in _call_impl
result = self.forward(*input, **kwargs)
File “/home/hmmmm/anaconda3/lib/python3.8/site-packages/torchvision/ops/poolers.py”, line 198, in forward
self.setup_scales(x_filtered, image_shapes)
File “/home/hmmmm/anaconda3/lib/python3.8/site-packages/torchvision/ops/poolers.py”, line 162, in setup_scales
lvl_min = -torch.log2(torch.tensor(scales[0], dtype=torch.float32)).item()
IndexError: list index out of range

as an error, so i tried to debug and found out that “x_filtered” is empty and this is caused by this for-loop

    for k, v in x.items():
        if k in self.featmap_names:
            x_filtered.append(v)

so i have added some prints to better understand what was happening

    for k, v in x.items():

        print('k')
        print(k)
        print(self.featmap_names)
        print(k in self.featmap_names)
        if k in self.featmap_names:
            x_filtered.append(v)
            print('testo')

and got the following output:

k
0
[0]
False

As I see it this False should be true, but i guess i am not seeing something.

Would be thankful for any help.

Got a solution here: