CocoDetectionDatasetCV2
Python template · sinapsis_data_readers.templates.image_readers.coco_dataset_reader
Overview
Specific template for Coco Detection datasets This template reads the annotations for BoundingBoxes and Oriented BoundingBoxes and adds them to the ImagePackets
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis-data-readers==1.0.0uv pip install sinapsis-data-readers==1.0.0uv add sinapsis-data-readers==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
Optional
Default: "**/*"
root path to the data pattern (str) = "**/*": regex to be used with Path.glob. By default, we find recursively. batch_size (int) = 1: if batch size is set to a number >= len(self.data_collection), or batch_size ==-1,… Read full field description
root path to the data pattern (str) = "**/*": regex to be used with Path.glob. By default, we find recursively. batch_size (int) = 1: if batch size is set to a number >= len(self.data_collection), or batch_size ==-1, the entire set of data will be returned at once. shuffle_data (bool) = False: flag to indicate whether to shuffle the list of datafiles. samples_to_load (int) = -1: by default, load all the data unless samples_to_load is set to >= 0. If 0, the list of data files will be empty and no data will be loaded.
Required
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: 1
bool = False flag to indicate if data should be loaded in the __init__ or during execution. Note that for large data sets with large files, it is recommended to set this flag to false in order to avoid long initialization times of the template.
Optional
Default: false
Optional
Default: false
bool = False weather the data is a ground truth or not.
Optional
Default: false
Optional
Default: -1
Required
Default: null
int = -2 for datasets that rely on the dirname as the ground truth. The image file path will be split as 'data_label = data_file_path.ext.split(os.sep)[label_path_index]'.
Optional
Default: -2
Configuration example
Example from the Python docstring:
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: CocoDetectionDatasetCV2
class_name: CocoDetectionDatasetCV2
template_input: InputTemplate
attributes:
data_dir: '/path/to/data/dir'
pattern: '**/*'
batch_size: 1
shuffle_data: false
samples_to_load: -1
load_on_init: false
label_path_index: -2
is_ground_truth: false
annotations_path: '/path/to/annotations/file.json'Show schema-based configuration skeleton
templates:
- template_name: "CocoDetectionDatasetCV2"
class_name: "CocoDetectionDatasetCV2"
attributes:
pattern: "**/*"
data_dir: "<required>"
root_dir: null
batch_size: 1
load_on_init: false
shuffle_data: false
is_ground_truth: false
samples_to_load: -1
annotations_path: "<required>"
label_path_index: -2
Inheritance
sinapsis_data_readers.templates.image_readers.coco_dataset_reader.CocoImageDatasetBaseCV2Environment variables
Environment definitions belong to their canonical Python modules.