diff --git a/imageai/Detection/__init__.py b/imageai/Detection/__init__.py index a31f7dc6..03a6843b 100644 --- a/imageai/Detection/__init__.py +++ b/imageai/Detection/__init__.py @@ -368,6 +368,7 @@ def detectObjectsFromImage(self, input_image="", output_image_path="", input_typ color = label_color(label) detection_details = detections[0, index, :4].astype(int) + detection_details = np.maximum(detection_details, 0) draw_box(detected_copy, detection_details, color=color) if (display_object_name == True and display_percentage_probability == True): @@ -743,6 +744,7 @@ def detectCustomObjectsFromImage(self, custom_objects=None, input_image="", outp color = label_color(label) detection_details = detections[0, index, :4].astype(int) + detection_details = np.maximum(detection_details, 0) draw_box(detected_copy, detection_details, color=color) if (display_object_name == True and display_percentage_probability == True):