torchsig.image_datasets.datasets.yolo_datasets.YOLOImageCompositeDatasetComponent

class torchsig.image_datasets.datasets.yolo_datasets.YOLOImageCompositeDatasetComponent(component_dataset, min_to_add=0, max_to_add=1, class_id=None, use_source_yolo_labels=False)[source]

Bases: Dataset

Defines a component of a composite dataset; this will contain any information the composites should use to place instances of this component in the composites, such as how many instances should be place Inputs:

component_dataset: a Dataset object which contains instances of this component, represented as (image_component: ndarray(c,height,width), class_id: int) min_to_add: the fewest instances of this component type to be placed in each composite max_to_add: the most instances of this type to be placed in each composite; the number of instances will be selected unifomly from min_to_add to max_to_add class_id: the int id to use for labeling data;

if provided, all returned data will be of the form (component_dataset[n], (class_id, 0.5, 0.5, 1.0, 1.0)) representing a single box taking up the full image component of class class_id

use_source_yolo_labels: if true, load YOLO labels from the component_dataset; otherwise component_dataset is assumed to return only image tensors;

If neither class_id nor use_source_yolo_labels is provided, all data will be assumed to have no labels, and (component_dataset[n], []) will be returned

Methods

get_components_to_add

next

__init__(component_dataset, min_to_add=0, max_to_add=1, class_id=None, use_source_yolo_labels=False)[source]