PytorchWildlife.data

The PytorchWildlife.data module includes the available datasets and transformations. These classes are documented in more detail in Datasets and Transforms.

Datasets

class PytorchWildlife.data.datasets.DetectionImageFolder(image_dir, transform=None)[source]

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.

Transforms

class PytorchWildlife.data.transforms.Classification_Inference_Transform(target_size=224)[source]

Bases: object

A transformation class to preprocess images for classification inference. This includes resizing, normalization, and conversion to a tensor.

mean = [0.485, 0.456, 0.406]
std = [0.229, 0.224, 0.225]
class PytorchWildlife.data.transforms.MegaDetector_v5_Transform(target_size=1280, stride=32)[source]

Bases: object

A transformation class to preprocess images for the MegaDetector v5 model. This includes resizing, transposing, and normalization operations. This is a required transformation for the YoloV5 model.