|
1 |
| -# AxonDatasets |
| 1 | +# Axon Datasets |
2 | 2 |
|
3 |
| -## Usage |
4 |
| - |
5 |
| -We currently support MNIST, FashionMNIST, and CIFAR10 training datasets. |
6 |
| - |
7 |
| -Download or fetch datasets locally: |
8 |
| - |
9 |
| -```elixir |
10 |
| -{train_images, train_labels} = AxonDatasets.MNIST.download() |
11 |
| - |
12 |
| -# Unpack train_images like... |
13 |
| -{images_binary, tensor_type, shape} = train_images |
14 |
| -``` |
15 |
| - |
16 |
| -You can also pass transform functions to `download/1`: |
17 |
| - |
18 |
| -```elixir |
19 |
| -transform_images = fn {binary, type, shape} -> |
20 |
| - binary |
21 |
| - |> Nx.from_binary(type) |
22 |
| - |> Nx.reshape(shape) |
23 |
| - |> Nx.divide(255) |
24 |
| - |> Nx.to_batched_list(32) |
25 |
| -end |
26 |
| - |
27 |
| -{train_images, train_labels} = |
28 |
| - AxonDatasets.MNIST.download(transform_images: transform_images) |
29 |
| - |
30 |
| -# Transform labels as well, e.g. get one-hot encoding |
31 |
| -transform_labels = fn {labels_binary, type, _} -> |
32 |
| - labels_binary |
33 |
| - |> Nx.from_binary(type) |
34 |
| - |> Nx.new_axis(-1) |
35 |
| - |> Nx.equal(Nx.tensor(Enum.to_list(0..9))) |
36 |
| - |> Nx.to_batched_list(32) |
37 |
| -end |
38 |
| - |
39 |
| -{images, labels} = |
40 |
| - AxonDatasets.MNIST.download( |
41 |
| - transform_images: transform_images, |
42 |
| - transform_labels: transform_labels |
43 |
| - ) |
44 |
| - |
45 |
| -``` |
46 |
| - |
47 |
| -## Installation |
48 |
| - |
49 |
| -```elixir |
50 |
| -def deps do |
51 |
| - [ |
52 |
| - {:axon_datasets, "~> 0.1.0-dev", github: "t-rutten/axon_datasets", branch: "main", override: true} |
53 |
| - ] |
54 |
| -end |
55 |
| -``` |
| 3 | +Datasets have moved to [Scidata](https://github.com/elixir-nx/scidata) |
0 commit comments