from_pascalVOC_generic#

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