Skip to content

Commit d5b0038

Browse files
authored
fix coco doc
1 parent d290165 commit d5b0038

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ pip install .
2323

2424
# Datasets
2525

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+
2633
Datasets have the API:
2734
- `__getitem__`
2835
- `__len__`
@@ -39,13 +46,6 @@ In the constructor, each dataset has a slightly different API as needed, but the
3946
- common stuff like `ToTensor`, `RandomCrop`, etc. These can be composed together with `transforms.Compose` (see transforms section below)
4047
- `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.
4148

42-
The following datasets are available:
43-
44-
- COCO (Captioning and Detection)
45-
- LSUN Classification
46-
- Imagenet-12
47-
- ImageFolder
48-
4949
### COCO
5050

5151
This requires the [COCO API to be installed](https://github.com/pdollar/coco/tree/master/PythonAPI)
@@ -59,7 +59,7 @@ Example:
5959
```python
6060
import torchvision.datasets as dset
6161
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())
6363

6464
print('Number of samples:', len(cap))
6565
img, target = cap[3] # load 4th sample
@@ -71,6 +71,9 @@ print(target)
7171
Output:
7272

7373
```
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']
7477
```
7578

7679
#### Detection:
@@ -113,7 +116,12 @@ It has the members:
113116

114117
### Imagenet-12
115118

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).
124+
117125

118126
# Transforms
119127

0 commit comments

Comments
 (0)