Skip to main content

Leveraging fastai to easily load and handle datasets

Project description

fastai-datasets

Docs

See https://irad-zehavi.github.io/fastai-datasets/

Install

pip install fastai_datasets

How to use

As an nbdev library, fatai_datasets supports import * (without importing unwanted symbols):

from fastai_datasets.all import *

Here are a few usage examles:

Easily load a dataset

mnist = MNIST()
mnist.dls().show_batch()

Show the class distribution

mnist.plot_class_distribution()
<div>
  <progress value='10' class='' max='10' style='width:300px; height:20px; vertical-align: middle;'></progress>
  100.00% [10/10 00:00&lt;00:00]
</div>

Sample a subset

Whole datasets:

mnist
[(#60000) [(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7))...]
(#10000) [(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(7))...]]

Subset:

mnist.random_sub_dsets(1000)
[(#881) [(PILImageBW mode=L size=28x28, TensorCategory(1)),(PILImageBW mode=L size=28x28, TensorCategory(3)),(PILImageBW mode=L size=28x28, TensorCategory(4)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(2)),(PILImageBW mode=L size=28x28, TensorCategory(9)),(PILImageBW mode=L size=28x28, TensorCategory(0)),(PILImageBW mode=L size=28x28, TensorCategory(9)),(PILImageBW mode=L size=28x28, TensorCategory(8)),(PILImageBW mode=L size=28x28, TensorCategory(4))...]
(#119) [(PILImageBW mode=L size=28x28, TensorCategory(1)),(PILImageBW mode=L size=28x28, TensorCategory(4)),(PILImageBW mode=L size=28x28, TensorCategory(2)),(PILImageBW mode=L size=28x28, TensorCategory(3)),(PILImageBW mode=L size=28x28, TensorCategory(0)),(PILImageBW mode=L size=28x28, TensorCategory(9)),(PILImageBW mode=L size=28x28, TensorCategory(8)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(1)),(PILImageBW mode=L size=28x28, TensorCategory(9))...]]

Construct a subset based on classes

cifar10 = CIFAR10()
dig_frog_bird = cifar10.by_target['dog'] + cifar10.by_target['frog'] + cifar10.by_target['bird']
dig_frog_bird.dls().show_batch()
<div>
  <progress value='10' class='' max='10' style='width:300px; height:20px; vertical-align: middle;'></progress>
  100.00% [10/10 00:00&lt;00:00]
</div>

Construct a dataset of similarity pairs

Pairs(cifar10, .01).dls().show_batch()
<div>
  <progress value='50' class='' max='50' style='width:300px; height:20px; vertical-align: middle;'></progress>
  100.00% [50/50 00:00&lt;00:00]
</div>

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

fastai-datasets-0.0.6.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

fastai_datasets-0.0.6-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file fastai-datasets-0.0.6.tar.gz.

File metadata

  • Download URL: fastai-datasets-0.0.6.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for fastai-datasets-0.0.6.tar.gz
Algorithm Hash digest
SHA256 8c34847f4825fab9c24d8d6dda2daf5a65f21bcebc2dbe301f42f9c8c9e35ef0
MD5 09a5a76ab878915d43f3079d5ab1c3e9
BLAKE2b-256 45c4b9d3224ef9b9f88593796e62063c65b80b6dbedd86e584d10b7567556fa3

See more details on using hashes here.

Provenance

File details

Details for the file fastai_datasets-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for fastai_datasets-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 bc34b09f8e84e692ad75186703eed6c68c2ad64e282bdbd01d3faa4880722e8b
MD5 8af12c6846673a1658889d38d9665b12
BLAKE2b-256 9e45a53b5495efb907e2c62189428bd559bad536c7913ffdea652b7c47442b40

See more details on using hashes here.

Provenance

Supported by

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