Base reader class#
Bases: ABC
This is the base class that other readers inherit from.
It enforces the use of the read()
method in all writers.
Source code in detection_datasets/readers/base.py
COCO reader#
Bases: BaseReader
Read a dataset from disk in the COCO format.
You don't need to use the reader directly, use the from_disk(dataset_format="coco", *args, **kwargs)
method
of the DetectionDataset class instead.
This is equivalent to first calling the reader, and then initializing the DetectionDataset instance
with the data returned by the reader.
Example
Source code in detection_datasets/readers/coco.py
__init__(path, splits)
#
Load a dataset from disk.
This is a factory method that can read the dataset from different formats, when the dataset is already in a local directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path to the dataset on the local filesystem. |
required |
splits |
Dict[str, Tuple[str, str]]
|
Dictionnary indicating how to read the data. - The key is the name of the split - The value is a tuple containing the name of the annotation file for this split, and the directory containing the images for this split. |
required |
Source code in detection_datasets/readers/coco.py
read()
#
Read the dataset from disk.
Returns:
Type | Description |
---|---|
pd.DataFrame()
|
DataFrame containing the data for all splits, with one row per annotation. |