0

I have trained a YOLOv4 on 6 classes, after seeing the results on videos, I want to delete a class (id=3) as I found it uncessary to my project. Can I use the same model on videos and force it to ignore a class and only detects the other 5 classes without retraining the model on 5 classes. Thank you

SSSSSSSSS
  • 1
  • 3
  • 1
    Maybe this might help. https://stackoverflow.com/questions/57898577/how-to-reduce-number-of-classes-in-yolov3-files – jhmt Apr 28 '21 at 11:19

2 Answers2

0

Unfortunately a trained model will have a final fcn layer aka grid cells, with each grid cell having a (B x (5 + C)) dimension.

The possible way for you to suppress that class is during post processing where you can filter out the class based on id.

Mahesh
  • 175
  • 1
  • 13
0

I don't think that it is possible on the Neural Network end, maybe you can try to modify it on the application end, something on the lines of:

# get detections
# perform NMS
for index in indices:
    if classes[class_ids[index] == "something I want to avoid":
        pass
    else:
        # draw the bounding box

**Note: ** The code is loosely based on this example from the Learn OpenCV blog.

Dharman
  • 30,962
  • 25
  • 85
  • 135
ssarkar
  • 33
  • 1
  • 9