class documentation
class TorchImageClassificationDataset(Dataset): (source)
Constructor: TorchImageClassificationDataset(image_paths, targets, samples, sample_ids, ...)
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 | an iterable of image paths |
targets | an iterable of targets, or the name of a field or embedded field of samples to use as targets |
samples | a fiftyone.core.collections.SampleCollection
from which to extract image paths and targets |
sample | an iterable of sample IDs corresponding to each image |
include | whether to include the IDs of the samples in the returned items |
transform | an optional transform function to apply to each image patch. When use_numpy == False, this is typically a torchvision transform |
use | whether to use numpy arrays rather than PIL images and Torch tensors when loading data |
force | whether to force convert the images to RGB |
skip | whether 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 |
Undocumented |
Instance Variable | image |
Undocumented |
Instance Variable | sample |
Undocumented |
Instance Variable | skip |
Undocumented |
Instance Variable | targets |
Undocumented |
Instance Variable | transform |
Undocumented |
Instance Variable | use |
Undocumented |
Property | has |
Whether this dataset has sample IDs. |
Method | _parse |
Undocumented |
Instance Variable | _str |
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