opencv dnn disable detecting coco dataset for some categories and enable for others

Question:

I am using the code in this repository https://github.com/salar-dev/python-object-detection-opencv but I want to disable detecting the coco dataset for some categories and enable it for others

I tryed to delete some of the ssd_mobilenet nodes but the program stopped

Asked By: Osama Gaweesh

||

Answers:

add the line with #

      if len(classIds) !=0:
        for classId, confidence, box in zip(classIds.flatten(), confs.flatten(), bbox):
           # if classId == 44:
              cv2.rectangle(img, box, color=(0, 255, 0), thickness=2)
              cv2.putText(img, classNames[classId-1], (box[0] + 10, box[1] + 20), 
                       cv2.FONT_HERSHEY_COMPLEX, 1, (0, 255, 0), thickness=2)

44 is class index in coco.names

Answered By: Osama Gaweesh