|
12 | 12 | # See the License for the specific language governing permissions and
|
13 | 13 | # limitations under the License.
|
14 | 14 | """
|
15 |
| -CIFAR dataset: https://www.cs.toronto.edu/~kriz/cifar.html |
| 15 | +CIFAR dataset. |
| 16 | +
|
| 17 | +This module will download dataset from https://www.cs.toronto.edu/~kriz/cifar.html and |
| 18 | +parse train set and test set into paddle reader creators. |
| 19 | +
|
| 20 | +The CIFAR-10 dataset consists of 60000 32x32 colour images in 10 classes, with 6000 |
| 21 | +images per class. There are 50000 training images and 10000 test images. |
| 22 | +
|
| 23 | +The CIFAR-100 dataset is just like the CIFAR-10, except it has 100 classes containing |
| 24 | +600 images each. There are 500 training images and 100 testing images per class. |
16 | 25 |
|
17 |
| -TODO(yuyang18): Complete the comments. |
18 | 26 | """
|
19 | 27 |
|
20 | 28 | import cPickle
|
@@ -54,20 +62,56 @@ def reader():
|
54 | 62 |
|
55 | 63 |
|
56 | 64 | def train100():
|
| 65 | + """ |
| 66 | + CIFAR-100 train set creator. |
| 67 | +
|
| 68 | + It returns a reader creator, each sample in the reader is image pixels in |
| 69 | + [0, 1] and label in [0, 99]. |
| 70 | +
|
| 71 | + :return: Train reader creator |
| 72 | + :rtype: callable |
| 73 | + """ |
57 | 74 | return reader_creator(
|
58 | 75 | download(CIFAR100_URL, 'cifar', CIFAR100_MD5), 'train')
|
59 | 76 |
|
60 | 77 |
|
61 | 78 | def test100():
|
| 79 | + """ |
| 80 | + CIFAR-100 test set cretor. |
| 81 | +
|
| 82 | + It returns a reader creator, each sample in the reader is image pixels in |
| 83 | + [0, 1] and label in [0, 9]. |
| 84 | +
|
| 85 | + :return: Test reader creator. |
| 86 | + :rtype: callable |
| 87 | + """ |
62 | 88 | return reader_creator(download(CIFAR100_URL, 'cifar', CIFAR100_MD5), 'test')
|
63 | 89 |
|
64 | 90 |
|
65 | 91 | def train10():
|
| 92 | + """ |
| 93 | + CIFAR-10 train set creator. |
| 94 | +
|
| 95 | + It returns a reader creator, each sample in the reader is image pixels in |
| 96 | + [0, 1] and label in [0, 9]. |
| 97 | +
|
| 98 | + :return: Train reader creator |
| 99 | + :rtype: callable |
| 100 | + """ |
66 | 101 | return reader_creator(
|
67 | 102 | download(CIFAR10_URL, 'cifar', CIFAR10_MD5), 'data_batch')
|
68 | 103 |
|
69 | 104 |
|
70 | 105 | def test10():
|
| 106 | + """ |
| 107 | + CIFAR-10 test set cretor. |
| 108 | +
|
| 109 | + It returns a reader creator, each sample in the reader is image pixels in |
| 110 | + [0, 1] and label in [0, 9]. |
| 111 | +
|
| 112 | + :return: Test reader creator. |
| 113 | + :rtype: callable |
| 114 | + """ |
71 | 115 | return reader_creator(
|
72 | 116 | download(CIFAR10_URL, 'cifar', CIFAR10_MD5), 'test_batch')
|
73 | 117 |
|
|
0 commit comments