Skip to content

Instantly share code, notes, and snippets.

View Niloofar-bgh's full-sized avatar

Niloofar Baghdadi Niloofar-bgh

View GitHub Profile
@Niloofar-bgh
Niloofar-bgh / pytorch_image_folder_with_file_paths.py
Created July 9, 2019 16:47 — forked from andrewjong/pytorch_image_folder_with_file_paths.py
PyTorch Image File Paths With Dataset Dataloader
import torch
from torchvision import datasets
class ImageFolderWithPaths(datasets.ImageFolder):
"""Custom dataset that includes image file paths. Extends
torchvision.datasets.ImageFolder
"""
# override the __getitem__ method. this is the method that dataloader calls
def __getitem__(self, index):