to_caipy#

Dataset.to_caipy(output_path: 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.

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_path – folder where cAIpy folder will be recreated

  • use_schema – If set to True, and json_schema is not None, will use schema for validation and formatting (see option json_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_schema is 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, 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 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 False