Scidata.CIFAR10 (Scidata v0.1.0) View Source

Module for downloading the CIFAR10 dataset.

Link to this section Summary

Functions

Downloads the CIFAR10 training dataset or fetches it locally.

Downloads the CIFAR10 test dataset or fetches it locally.

Link to this section Functions

Downloads the CIFAR10 training dataset or fetches it locally.

Options

  • :transform_images - A function that transforms images, defaults to & &1.

    It accepts a tuple like {binary_data, tensor_type, data_shape} which can be used for converting the binary_data to a tensor with a function like:

    fn {labels_binary, type, _shape} ->
      labels_binary
      |> Nx.from_binary(type)
      |> Nx.new_axis(-1)
      |> Nx.equal(Nx.tensor(Enum.to_list(0..9)))
      |> Nx.to_batched_list(32)
    end
  • :transform_labels - similar to :transform_images but applied to dataset labels

Examples

iex> Scidata.CIFAR10.download()
{{<<59, 43, 50, 68, 98, 119, 139, 145, 149, 149, 131, 125, 142, 144, 137, 129,
137, 134, 124, 139, 139, 133, 136, 139, 152, 163, 168, 159, 158, 158, 152,
148, 16, 0, 18, 51, 88, 120, 128, 127, 126, 116, 106, 101, 105, 113, 109,
112, ...>>, {:u, 8}, {50000, 3, 32, 32}},
{<<6, 9, 9, 4, 1, 1, 2, 7, 8, 3, 4, 7, 7, 2, 9, 9, 9, 3, 2, 6, 4, 3, 6, 6, 2,
    6, 3, 5, 4, 0, 0, 9, 1, 3, 4, 0, 3, 7, 3, 3, 5, 2, 2, 7, 1, 1, 1, ...>>,
  {:u, 8}, {50000}}}
Link to this function

download_test(opts \\ [])

View Source

Downloads the CIFAR10 test dataset or fetches it locally.

Accepts the same options as download/1.