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<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<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<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.3.tar.gz
(24.4 kB
view details)
Built Distribution
File details
Details for the file fastai-datasets-0.0.3.tar.gz
.
File metadata
- Download URL: fastai-datasets-0.0.3.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a581d5df13b894c8bab76c3e5be768857a11795b8a5b4fe3fd152872c9664fc |
|
MD5 | 2f9c10ca744de884a4d5cf3c32c9415f |
|
BLAKE2b-256 | 41e34a1ca62a1902a982616ebeacfe710ca20d8551761707d368dac85acef3d4 |
Provenance
File details
Details for the file fastai_datasets-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: fastai_datasets-0.0.3-py3-none-any.whl
- Upload date:
- Size: 25.4 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 | a6cbac759f960fec5e3893f7daa5a689a41eb4a8cd0569d919196b0ee5911a59 |
|
MD5 | 4ea7d36eb3bc981856368d7d0de6deca |
|
BLAKE2b-256 | c5f3dd45a4cd37477d8ef9630b7468092f78eae618f1da493a33b57e5e7d52af |