Disentanglement Datasets
A lightweight package of torchvision-style PyTorch datasets with a focus on flexibility.
Installation
$ pip install pytorch-disentanglement-datasets
Usage
Each dataset returns a dictionary containing at least an input key:
>>> from disentanglement_datasets import DSprites
>>> dataset = DSprites(root="./data", download=True)
>>> dataset[0]
{'input': tensor([[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
...,
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0]], dtype=torch.uint8),
'latent': tensor([1.0000, 1.0000, 0.5000, 0.0000, 0.0000, 0.0000], dtype=torch.float64)}
This dictionary can be transformed. For example, for self-supervised learning with augmentations you might do something like:
>>> def my_transform(item):
... view1 = my_random_augmentation(item["input"])
... view2 = my_random_augmentation(item["input"])
... return view1, view2
...
>>> dataset = DSprites(root="./data", download=True, transform=my_transform)
>>> dataset[0]
(tensor([[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
...,
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0]], dtype=torch.uint8), tensor([[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
...,
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0]], dtype=torch.uint8))
Datasets and their original sources
Attribution
If this code was useful to you, please cite the original dataset (links above) and this codebase.
BibTeX
TODO
Development
Pull requests are welcome.
See also
disentanglement-pytorch: Variational autoencoder models for disentanglement, created as a contribution to the Disentanglement Challenge of NeurIPS 2019, along with more datasets with a different interface.disentanglement_lib: VAE models, metrics, and data for disentanglement, implemented in TensorFlow, created as a contribution to the Disentanglement Challenge of NeurIPS 2019.
Metadata
Release files for pytorch-disentanglement-datasets 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytorch-disentanglement-datasets-0.0.1.tar.gz | 6.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytorch_disentanglement_datasets-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.5 kB
Release files / pytorch-disentanglement-datasets-0.0.1.tar.gz
| Download URL | pytorch-disentanglement-datasets-0.0.1.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2aad324bd93d2ffe93eed1c36bf74b4dbd6475c2079d4b365be643fa79c93b8
|
|
BLAKE2b-256 checksum How to use checksums |
4f84917aa260abcb80842cff1cb3b9711fcfec803e493d3ab0e229afcd98e269
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / pytorch_disentanglement_datasets-0.0.1-py3-none-any.whl
| Download URL | pytorch_disentanglement_datasets-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0283e40e2f49f3ec44a9841ce6b986e87d7229c8baa4c3631d0b9c9d056dc838
|
|
BLAKE2b-256 checksum How to use checksums |
a57337fd6a6b696ae7fbcdd1aed04b0e0ff2036c36862bb613e1e950a4152483
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|