Skip to main content

tfrmaker

GitHub GitHub last commit GitHub issues

Utility package which helps to ease the manipulation of tfrecords.

Contents

Description

tfrmaker helps to ease the manipulation of tfrecords for your next machine learning project with tensorflow. You can now easily create, extract and load image datasets in the form of tfrecords with help of tfrmaker. With the help of the package, large image datasets can be converted into tfrecords and fed directly into tensorflow models for training and testing purposes. Some key feature of the package includes:

  • dynamic resizing
  • splitting tfrecords into optimal shards
  • spliting training, validation, testing of tfrecords
  • count no of images in tfrecords
  • asynchronous tfrecord creation

Why TFRecords?

TFRecords stores data as a sequence of binary records with help of protocol buffers, a cross-platform, cross-language library. It has many advantages like:

  • Efficient storage: TFRecord data can take up less space than the original data; it can also be partitioned into multiple files.
  • Fast I/O: TFRecord format can be read with parallel I/O operations, which is useful for TPUs or multiple hosts.

Installation

Use the package manager pip to install tfrmaker.

pip install tfrmaker

Usage

A minimal usage of tfrmaker with image data, organized as directores with name as class labels:

from tfrmaker import images, display

# mapping label names with integer encoding.
LABELS = {"bishop": 0, "knight": 1, "pawn": 2, "queen": 3, "rook": 4}

# specifiying data and output directories.
DATA_DIR = "datasets/chess/"
OUTPUT_DIR = "tfrecords/chess/"

# create tfrecords from the images present in the given data directory.
images.create(DATA_DIR, LABELS, OUTPUT_DIR)

# load one or more tfrecords as an iterator object.
dataset = images.load(["tfrecords/chess/queen.tfrecord","tfrecords/chess/bishop.tfrecords"], batch_size=32, repeat=True)

# iterate one batch and visualize it along with labels.
databatch = next(iter(dataset))
display.batch(databatch, LABELS)

Refer examples folder for more advanced usage.

Support

"Your mental support by staring the repo is much appreciated."

Contribute

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Release files for tfrmaker 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tfrmaker 0.0.2
File Size Uploaded
tfrmaker-0.0.2.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tfrmaker 0.0.2
File Interpreter ABI Platform
tfrmaker-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / tfrmaker-0.0.2.tar.gz

Download URL tfrmaker-0.0.2.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fa4d3225f2cb575a16b7375b310f5c1fe4e2a492280b034b24d4eee474307375
BLAKE2b-256 checksum
How to use checksums
1172a39907a91e78674ef8461378bef3af6b2cda0bb4d608ca233ed5a9c08465
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / tfrmaker-0.0.2-py3-none-any.whl

Download URL tfrmaker-0.0.2-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9a0c1cda29220bab29de58f206dc3d7e2499016715ed66c52b2d9df5c9a7191
BLAKE2b-256 checksum
How to use checksums
52035551ec10e0375d0107da49f55a5834d3c90472d10542fa2bb9daefb13129
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page