VIA annotation adapter. To use the VIA annotation tool, refer to the Homepage.

Current supported annotations:

  • circle
  • ellipse
  • point
  • polyline
  • rectangle

Current supported annotation tool versions:

The adapter has the following parameters:

  • --path: the path to the base folder containing the annotations (e.g.: data/image_object_detection/my_collection)
  • --categories_file_name: tThe path to the categories file if not set, default to categories.txt
  • --annotations_file_name: The name of annotations file. if not set, default to via_region_data.json
  • --category_label_key: The key, the category label key is stored in the annotation file, default to category.

class VIAAnnotationAdapter[source]

VIAAnnotationAdapter(path, categories_file_name=None, annotations_file_name=None, category_label_key=None) :: AnnotationAdapter

Adapter to read and write annotations in the VIA annotation.

AnnotationAdapter.list_files[source]

AnnotationAdapter.list_files(subset_type=<SubsetType.TRAINVAL: 'trainval'>)

List all physical files in a sub-set. subset_type: the subset type to list return: a list of file paths if subset type exist, else an empty list

VIAAnnotationAdapter.read_annotations[source]

VIAAnnotationAdapter.read_annotations(subset_type=<SubsetType.TRAINVAL: 'trainval'>)

Reads a VIA annotations file. Supports JSON and CSV file format. Format is inferred from the annotations_file setting. subset_type: the subset type to read return: the annotations as dictionary

AnnotationAdapter.read_categories[source]

AnnotationAdapter.read_categories()

Read categories. return: a list of category names

AnnotationAdapter.write_files[source]

AnnotationAdapter.write_files(file_paths, subset_type=<SubsetType.TRAINVAL: 'trainval'>)

Write physical files in a sub-set. file_paths: a list of file paths to write subset_type: the subset type to write into return: a list of written target file paths

VIAAnnotationAdapter.write_annotations[source]

VIAAnnotationAdapter.write_annotations(annotations, subset_type=<SubsetType.TRAINVAL: 'trainval'>)

Writes a VIA annotations file and copy the corresponding source files. Supports JSON and CSV file format. Format is inferred from the annotations_file setting. annotations: the annotations as dictionary subset_type: the subset type to write return: a list of written target file paths

AnnotationAdapter.write_categories[source]

AnnotationAdapter.write_categories(categories)

Write categories. categories: a list of category names

VIAAnnotationAdapter.argparse[source]

VIAAnnotationAdapter.argparse(prefix=None)

Returns the argument parser containing argument definition for command line use. prefix: a parameter prefix to set, if needed return: the argument parser