Skip to content

Commit 5203e3d

Browse files
committed
docs: introduce MosaicViews as dataset preview utils
1 parent cd5751f commit 5203e3d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

docs/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
4+
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
5+
ImageShow = "4e3cecfd-b093-5904-9786-8bbb286a6a31"

docs/src/index.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,22 @@ will trigger a download dialog to `~/.julia/datadeps/MNIST`. To
5555
overwrite this on a case by case basis, it is possible to specify
5656
a data directory directly in `traindata(dir = <directory>)` and
5757
`testdata(dir = <directory>)`.
58+
59+
## Preview
60+
61+
For image dataset, [`MosaicViews`](https://github.com/JuliaArrays/MosaicViews.jl) provides a very simple interface to display a list
62+
of images.
63+
64+
```@example
65+
using MLDatasets
66+
# Alternatively, you can also just call `using Images`
67+
using ImageCore, ImageShow
68+
69+
# The original dataset is stored in row-major order,
70+
# to display it normally in Julia, we need to permute the
71+
# first two dimensions.
72+
test_x = Gray.(PermutedDimsArray(MNIST.testtensor(), (2, 1, 3)));
73+
test_x_sample = @view test_x[:, :, 1:64];
74+
75+
mosaic(test_x_sample, nrow=8)
76+
```

0 commit comments

Comments
 (0)