Skip to content

Instantly share code, notes, and snippets.

View sharma0611's full-sized avatar
💭
Feeling curious 🤔

Shivam Sharma sharma0611

💭
Feeling curious 🤔
View GitHub Profile
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import torchvision
from modules.cifar10 import data_loader
import matplotlib.pyplot as plt
# modules.utils.py
class DeNormalize(object):
def __init__(self, mean, std):
self.mean = mean
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import os
import torch
def normalize_transform():
return transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
def train_dataset(data_dir):
@sharma0611
sharma0611 / imagenet.sh
Last active February 3, 2022 11:32
ImageNet Preparation
#!/bin/bash
mkdir train && mv ILSVRC2012_img_train.tar train/ && cd train
tar -xvf ILSVRC2012_img_train.tar && rm -f ILSVRC2012_img_train.tar
find . -name "*.tar" | while read NAME ; do mkdir -p "${NAME%.tar}"; tar -xvf "${NAME}" -C "${NAME%.tar}"; rm -f "${NAME}"; done
cd ..
# Extract the validation data and move images to subfolders:
mkdir val && mv ILSVRC2012_img_val.tar val/ && cd val && tar -xvf ILSVRC2012_img_val.tar
wget -qO- <https://raw.githubusercontent.com/soumith/imagenetloader.torch/master/valprep.sh> | bash