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 Class map: partitioning]
</div>

Sample a subset

Whole datasets:

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

Subset:

mnist.random_sub_dsets(1000)
[(#865) [(PILImage mode=RGB size=28x28, TensorCategory(3)),(PILImage mode=RGB size=28x28, TensorCategory(1)),(PILImage mode=RGB size=28x28, TensorCategory(3)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(9)),(PILImage mode=RGB size=28x28, TensorCategory(8)),(PILImage mode=RGB size=28x28, TensorCategory(9)),(PILImage mode=RGB size=28x28, TensorCategory(1)),(PILImage mode=RGB size=28x28, TensorCategory(8)),(PILImage mode=RGB size=28x28, TensorCategory(1))...]
(#135) [(PILImage mode=RGB size=28x28, TensorCategory(3)),(PILImage mode=RGB size=28x28, TensorCategory(9)),(PILImage mode=RGB size=28x28, TensorCategory(4)),(PILImage mode=RGB size=28x28, TensorCategory(1)),(PILImage mode=RGB size=28x28, TensorCategory(4)),(PILImage mode=RGB size=28x28, TensorCategory(5)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(4)),(PILImage mode=RGB size=28x28, TensorCategory(1)),(PILImage mode=RGB 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 Class map: partitioning]
</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 Generating negative pairs]
</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.4.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

fastai_datasets-0.0.4-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastai-datasets-0.0.4.tar.gz
  • Upload date:
  • Size: 24.4 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.4.tar.gz
Algorithm Hash digest
SHA256 7813d24d5454f2cc55be28c9fbae69e4ac3bc7a7b848e9537228134ea7beb2a9
MD5 054177e767ed52b73a58b47ab15a0bca
BLAKE2b-256 4fb166bceb539bd6649d0d3caff95ecd51d60f023494722189947d31440fc083

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for fastai_datasets-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3d878003505d0182f0ace599b41b09a7f4f60a7d2aaf5fb5d16e350dab22964a
MD5 3b0f18c29ec2b54513c2d0742482a21b
BLAKE2b-256 b21a765ad4f0aa8aebe9c5e4359b4c7074654a9216a1c1b8b43dcbcc63800739

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