FolderImageDatasetCV2
Python template · sinapsis_data_readers.templates.image_readers.image_folder_reader_cv2
Overview
Dataset creation for images in a directory in the disk with opencv
Methods: - _create_data_entries : Creates the data entries based in the path and name of the image.
- _read_entry : Reads the content of the folder defined in the data directory and returns the content.
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
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: FolderImageDatasetCV2
class_name: FolderImageDatasetCV2
template_input: InputTemplate
attributes:
data_dir: '/path/to/data/dit'
pattern: '**/*'
batch_size: 1
shuffle_data: false
samples_to_load: -1
load_on_init: false
label_path_index: -2
is_ground_truth: falseShow schema-based configuration skeleton
templates:
- template_name: "FolderImageDatasetCV2"
class_name: "FolderImageDatasetCV2"
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
label_path_index: -2
Inheritance
sinapsis_data_readers.templates.image_readers.base_image_folder_data_loader.ImageBaseDataReaderEnvironment variables
Environment definitions belong to their canonical Python modules.
No directly related environment variables listed.