Skip to main content

Pure Python/NumPy CIFAR-10 dataset loader

Project description

pure_cifar_10

A pure Python, minimal-dependency loader for the CIFAR-10 dataset. This package provides the CIFAR-10 images and labels as NumPy arrays, with automatic downloading and caching, requiring only numpy and tqdm.

Features

  • Minimal Dependencies: Only requires numpy and tqdm. No heavy machine learning frameworks like PyTorch or TensorFlow.
  • Automatic Handling: Downloads the CIFAR-10 dataset automatically on first use and caches it locally.
  • Pure NumPy: Returns standard numpy.ndarray objects for easy integration into any pipeline.
  • Progress Visualization: Uses tqdm to show download and loading progress bars.
  • Simple API: Mirrors the clean, functional style of the mnist_datasets package.

Installation

You can install the package directly from PyPI using pip:

pip install pure_cifar_10

Usage

from pure_cifar_10 import CIFAR10
loader = CIFAR10() 
train_data, train_labels, test_data, test_labels = loader.load_all()

Optionally specify a custom folder and load train and test data as required.

loader = CIFAR10(folder="/tmp/data) 
train_data, train_labels = loader.load() # train=True by default 
test_data, test_labels = loader.load(train=False)
print(train_data.shape, train_labels.shape)
print(test_data.shape, test_labels.shape)

(50000, 3, 32, 32) (50000,)
(10000, 3, 32, 32) (10000,)

classes = loader.class_names
print(classes)
('airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck')

Data Format

  • Images: The data arrays have shape (N, 3, 32, 32), where N is the number of samples. This is a channels-first format (3 color channels, Red-Green-Blue). Pixel values are float32 in the range [0, 255], as stored in the original dataset.
  • Labels: The labels are 1D numpy arrays of dtype int64, containing integers from 0 to 9.

Class Names

The dataset contains 10 mutually exclusive classes: 0. airplane

  1. automobile
  2. bird
  3. cat
  4. deer
  5. dog
  6. frog
  7. horse
  8. ship
  9. truck

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pure_cifar_10-0.1.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pure_cifar_10-0.1.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file pure_cifar_10-0.1.1.tar.gz.

File metadata

  • Download URL: pure_cifar_10-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for pure_cifar_10-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9ae29b81411478cbbfb8f9d2f932c4a9dea4190e62db049339ebeddf7d4b6855
MD5 8e0b2180068f4754b4691b53acce461d
BLAKE2b-256 6c9bcbc793c2f83456586b3e52a8c6264e95080f8782c4af8a75c7d53eb93606

See more details on using hashes here.

File details

Details for the file pure_cifar_10-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pure_cifar_10-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for pure_cifar_10-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4174be3c23000efb414b718a17d7d1c6cccbfa15a40ff569b57c61140c29f94d
MD5 d38c58cd17185d5e8d0fccedb5beabaf
BLAKE2b-256 4bf9d8ac11ddbd5d506e7c6be71b8a33698c73fd9dc108f6c9e0595f7cd60619

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page