Datasets Module¶
ClassificationImageFolder
¶
Bases: ImageFolder
A PyTorch Dataset for loading images from a specified directory. Each item in the dataset is a tuple containing the image data, the image's path, and the original size of the image.
Source code in PytorchWildlife/data/datasets.py
__getitem__(idx)
¶
Retrieves an image from the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index of the image to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
tuple
|
Contains the image data, the image's path, and its original size. |
Source code in PytorchWildlife/data/datasets.py
__init__(image_dir, transform=None)
¶
Initializes the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_dir
|
str
|
Path to the directory containing the images. |
required |
transform
|
callable
|
Optional transform to be applied on the image. |
None
|
Source code in PytorchWildlife/data/datasets.py
DetectionCrops
¶
Bases: Dataset
Source code in PytorchWildlife/data/datasets.py
__getitem__(idx)
¶
Retrieves an image from the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index of the image to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
tuple
|
Contains the image data and the image's path. |
Source code in PytorchWildlife/data/datasets.py
DetectionImageFolder
¶
Bases: ImageFolder
A PyTorch Dataset for loading images from a specified directory. Each item in the dataset is a tuple containing the image data, the image's path, and the original size of the image.
Source code in PytorchWildlife/data/datasets.py
__getitem__(idx)
¶
Retrieves an image from the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index of the image to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
tuple
|
Contains the image data, the image's path, and its original size. |
Source code in PytorchWildlife/data/datasets.py
__init__(image_dir, transform=None)
¶
Initializes the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_dir
|
str
|
Path to the directory containing the images. |
required |
transform
|
callable
|
Optional transform to be applied on the image. |
None
|
Source code in PytorchWildlife/data/datasets.py
ImageFolder
¶
Bases: Dataset
A PyTorch Dataset for loading images from a specified directory. Each item in the dataset is a tuple containing the image data, the image's path, and the original size of the image.
Source code in PytorchWildlife/data/datasets.py
__getitem__(idx)
¶
Retrieves an image from the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index of the image to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
tuple
|
Contains the image data, the image's path, and its original size. |
Source code in PytorchWildlife/data/datasets.py
__init__(image_dir, transform=None)
¶
Initializes the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_dir
|
str
|
Path to the directory containing the images. |
required |
transform
|
callable
|
Optional transform to be applied on the image. |
None
|
Source code in PytorchWildlife/data/datasets.py
__len__()
¶
Returns the total number of images in the dataset.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Total number of images. |
has_file_allowed_extension(filename, extensions)
¶
Checks if a file is an allowed extension.