How to get only boxes for specific categories in tensorflow object detection

Viewed 2870

The object detection notebook demonstrates, how pretrained and frozen tensorflow models can be used to detect objects in test images.

In this notetook, the function

from utils import visualization_utils as vis_util
vis_util.visualize_boxes_and_labels_on_image_array(
      image_np,
      np.squeeze(boxes),
      np.squeeze(classes).astype(np.int32),
      np.squeeze(scores),
      category_index,
      use_normalized_coordinates=True,
      line_thickness=8)

outputs test images, where boxes are drawn around detected objects.

How can I use this function to draw only boxes of a specific category instead of boxes of all categories in the category_index set? I.e., how can I get this function to only draw boxes around objects of which the model is sure they are e.g. cars?

1 Answers
Related