to_coco#
- Dataset.to_coco(output_path: Path | str, copy_images: bool = False, to_jpg: bool = True, overwrite_images: bool = True, overwrite_labels: bool = True, add_split_suffix: bool | None = None, box_format: str = 'XYWH') None[source]#
Save dataset in coco format. Will create in output directory one JSON file per split present in the dataset.
- Parameters:
output_path – Output folder where to save the JSON files
copy_images – If set to False, will create a symbolic link instead of copying. Much faster, but needs to keep original images in the same relative path. Defaults to False.
to_jpg – if True, along with previous option, will convert images to jpg if needed. Defaults to True.
overwrite_images – if set to False, will skip images that are already copied. Defaults to True.
overwrite_labels – if set to False, will skip JSON files that are already created. Defaults to True.
add_split_suffix – if set to True, will append the name of the split to the json output files. Cannot be False if dataset has multiple splits. If not set, will add suffix only if dataset has multiple splits.
box_format – what type of annotation the json file will have. It will be converted from XYWH. Defaults to XYWH
See also