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()
Class map: scanning targets: 0%| | 0/60000 [00:00<?, ?it/s]
Class map: partitioning: 0%| | 0/10 [00:00<?, ?it/s]
Class map: scanning targets: 0%| | 0/10000 [00:00<?, ?it/s]
Class map: partitioning: 0%| | 0/10 [00:00<?, ?it/s]
Sample a subset
Whole datasets:
mnist
[(#60000) [(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0))...]
(#10000) [(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0))...]]
Subset:
mnist.random_sub_dsets(1000)
[(#874) [(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(7)),(PILImage mode=RGB size=28x28, TensorCategory(9)),(PILImage mode=RGB size=28x28, TensorCategory(3)),(PILImage mode=RGB size=28x28, TensorCategory(5)),(PILImage mode=RGB size=28x28, TensorCategory(5)),(PILImage mode=RGB size=28x28, TensorCategory(7)),(PILImage mode=RGB size=28x28, TensorCategory(7)),(PILImage mode=RGB size=28x28, TensorCategory(2)),(PILImage mode=RGB size=28x28, TensorCategory(4))...]
(#126) [(PILImage mode=RGB size=28x28, TensorCategory(2)),(PILImage mode=RGB size=28x28, TensorCategory(7)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(2)),(PILImage mode=RGB size=28x28, TensorCategory(7)),(PILImage mode=RGB size=28x28, TensorCategory(4)),(PILImage mode=RGB size=28x28, TensorCategory(4)),(PILImage mode=RGB size=28x28, TensorCategory(6)),(PILImage mode=RGB size=28x28, TensorCategory(0)),(PILImage mode=RGB size=28x28, TensorCategory(0))...]]
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()
Class map: scanning targets: 0%| | 0/60000 [00:00<?, ?it/s]
Class map: partitioning: 0%| | 0/10 [00:00<?, ?it/s]
Construct a dataset of similarity pairs
Pairs(cifar10, .01).dls().show_batch()
Class map: scanning targets: 0it [00:00, ?it/s]
Generating positive pairs: 0%| | 0/250 [00:00<?, ?it/s]
Generating negative pairs: 0%| | 0/250 [00:00<?, ?it/s]
Class map: scanning targets: 0it [00:00, ?it/s]
Generating positive pairs: 0%| | 0/50 [00:00<?, ?it/s]
Generating negative pairs: 0%| | 0/50 [00:00<?, ?it/s]
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.2.tar.gz
(24.4 kB
view details)
Built Distribution
File details
Details for the file fastai-datasets-0.0.2.tar.gz
.
File metadata
- Download URL: fastai-datasets-0.0.2.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 | 93686f8880196d21208b8bef8d0ca032bc378877613cb5c524b1ca71afcdbbe2 |
|
MD5 | 49d5f0c3953d605dd13590f1365d9a1b |
|
BLAKE2b-256 | a9662c37bd9678236c06aff00b00d06fffe9098207f440a8d5232bd05e5a499c |
Provenance
File details
Details for the file fastai_datasets-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: fastai_datasets-0.0.2-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 | e495074971ada107b0c9943063b686521e3f5a8b6bb1d7f2a1a1bd83ebe97140 |
|
MD5 | c0038aede9833081b4f53df4d9b2be4b |
|
BLAKE2b-256 | 4ae5d6f94d2c3b25df1d6bbf42e0028176faa7a670d900b5f4cf8c3e03710c0f |