Skip to content

Instantly share code, notes, and snippets.

@tcrapse
tcrapse / pytorch_image_folder_with_file_paths.py
Created May 20, 2019 22:26 — 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 dataloader calls
def __getitem__(self, index):
@tcrapse
tcrapse / dae_pytorch_cuda.py
Created March 20, 2019 23:22 — forked from bigsnarfdude/dae_pytorch_cuda.py
denoising autoencoder pytorch cuda
import os
import torch
from torch import nn
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datasets import MNIST
from torchvision.utils import save_image