alexey-zhavoronkin commited on
Commit
a2be8e4
1 Parent(s): 9a36bfc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -3
README.md CHANGED
@@ -7,9 +7,41 @@ size_categories:
7
 
8
  [CINIC10](https://github.com/BayesWatch/cinic-10) dataset with interface of [CIFAR10](https://github.com/pytorch/vision/blob/main/torchvision/datasets/cifar.py).
9
 
10
- **CINIC10**
11
 
12
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6603fa9907e0b8a75b819c61/LcEiSYmYFtC3D2wpG2uuB.png)
13
 
14
 
15
- It is faster than the common CINIC10 due to the fact that all images are loaded into RAM while initing dataset instance.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  [CINIC10](https://github.com/BayesWatch/cinic-10) dataset with interface of [CIFAR10](https://github.com/pytorch/vision/blob/main/torchvision/datasets/cifar.py).
9
 
10
+ It is faster than the common CINIC10 due to the fact that all images are loaded into RAM while initing dataset instance.
11
 
 
12
 
13
 
14
+ The simplest way to use CINIC-10 is with a PyTorch data loader, as follows:
15
+
16
+ ```
17
+ import torchvision
18
+ import torch
19
+ from torchvision transforms
20
+ from cinic10 import CINIC10
21
+
22
+ transform_train = transforms.Compose([
23
+ transforms.RandomCrop(32, padding=4),
24
+ transforms.Resize(32),
25
+ transforms.RandomHorizontalFlip(),
26
+ transforms.ToTensor(),
27
+ transforms.Normalize(data_mean, data_std),
28
+ ])
29
+
30
+ transform_test = transforms.Compose([
31
+ transforms.Resize(32),
32
+ transforms.ToTensor(),
33
+ transforms.Normalize(data_mean, data_std),
34
+ ])
35
+
36
+ batch_size = 64
37
+ num_workers = 4
38
+
39
+ trainset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=transform_train)
40
+ trainloader = torch.utils.data.DataLoader(trainset, batch_size=batch_size, shuffle=True, num_workers=num_workers)
41
+
42
+ testset = torchvision.datasets.CIFAR10(root='./data', train=False, download=True, transform=transform_test)
43
+ testloader = torch.utils.data.DataLoader(testset, batch_size=batch_size, shuffle=False, num_workers=num_workers)
44
+
45
+ ```
46
+
47
+