CocoDataset#

class CocoDataset[source]#

Bases: Dataset

Read Object Detection data in the COCO format.

__init__(img_dir: str, annotation_uri: str)[source]#

Constructor.

Parameters
  • img_dir (str) – Directory containing the images. Image filenames must match the image IDs in the annotations file.

  • annotation_uri (str) – URI to a JSON file containing annotations in the COCO format.

Methods

__init__(img_dir, annotation_uri)

Constructor.

__add__(other: Dataset[_T_co]) ConcatDataset[_T_co]#
Parameters

other (Dataset[_T_co]) –

Return type

ConcatDataset[_T_co]

__getitem__(ind: int) tuple[numpy.ndarray, tuple[numpy.ndarray, numpy.ndarray, str]][source]#
Parameters

ind (int) –

Return type

tuple[numpy.ndarray, tuple[numpy.ndarray, numpy.ndarray, str]]

__init__(img_dir: str, annotation_uri: str)[source]#

Constructor.

Parameters
  • img_dir (str) – Directory containing the images. Image filenames must match the image IDs in the annotations file.

  • annotation_uri (str) – URI to a JSON file containing annotations in the COCO format.