Fix gitignore to format Docs datasets (#16071)
Signed-off-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
6f5c3c8cea
commit
ce24c7273e
41 changed files with 767 additions and 744 deletions
|
|
@ -385,7 +385,7 @@ def convert_segment_masks_to_yolo_seg(masks_dir, output_dir, classes):
|
|||
continue # Skip background
|
||||
class_index = pixel_to_class_mapping.get(value, -1)
|
||||
if class_index == -1:
|
||||
LOGGER.warning(f"Unknown class for pixel value {value} in file {mask_filename}, skipping.")
|
||||
LOGGER.warning(f"Unknown class for pixel value {value} in file {mask_path}, skipping.")
|
||||
continue
|
||||
|
||||
# Create a binary mask for the current class and find contours
|
||||
|
|
@ -403,7 +403,7 @@ def convert_segment_masks_to_yolo_seg(masks_dir, output_dir, classes):
|
|||
yolo_format.append(round(point[1] / img_height, 6))
|
||||
yolo_format_data.append(yolo_format)
|
||||
# Save Ultralytics YOLO format data to file
|
||||
output_path = Path(output_dir) / f"{Path(mask_filename).stem}.txt"
|
||||
output_path = Path(output_dir) / f"{mask_path.stem}.txt"
|
||||
with open(output_path, "w") as file:
|
||||
for item in yolo_format_data:
|
||||
line = " ".join(map(str, item))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue