From 246c3eca81b6b4b3bf754d5c2c5d4fefce03cca0 Mon Sep 17 00:00:00 2001 From: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:53:25 +0800 Subject: [PATCH] Include .jpg in mask converter (#18576) Signed-off-by: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com> --- ultralytics/data/converter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ultralytics/data/converter.py b/ultralytics/data/converter.py index d3d3d706..21ab0a95 100644 --- a/ultralytics/data/converter.py +++ b/ultralytics/data/converter.py @@ -377,7 +377,7 @@ def convert_segment_masks_to_yolo_seg(masks_dir, output_dir, classes): """ pixel_to_class_mapping = {i + 1: i for i in range(classes)} for mask_path in Path(masks_dir).iterdir(): - if mask_path.suffix == ".png": + if mask_path.suffix in {".png", ".jpg"}: mask = cv2.imread(str(mask_path), cv2.IMREAD_GRAYSCALE) # Read the mask image in grayscale img_height, img_width = mask.shape # Get image dimensions LOGGER.info(f"Processing {mask_path} imgsz = {img_height} x {img_width}")