Creates a dataset for image object detection.

Creating a dataset for a classification or segmentation task. If an annotation file is present, the annotations are also prepared. The data-set is created based on an image-set.

Image-Set

Image-sets are collected images to build a data-set from, stored in the imagesets folder. The imagesets folder contains the following folder structure:

  • imagesets/[image_set_type]/[image_set_name]

Inside the [image_set_name] folder are the following files / folders

  • test/: test images (benchmark)
  • trainval/: training and validation images for cross validation
  • categories.txt: all categories (classes) the image-set contains

Data-Set Folders

Data-sets are stored in the datasets base folder. The datasets folder contains the following folder structure:

  • datasets/[data_set_type]/[data_set_name] where [data_set_type] is the same as the corresponding [image_set_type] and [data_set_name] is the same as the corresponding [image_set_name].

Inside the [data_set_name] folder are the following files / folders

  • test/: test set (benchmark)
  • train/: training set
  • val/: validation set
  • categories.txt: all categories (classes) the data-set contains

Create a object detection data-set

Object detection data-set can be created from a segmentation or object-detection image-set. All images are validated against the annotations, if they contain at least one annotation and that the annotation category belongs to one of the given categories. The annotations have to be in VIA v1 json format. Polygon annotations are converted into rectangle annotations for unique bounding-box generation.

class ImageObjectDetectionDataset[source]

ImageObjectDetectionDataset(input_adapter:AnnotationAdapter, output_adapter:AnnotationAdapter, split=None, seed=None, sample=None, tfrecord=False, join_overlapping_regions=False, annotation_area_threshold=None) :: ImageClassificationDataset

Object detection dataset. name: The name of the dataset. base_path: The data-set base-path. imageset_path: The imageset source path. categories_path: The path to the categories.txt file. annotations_path: The path to the annotations-file. create_tfrecord: Also create .tfrecord files. join_overlapping_regions: Whether overlapping regions of same category should be joined. annotation_area_threshold: Keep only annotations with minimum size (width or height) related to image size