tensorbay.opendataset._utility

OpenDataset utility code.

tensorbay.opendataset._utility.coco(path)[source]

Parse the coco-like label files.

Parameters

path (str) – The label directory of the dataset.

Returns

A dict containing four dicts:

======================  =============  ==========================
dicts                   keys           values
======================  =============  ==========================
images                  image id       information of image files
annotations             annotation id  annotations
categories              category id    all categories
images_annotations_map  image id       annotation id
======================  =============  ==========================

Return type

tensorbay.opendataset._utility.coco.COCO

tensorbay.opendataset._utility.glob(pathname, *, recursive=False)[source]

Return a sorted list of paths matching a pathname pattern.

The pattern may contain simple shell-style wildcards a la fnmatch. However, unlike fnmatch, filenames starting with a dot are special cases that are not matched by ‘*’ and ‘?’ patterns.

Parameters
  • pathname (str) – The pathname pattern.

  • recursive (bool) – If recursive is true, the pattern ‘**’ will match any files and zero or more directories and subdirectories.

Returns

A sorted list of paths matching a pathname pattern.

Raises

NoFileError – When there is no file matching the given pathname pattern.

Return type

List[str]