pascalvoc#

Functions

from_pascalVOC_detection

Load a pascalVOC detection dataset that follows the official structure.

from_pascalVOC_generic

Load a dataset in pascalVOC format

from_pascalVOC_detection(input_folder: Path) Dataset[source]#

Load a pascalVOC detection dataset that follows the official structure.

Folder is assumed to contain three sub-folders:

  • “Annotations” containing the annotation xml files

  • “JPEGImages” containing the images files

  • “ImageSets/Main” containing the detection split files

See specifications

Notes

  • This has been tested against PascalVOC2012

  • If loading official detection splits, not all images will be assigned a split value.

  • For objects with “parts” (like hands for persons), a new object will be created and a body_id column will link to the corresponding root object.

  • actions.<value> columns are converted to boolean and included in the booleanized column actions.

  • difficult, truncated and occluded columns are converted to boolean.

  • The dataset will remove images without split. If you wish to load all images with available annotation, use from_pascalVOC_generic().

Parameters:

input_folder – Folder containing annotations, images, and split folders.

Returns:

Loaded dataset

from_pascalVOC_generic(annotations_root: Path, images_root: Path | str | None = None, split_folder: Path | str | None = None, split_values: Iterable[str] | str = ('train', 'val')) Dataset[source]#

Load a dataset in pascalVOC format

See specifications (only Object detection)

Notes

  • This has been tested against PascalVOC2012

  • If loading official detection splits, not all images will be assigned a split value.

  • For objects with “parts” (like hands for persons), a new object will be created and a body_id column will link to the corresponding root object.

  • actions.<value> columns are converted to boolean and included in the booleanized column actions.

  • difficult, truncated and occluded columns are converted to boolean.

Parameters:
  • annotations_root – Folder containing the xml files containing annotations

  • images_root – Folder containing the image files. Path to images are given in the corresponding annotation files, relative to this folder. If set to None, will be assumed to be the same as annotations_root. Defaults to None.

  • split_folder – Folder containing txt file for each split. Files are named <split>.txt and contain all the file name without extension contained in that split. If set to None, will be assumed to be the same as annotations_root. Defaults to None.

  • split_values – split value or list of split values to read. Following the aforementioned syntax, will try to open the corresponding split files and assign this split value to the corresponding images. Note that split values need to be exclusive to each other. For example, you cannot load both “train” and “trainval” splits. Defaults to (“train”, “val”).

Returns:

Loaded dataset with split values assigned