You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,13 @@ pip install .
23
23
24
24
# Datasets
25
25
26
+
The following dataset loaders are available:
27
+
28
+
-[COCO (Captioning and Detection)](#coco)
29
+
-[LSUN Classification](#lsun)
30
+
-[ImageFolder](#imagefolder)
31
+
-[Imagenet-12](#imagenet-12)
32
+
26
33
Datasets have the API:
27
34
-`__getitem__`
28
35
-`__len__`
@@ -39,13 +46,6 @@ In the constructor, each dataset has a slightly different API as needed, but the
39
46
- common stuff like `ToTensor`, `RandomCrop`, etc. These can be composed together with `transforms.Compose` (see transforms section below)
40
47
-`target_transform` - a function that takes in the target and transforms it. For example, take in the caption string and return a tensor of word indices.
41
48
42
-
The following datasets are available:
43
-
44
-
- COCO (Captioning and Detection)
45
-
- LSUN Classification
46
-
- Imagenet-12
47
-
- ImageFolder
48
-
49
49
### COCO
50
50
51
51
This requires the [COCO API to be installed](https://github.com/pdollar/coco/tree/master/PythonAPI)
@@ -59,7 +59,7 @@ Example:
59
59
```python
60
60
import torchvision.datasets as dset
61
61
import torchvision.transforms as transforms
62
-
cap = dset.CocoCaptions(root='dir where images are', annFile='json annotation file', transform=transforms.toTensor)
62
+
cap = dset.CocoCaptions(root='dir where images are', annFile='json annotation file', transform=transforms.ToTensor())
63
63
64
64
print('Number of samples:', len(cap))
65
65
img, target = cap[3] # load 4th sample
@@ -71,6 +71,9 @@ print(target)
71
71
Output:
72
72
73
73
```
74
+
('Number of samples:', 82783)
75
+
(3L, 427L, 640L)
76
+
[u'A plane emitting smoke stream flying over a mountain.', u'A plane darts across a bright blue sky behind a mountain covered in snow', u'A plane leaves a contrail above the snowy mountain top.', u'A mountain that has a plane flying overheard in the distance.', u'A mountain view with a plume of smoke in the background']
74
77
```
75
78
76
79
#### Detection:
@@ -113,7 +116,12 @@ It has the members:
113
116
114
117
### Imagenet-12
115
118
116
-
This is simply implemented with an ImageFolder dataset, after the data is preprocessed [as described here](https://github.com/facebook/fb.resnet.torch/blob/master/INSTALL.md#download-the-imagenet-dataset)
119
+
This is simply implemented with an ImageFolder dataset.
120
+
121
+
The data is preprocessed [as described here](https://github.com/facebook/fb.resnet.torch/blob/master/INSTALL.md#download-the-imagenet-dataset)
122
+
123
+
[Here is an example](https://github.com/pytorch/examples/blob/27e2a46c1d1505324032b1d94fc6ce24d5b67e97/imagenet/main.py#L48-L62).
0 commit comments