How to avoid the object detector to focus on some objects

Hello everyone,

I’m working with the Faster RCNN to predict the bounding boxes of some particular objects inside a fixed environment. Basically what I want to predict are out-of-place bolts inside a scene. I already trained my model with synthetic images and validating it on real images and fortunately I get some discreet results. The detector is quite confident on locating the bolts (scores > 0.98) but it gets confused with objects with similar shape. An example could be the rivets.

I created my dataset including only images with objects and their bounding boxes but is there a way to actually “suggest” the model even to not consider some objects instead of telling it to locate those bolts?
Thanks in advance

You could add these negative examples to the dataset and don’t provide valid bounding boxes for all negative instances, which would train the model to ignore them.

1 Like

Do you mean by providing empty bounding boxes? Suppose there is an object that I don’t want to be recognized, i can simply annotate the image with

target = {}
target["boxes"] = torch.zeros((0, 4), dtype=torch.float32)
target["labels"] = torch.zeros((0, 1), dtype=torch.int64)

… or maybe by considering the whole image as a bounding box

I don’t know if it would be necessary to provide empty boxes or just not annotate the unwanted objects.

Hi! Thanks for your advice. I think images without annotations would be ignored at all during loading. I’m not labeling the unwanted objects. How to provide images with the unwanted objects only and not give annotations?