class documentation

A torch:torch.utils.data.Dataset for image classification.

Instances of this dataset emit images and their associated targets for each sample, either directly as (img, target) pairs or as (img, target, sample_id) pairs if sample_ids are provided or include_ids == True.

By default, this class will load images in PIL format and emit Torch tensors, but you can use numpy images/tensors instead by passing use_numpy = True.

Parameters
image_pathsan iterable of image paths
targetsan iterable of targets, or the name of a field or embedded field of samples to use as targets
samplesa fiftyone.core.collections.SampleCollection from which to extract image paths and targets
sample_idsan iterable of sample IDs corresponding to each image
include_idswhether to include the IDs of the samples in the returned items
transforman optional transform function to apply to each image patch. When use_numpy == False, this is typically a torchvision transform
use_numpywhether to use numpy arrays rather than PIL images and Torch tensors when loading data
force_rgbwhether to force convert the images to RGB
skip_failureswhether to return an Exception object rather than raising it if an error occurs while loading a sample
Method __getitem__ Undocumented
Method __init__ Undocumented
Method __len__ Undocumented
Instance Variable force_rgb Undocumented
Instance Variable image_paths Undocumented
Instance Variable sample_ids Undocumented
Instance Variable skip_failures Undocumented
Instance Variable targets Undocumented
Instance Variable transform Undocumented
Instance Variable use_numpy Undocumented
Property has_sample_ids Whether this dataset has sample IDs.
Method _parse_inputs Undocumented
Instance Variable _str_targets Undocumented
def __getitem__(self, idx): (source)

Undocumented

def __init__(self, image_paths=None, targets=None, samples=None, sample_ids=None, include_ids=False, transform=None, use_numpy=False, force_rgb=False, skip_failures=False): (source)

Undocumented

def __len__(self): (source)

Undocumented

force_rgb: False = (source)

Undocumented

image_paths: None = (source)

Undocumented

sample_ids: None = (source)

Undocumented

skip_failures: False = (source)

Undocumented

Undocumented

transform: None = (source)

Undocumented

use_numpy: False = (source)

Undocumented

@property
has_sample_ids = (source)

Whether this dataset has sample IDs.

def _parse_inputs(self, image_paths=None, targets=None, samples=None, sample_ids=None, include_ids=False): (source)

Undocumented

_str_targets = (source)

Undocumented