Skip to main content

A better PyTorch dataloader

Project description

Making it harder to do easy things, but easier to do harder things with the Pytorch Dataloader


AboutInstallationUsageDevelopmentLicense

PyPi Badge PyPi Version Github Actions Build Status Issues 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BetterLoader-0.2.2.tar.gz (12.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page