diff --git a/overlay_annot_detect.py b/overlay_annot_detect.py index 3612db63520d3e904dde28a75d035ef7a3312ab9..40453eb990b69c31684f5b458dcb51e4a3eeabc7 100644 --- a/overlay_annot_detect.py +++ b/overlay_annot_detect.py @@ -52,9 +52,12 @@ def overlay_annotations(image_path, annotation_path, detection_path, output_dire cv2.putText(image, label, text_shape, cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1) output_path = os.path.join(output_directory, f'{base_name}.jpg') + if not os.path.exists(output_directory): + os.mkdir(output_directory) + plt.imshow(image, cmap='jet') - plt.title('Blues : ANNOTATIONS; Greens : YOLO DETECTIONS', loc = 'center') - plt.subplots_adjust(top=1, bottom=0, left=0, right=1) + plt.title('Blues : ANNOTATION; Greens : YOLO DETECTION', loc = 'center') + plt.savefig(output_path) plt.close()