tensorbay.opendataset._utility

OpenDataset utility code.

tensorbay.opendataset._utility.coco(path: str) tensorbay.opendataset._utility.coco.COCO[source]

Parse the coco-like label files.

Parameters

path – 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
======================  =============  ==========================

tensorbay.opendataset._utility.glob(pathname: str, *, recursive: bool = False) List[str][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 – The pathname pattern.

  • recursive – 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.