Docs /Templates/ sinapsis-data-readers

CocoKeypointsDatasetCV2

sinapsis-data-readerscommunitycocokeypointsimagedetection

Python template · sinapsis_data_readers.templates.image_readers.coco_dataset_reader

Overview

Specific template for Coco Keypoints datasets This template reads the annotations for BoundingBoxes, Oriented BoundingBoxes and Keypoints and adds them to the ImagePackets

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-data-readers==1.0.0
uv pip install sinapsis-data-readers==1.0.0
uv add sinapsis-data-readers==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

pattern
str
Optional
Default: "**/*"
data_dirRequired
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.

str
Required
Default: null
metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
root_dir
str | None
Optional
Default: null
batch_size
int
Optional
Default: 1
load_on_init

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.

bool
Optional
Default: false
shuffle_data
bool
Optional
Default: false
is_ground_truth

bool = False weather the data is a ground truth or not.

bool
Optional
Default: false
samples_to_load
int
Optional
Default: -1
annotations_pathRequired
str
Required
Default: null
label_path_index

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]'.

int
Optional
Default: -2

Configuration example

Example from the Python docstring:

yaml
agent:
      name: my_test_agent
    templates:
    - template_name: InputTemplate
      class_name: InputTemplate
      attributes: {}
    - template_name: CocoKeypointsDatasetCV2
      class_name: CocoKeypointsDatasetCV2
      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
yaml
templates:
  - template_name: "CocoKeypointsDatasetCV2"
    class_name: "CocoKeypointsDatasetCV2"
    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

Immediate parent: sinapsis_data_readers.templates.image_readers.coco_dataset_reader.CocoDetectionDatasetCV2

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_CACHE_DIR · defined elsewhere