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.5.tar.gz
(24.4 kB
view details)
Built Distribution
File details
Details for the file fastai-datasets-0.0.5.tar.gz
.
File metadata
- Download URL: fastai-datasets-0.0.5.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 | 8bc90f9112febb26c7fa7b6922dbd8a33109479816605c2a01937b023b1e5695 |
|
MD5 | f916330d8d60c17d88dede61a87e9fab |
|
BLAKE2b-256 | 5eb3302bf697383b22b50c91a4175e165b68846669d589f57c7300559be54595 |
Provenance
File details
Details for the file fastai_datasets-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: fastai_datasets-0.0.5-py3-none-any.whl
- Upload date:
- Size: 25.3 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 | 088f3d9450d6f98343a981303dd76ed1273bfcc5804b19e001dc0224ed0f4c67 |
|
MD5 | 892ac01af2d8fb12640920b5728894f6 |
|
BLAKE2b-256 | 577e74db9a36d6f6cdded2386ada0a5b12fd8a145a4e655bb9cf179e19b4ddfd |