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()
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)
[(#861) [(PILImageBW mode=L size=28x28, TensorCategory(3)),(PILImageBW mode=L size=28x28, TensorCategory(6)),(PILImageBW mode=L size=28x28, TensorCategory(7)),(PILImageBW mode=L size=28x28, TensorCategory(3)),(PILImageBW mode=L size=28x28, TensorCategory(3)),(PILImageBW mode=L size=28x28, TensorCategory(3)),(PILImageBW mode=L size=28x28, TensorCategory(4)),(PILImageBW mode=L size=28x28, TensorCategory(1)),(PILImageBW mode=L size=28x28, TensorCategory(5)),(PILImageBW mode=L size=28x28, TensorCategory(1))...]
(#139) [(PILImageBW mode=L size=28x28, TensorCategory(0)),(PILImageBW mode=L size=28x28, TensorCategory(0)),(PILImageBW mode=L size=28x28, TensorCategory(1)),(PILImageBW mode=L size=28x28, TensorCategory(2)),(PILImageBW mode=L size=28x28, TensorCategory(8)),(PILImageBW mode=L size=28x28, TensorCategory(4)),(PILImageBW mode=L size=28x28, TensorCategory(2)),(PILImageBW mode=L size=28x28, TensorCategory(8)),(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()
Construct a dataset of similarity pairs
Pairs(cifar10, .01).dls().show_batch()
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.8.tar.gz
(24.7 kB
view details)
Built Distribution
File details
Details for the file fastai-datasets-0.0.8.tar.gz
.
File metadata
- Download URL: fastai-datasets-0.0.8.tar.gz
- Upload date:
- Size: 24.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6bc7476474cc842a1e20ab2645af681c569c063dc37ae1f3c910c519b7d7ac5 |
|
MD5 | 42d378ca94f04f59f0b0278fdde3d1da |
|
BLAKE2b-256 | a3dedd6bad069b82d20db4fc46f6c809d3e0208f214e4533bff792e4e2caf1c1 |
File details
Details for the file fastai_datasets-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: fastai_datasets-0.0.8-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8fa18badd6ec4424f694f0a21feb384a4babbe2ab8801726068f08e01284859 |
|
MD5 | 0bb59337a7e7ab3c053de7fd785160de |
|
BLAKE2b-256 | 4f711c414fef82a7627d3f85d8aaf98d3cf8306a0787e7dd434a2aeaf65e3cbd |