Change the parameter’s of viz_utils.visualize_boxes_and_labels_on_image_array() depending on category_index value

Solution for Change the parameter’s of viz_utils.visualize_boxes_and_labels_on_image_array() depending on category_index value
is Given Below:

I recently trained an object detection model in Tensorflow 2.5 and I was wondering exactly how the function viz_utils.visualize_boxes_and_labels_on_image_array() works. Specifically what would be the best way of returning detection boxes with different min_score_thresh values for different category_indexes aswell as constraining the roi to look for bounding boxes for some category_indexes and not others?

Currently this is my code:

viz_utils.visualize_boxes_and_labels_on_image_array(
        image_np_with_detections,
        detections['detection_boxes'],
        detections['detection_classes'],
        detections['detection_scores'],
        #category_index,
        {_: (default if category_index[_] == "acting_player" else 0.1) for _ in category_index},
        use_normalized_coordinates=True,
        max_boxes_to_draw=200,
        min_score_thresh=.30,
        agnostic_mode=False)

I wanted to replace category_index with a dictionary since from the declaration it is initialized as a dictionary but I don’t know how exactly to go about it?