A better PyTorch dataloader
Project description
Making it harder to do easy things, but easier to do harder things with the Pytorch Dataloader
About • Installation • Usage • Development • License
About BetterLoader
BetterLoader is a hyper-customizable extension of the default PyTorch dataloader class, that allows for custom transformations pre-load and image subset definitions. Use the power of custom index files to maintain only a single copy of a dataset with a fixed, flat file structure, and allow BetterLoader to do all the heavy lifting.
Installation
pip install betterloader
Usage
BetterLoader allows you to dynamically assign images to labels, load subsets of images conditionally, perform custom pretransforms before loading an image, and much more.
Basic Usage
A few points worth noting are that:
- BetterLoader does not expect a nested folder structure. In its current iteration, files are expected to all be present in the root directory.
- Every instance of BetterLoader requires an index file to function. Sample index files may be found here.
from betterloader import BetterLoader
index_json = './examples/sample_index.json'
basepath = "./examples/sample_dataset/"
batch_size = 2
loader = BetterLoader(basepath=basepath, index_json_path=index_json)
dataloaders, sizes = loader.fetch_segmented_dataloaders(batch_size=batch_size, transform=None)
print("Dataloader sizes: {}".format(str(sizes)))
For more information and more detailed examples, please check out the BetterLoader docs!
Development
We use Makefile to make our lives a little easier :)
Install Dependancies
make install
Run Sample
make sample
Run Unit Tests
make test
Meta
Distributed under the MIT license. See LICENSE
for more information.
Documentation & Usage
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file BetterLoader-0.2.2.tar.gz
.
File metadata
- Download URL: BetterLoader-0.2.2.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c61a5877bf9a300a8dd6aee73e89191f4a064d9912e4a32319a8feefebc8303 |
|
MD5 | 7d87e0ec8233622b72de683e1bcc98f1 |
|
BLAKE2b-256 | bfc3eceb08cb4a7bf7d56709e4d5bc0c323ef789aebff7494dc8fa5a2251583c |