to_caipy_generic#
- Dataset.to_caipy_generic(output_images_folder: Path | str | None, output_annotations_folder: Path | str, use_schema: bool = False, json_schema: Path | str | None = 'default', copy_images: bool = True, to_jpg: bool = True, overwrite_images: bool = True, overwrite_labels: bool = True, flatten_paths: bool = True) None[source]#
Convert dataset to cAIpy format, but with the possibility to specify images and annotations folders rather than a root folder with Images and Annotations sub-folders. It is especially useful when creating predictions or saving variations of a annotations.
Note
Unless specified otherwise, relative paths of images a flattened during the export, which modifies the dataset if the images and annotations were stored in subfolders, but will put all images and annotations of a particular split in their respective root folder.
If schema is not given, the nested dictionary will be deduced from column names with the separator “.”
- Parameters:
output_images_folder – root folder where the images will be saved. If None, will not save images. Useful when only saving predictions or a variations of annotations.
output_annotations_folder – root folder where the json file will be saved.
use_schema – If set to True, and
json_schemais not None, will use schema for validation and formatting (see optionjson_schema)json_schema – Path to a schema that output json dicts will be tested against for compliance. They will also be used to remove columns for fields no included in the schema. Can be either a url or a path object. If set to None, or
use_schemais set to False, will not perform any test. Defaults to default schema.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, 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 annotation that are already created. Defaults to True.
flatten_paths – if set to True, will put all files in the root Annotations and Images folders by replacing folder separation (“/”) with “_” in relative path. Defaults to True
See also