Skip to content

Instantly share code, notes, and snippets.

@udithhaputhanthri
Created March 26, 2021 08:21
Show Gist options
  • Save udithhaputhanthri/bdab0c74aa8d5a38b45c141d3401cad7 to your computer and use it in GitHub Desktop.
Save udithhaputhanthri/bdab0c74aa8d5a38b45c141d3401cad7 to your computer and use it in GitHub Desktop.
WGAN_scripts
import zipfile
import os
if not os.path.isfile('celeba.zip'):
!mkdir data_faces && wget https://s3-us-west-1.amazonaws.com/udacity-dlnfd/datasets/celeba.zip
with zipfile.ZipFile("celeba.zip","r") as zip_ref:
zip_ref.extractall("data_faces/")
from torch.utils.data import DataLoader
transform = transforms.Compose([
transforms.Resize((img_size,img_size)),
transforms.ToTensor(),
transforms.Normalize((0.5,0.5, 0.5),(0.5, 0.5, 0.5))])
dataset = datasets.ImageFolder('data_faces', transform=transform)
data_loader = DataLoader(dataset,batch_size=batch_size,shuffle=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment