Skip to content

Instantly share code, notes, and snippets.

@epistoteles
Last active May 31, 2023 11:09
Show Gist options
  • Save epistoteles/c35bd5154a036748651d8caca11a7efe to your computer and use it in GitHub Desktop.
Save epistoteles/c35bd5154a036748651d8caca11a7efe to your computer and use it in GitHub Desktop.
import numpy as np
from torchvision.datasets import CIFAR10
dataset = CIFAR10('.', train=True, download=True)
x = np.concatenate([np.asarray(dataset[i][0]) for i in range(len(dataset))])
cifar10_mean = np.mean(x, axis=(0, 1))
cifar10_std = np.std(x, axis=(0, 1))
print(cifar10_mean)
print(cifar10_std)
# [125.30691805 122.95039414 113.86538318]
# [62.99321928 62.08870764 66.70489964]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment