Include .jpg in mask converter (#18576)

Signed-off-by: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com>
This commit is contained in:
Mohammed Yasin 2025-01-09 20:53:25 +08:00 committed by GitHub
parent 3c0e367103
commit 246c3eca81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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}")