Skip to content

Commit cd83d1d

Browse files
Merge pull request #35 from JuliaML/permute
change SVHN2 to WH format + other fixes
2 parents 09a0cc5 + 213fa68 commit cd83d1d

29 files changed

+199
-649
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
language: julia
2+
23
os:
34
- linux
45
- osx
6+
- windows
7+
58
julia:
69
- 1.0
7-
- 1.3
10+
- 1
811
- nightly
12+
913
notifications:
1014
email: false
15+
1116
git:
1217
depth: 99999999
1318

@@ -32,4 +37,4 @@ jobs:
3237
after_success: skip
3338

3439
after_success:
35-
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())'
40+
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())'

Project.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "MLDatasets"
22
uuid = "eb30cadb-4394-5ae3-aed4-317e484a6458"
3-
version = "0.4.1"
3+
version = "0.5.0"
44

55
[deps]
66
BinDeps = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
@@ -9,22 +9,23 @@ DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe"
99
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
1010
FixedPointNumbers = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
1111
GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63"
12+
MAT = "23992714-dd62-5051-b70f-ba57cb901cac"
1213
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1314

1415
[compat]
15-
ColorTypes = "0.4, 0.5, 0.6, 0.7, 0.8, 0.9"
16+
BinDeps = "1"
17+
ColorTypes = "0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10"
1618
DataDeps = "0.3, 0.4, 0.5, 0.6, 0.7"
1719
FixedPointNumbers = "0.3, 0.4, 0.5, 0.6, 0.7, 0.8"
18-
ImageCore = "0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8"
1920
GZip = "0.5"
21+
ImageCore = "0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8"
22+
MAT = "0.7"
2023
Requires = "1"
21-
BinDeps = "1"
2224
julia = "1"
2325

2426
[extras]
2527
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
26-
MAT = "23992714-dd62-5051-b70f-ba57cb901cac"
2728
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2829

2930
[targets]
30-
test = ["Test", "MAT", "ImageCore"]
31+
test = ["Test", "ImageCore"]

docs/src/datasets/CIFAR10.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,8 @@ the CIFAR-10 dataset in Julia more convenient.
5656

5757
Function | Description
5858
---------|-------------
59-
[`convert2features(array)`](@ref CIFAR10.convert2features) | Convert the CIFAR-10 tensor to a flat feature matrix
6059
[`convert2image(array)`](@ref CIFAR10.convert2image) | Convert the CIFAR-10 tensor/matrix to a colorant array
6160

62-
You can use the function
63-
[`convert2features`](@ref CIFAR10.convert2features) to convert
64-
the given CIFAR-10 tensor to a feature matrix (or feature vector
65-
in the case of a single image). The purpose of this function is
66-
to drop the spatial dimensions such that traditional ML
67-
algorithms can process the dataset.
68-
69-
```julia
70-
julia> CIFAR10.convert2features(CIFAR10.traintensor()) # full training data
71-
3072×50000 Array{N0f8,2}:
72-
[...]
73-
```
7461

7562
To visualize an image or a prediction we provide the function
7663
[`convert2image`](@ref CIFAR10.convert2image) to convert the
@@ -106,7 +93,6 @@ CIFAR10.testdata
10693
```@docs
10794
CIFAR10.download
10895
CIFAR10.classnames
109-
CIFAR10.convert2features
11096
CIFAR10.convert2image
11197
```
11298

docs/src/datasets/CIFAR100.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,8 @@ the CIFAR-100 dataset in Julia more convenient.
6060

6161
Function | Description
6262
---------|-------------
63-
[`convert2features(array)`](@ref CIFAR10.convert2features) | Convert the CIFAR-100 tensor to a flat feature matrix
6463
[`convert2image(array)`](@ref CIFAR10.convert2image) | Convert the CIFAR-100 tensor/matrix to a colorant array
6564

66-
You can use the function
67-
[`convert2features`](@ref CIFAR10.convert2features) to convert
68-
the given CIFAR-100 tensor to a feature matrix (or feature vector
69-
in the case of a single image). The purpose of this function is
70-
to drop the spatial dimensions such that traditional ML
71-
algorithms can process the dataset.
72-
73-
```julia
74-
julia> CIFAR100.convert2features(CIFAR100.traintensor()) # full training data
75-
3072×50000 Array{N0f8,2}:
76-
[...]
77-
```
7865

7966
To visualize an image or a prediction we provide the function
8067
[`convert2image`](@ref CIFAR10.convert2image) to convert the
@@ -107,15 +94,15 @@ CIFAR100.testdata
10794

10895
### Utilities
10996

110-
See [`CIFAR10.convert2features`](@ref) and
111-
[`CIFAR10.convert2image`](@ref)
11297

11398
```@docs
11499
CIFAR100.download
115100
CIFAR100.classnames_coarse
116101
CIFAR100.classnames_fine
117102
```
118103

104+
See also [`CIFAR10.convert2image`](@ref).
105+
119106
## References
120107

121108
- **Authors**: Alex Krizhevsky, Vinod Nair, Geoffrey Hinton

docs/src/datasets/FashionMNIST.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,8 @@ the Fashion-MNIST dataset in Julia more convenient.
5656

5757
Function | Description
5858
---------|-------------
59-
[`convert2features(array)`](@ref MNIST.convert2features) | Convert the Fashion-MNIST tensor to a flat feature matrix
6059
[`convert2image(array)`](@ref MNIST.convert2image) | Convert the Fashion-MNIST tensor/matrix to a colorant array
6160

62-
You can use the function
63-
[`convert2features`](@ref MNIST.convert2features) to
64-
convert the given Fashion-MNIST tensor to a feature matrix (or
65-
feature vector in the case of a single image). The purpose of
66-
this function is to drop the spatial dimensions such that
67-
traditional ML algorithms can process the dataset.
68-
69-
```julia
70-
julia> FashionMNIST.convert2features(FashionMNIST.traintensor()) # full training data
71-
784×60000 Array{N0f8,2}:
72-
[...]
73-
```
74-
7561
To visualize an image or a prediction we provide the function
7662
[`convert2image`](@ref MNIST.convert2image) to convert the
7763
given Fashion-MNIST horizontal-major tensor (or feature matrix)
@@ -114,8 +100,7 @@ FashionMNIST.download
114100
FashionMNIST.classnames
115101
```
116102

117-
Also, the `FashionMNIST` module is re-exporting [`convert2features`](@ref MNIST.convert2features)
118-
and [`convert2image`](@ref MNIST.convert2image) from the [`MNIST`](@ref) module.
103+
Also, the `FashionMNIST` module is re-exporting [`convert2image`](@ref MNIST.convert2image) from the [`MNIST`](@ref) module.
119104

120105
## References
121106

docs/src/datasets/MNIST.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,8 @@ the MNIST dataset in Julia more convenient.
5656

5757
Function | Description
5858
---------|-------------
59-
[`convert2features(array)`](@ref MNIST.convert2features) | Convert the MNIST tensor to a flat feature matrix
6059
[`convert2image(array)`](@ref MNIST.convert2image) | Convert the MNIST tensor/matrix to a colorant array
6160

62-
You can use the function [`convert2features`](@ref
63-
MNIST.convert2features) to convert the given MNIST tensor to a
64-
feature matrix (or feature vector in the case of a single image).
65-
The purpose of this function is to drop the spatial dimensions
66-
such that traditional ML algorithms can process the dataset.
67-
68-
```julia
69-
julia> MNIST.convert2features(MNIST.traintensor()) # full training data
70-
784×60000 Array{N0f8,2}:
71-
[...]
72-
```
73-
7461
To visualize an image or a prediction we provide the function
7562
[`convert2image`](@ref MNIST.convert2image) to convert the given
7663
MNIST horizontal-major tensor (or feature matrix) to a
@@ -110,7 +97,6 @@ MNIST.testdata
11097

11198
```@docs
11299
MNIST.download
113-
MNIST.convert2features
114100
MNIST.convert2image
115101
```
116102

docs/src/datasets/SVHN2.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,8 @@ the SVHN (format 2) dataset in Julia more convenient.
7777

7878
Function | Description
7979
---------|-------------
80-
[`convert2features(array)`](@ref SVHN2.convert2features) | Convert the SVHN tensor to a flat feature matrix
8180
[`convert2image(array)`](@ref SVHN2.convert2image) | Convert the SVHN tensor/matrix to a colorant array
8281

83-
You can use the function
84-
[`convert2features`](@ref SVHN2.convert2features) to convert
85-
the given SVHN tensor to a feature matrix (or feature vector
86-
in the case of a single image). The purpose of this function is
87-
to drop the spatial dimensions such that traditional ML
88-
algorithms can process the dataset.
89-
90-
```julia
91-
julia> SVHN2.convert2features(SVHN2.traindata()[1]) # full training data
92-
3072×73257 Array{N0f8,2}:
93-
[...]
94-
```
95-
9682
To visualize an image or a prediction we provide the function
9783
[`convert2image`](@ref SVHN2.convert2image) to convert the
9884
given SVHN2 horizontal-major tensor (or feature matrix) to a
@@ -139,7 +125,6 @@ SVHN2.extradata
139125
```@docs
140126
SVHN2.download
141127
SVHN2.classnames
142-
SVHN2.convert2features
143128
SVHN2.convert2image
144129
```
145130

src/CIFAR10/CIFAR10.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ module CIFAR10
2121
testdata,
2222

2323
convert2image,
24-
convert2features,
2524

2625
download
2726

27+
@deprecate convert2features reshape
28+
2829
const DEPNAME = "CIFAR10"
2930
const NCHUNKS = 5
3031

src/CIFAR10/interface.jl

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,16 @@ given `indices` as a multi-dimensional array of eltype `T`. If
1313
the corresponding labels are required as well, it is recommended
1414
to use [`CIFAR10.traindata`](@ref) instead.
1515
16-
The image(s) is/are returned in the native horizontal-major
16+
The image(s) is/are returned in the horizontal-major
1717
memory layout as a single numeric array. If `T <: Integer`, then
1818
all values will be within `0` and `255`, otherwise the values are
1919
scaled to be between `0` and `1`.
2020
2121
If the parameter `indices` is omitted or an `AbstractVector`, the
22-
images are returned as a 4D array (i.e. a `Array{T,4}`), in which
23-
the first dimension corresponds to the pixel *rows* (x) of the
24-
image, the second dimension to the pixel *columns* (y) of the
25-
image, the third dimension the RGB color channels, and the fourth
26-
dimension denotes the index of the image.
22+
images are returned as a 4D array (i.e. a `Array{T,4}`) in
23+
WHCN format (width, height, #channels, #images).
24+
For integer `indices` instead, a 3D array in WHC format is returned.
25+
2726
2827
```julia-repl
2928
julia> CIFAR10.traintensor() # load all training images
@@ -35,23 +34,18 @@ julia> CIFAR10.traintensor(Float32, 1:3) # first three images as Float32
3534
[...]
3635
```
3736
38-
If `indices` is an `Integer`, the single image is returned as
39-
`Array{T,3}` in horizontal-major layout, which means that the
40-
first dimension denotes the pixel *rows* (x), the second
41-
dimension denotes the pixel *columns* (y), and the third
42-
dimension the RGB color channels of the image.
37+
If `indices` is an `Integer`, a single image is returned as
38+
`Array{T,3}` array.
4339
4440
```julia-repl
4541
julia> CIFAR10.traintensor(1) # load first training image
4642
32×32×3 Array{N0f8,3}:
4743
[...]
4844
```
4945
50-
As mentioned above, the images are returned in the native
51-
horizontal-major layout to preserve the original feature
52-
ordering. You can use the utility function
46+
You can use the utility function
5347
[`convert2image`](@ref) to convert an CIFAR-10 array into a
54-
vertical-major Julia image with the appropriate `RGB` eltype.
48+
horizontal-major Julia image with the appropriate `RGB` eltype.
5549
5650
```julia-repl
5751
julia> CIFAR10.convert2image(CIFAR10.traintensor(1)) # convert to column-major colorant array
@@ -78,17 +72,15 @@ Return the CIFAR-10 **test** images corresponding to the given
7872
corresponding labels are required as well, it is recommended to
7973
use [`CIFAR10.testdata`](@ref) instead.
8074
81-
The image(s) is/are returned in the native horizontal-major
75+
Images are returned in horizontal-major
8276
memory layout as a single numeric array. If `T <: Integer`, then
8377
all values will be within `0` and `255`, otherwise the values are
8478
scaled to be between `0` and `1`.
8579
8680
If the parameter `indices` is omitted or an `AbstractVector`, the
87-
images are returned as a 4D array (i.e. a `Array{T,4}`), in which
88-
the first dimension corresponds to the pixel *rows* (x) of the
89-
image, the second dimension to the pixel *columns* (y) of the
90-
image, the third dimension the RGB color channels, and the fourth
91-
dimension denotes the index of the image.
81+
images are returned as a 4D array (i.e. a `Array{T,4}`) in
82+
WHCN format (width, height, #channels, #images).
83+
For integer `indices` instead, a 3D array in WHC format is returned.
9284
9385
```julia-repl
9486
julia> CIFAR10.testtensor() # load all training images
@@ -100,23 +92,18 @@ julia> CIFAR10.testtensor(Float32, 1:3) # first three images as Float32
10092
[...]
10193
```
10294
103-
If `indices` is an `Integer`, the single image is returned as
104-
`Array{T,3}` in horizontal-major layout, which means that the
105-
first dimension denotes the pixel *rows* (x), the second
106-
dimension denotes the pixel *columns* (y), and the third
107-
dimension the RGB color channels of the image.
95+
If `indices` is an `Integer`, a single image is returned as
96+
`Array{T,3}`.
10897
10998
```julia-repl
11099
julia> CIFAR10.testtensor(1) # load first training image
111100
32×32×3 Array{N0f8,3}:
112101
[...]
113102
```
114103
115-
As mentioned above, the images are returned in the native
116-
horizontal-major layout to preserve the original feature
117-
ordering. You can use the utility function
104+
You can use the utility function
118105
[`convert2image`](@ref) to convert an CIFAR-10 array into a
119-
vertical-major Julia image with the appropriate `RGB` eltype.
106+
horizontal-major HW Julia image with the appropriate `RGB` eltype.
120107
121108
```julia-repl
122109
julia> CIFAR10.convert2image(CIFAR10.testtensor(1)) # convert to column-major colorant array
@@ -217,7 +204,7 @@ full trainingset is returned. The first element of the return
217204
values will be the images as a multi-dimensional array, and the
218205
second element the corresponding labels as integers.
219206
220-
The image(s) is/are returned in the native horizontal-major
207+
The image(s) is/are returned in horizontal-major
221208
memory layout as a single numeric array of eltype `T`. If `T <:
222209
Integer`, then all values will be within `0` and `255`, otherwise
223210
the values are scaled to be between `0` and `1`. The integer
@@ -322,7 +309,7 @@ full testset is returned. The first element of the return
322309
values will be the images as a multi-dimensional array, and the
323310
second element the corresponding labels as integers.
324311
325-
The image(s) is/are returned in the native horizontal-major
312+
The image(s) is/are returned in the horizontal-major
326313
memory layout as a single numeric array of eltype `T`. If `T <:
327314
Integer`, then all values will be within `0` and `255`, otherwise
328315
the values are scaled to be between `0` and `1`. The integer

0 commit comments

Comments
 (0)