Simple standard + tools for I/O of TFRecords
Project description
TFRecords
Simple standard + tools for I/O of TFRecords
pip install tensorflow-records
I/O
import tensorflow as tf
import tf.records as tfr
image = tf.ones([1024, 768, 3], dtype=tf.uint8)
label = tf.constant('cat')
spec = tfr.spec(
image=tfr.Tensor([1024, 768, 3], dtype='int'),
label='string'
)
serialized = tfr.serialize(spec, image=x, label=y)
# b'\n+\n\x10\n\x05label\x12\x07\n\x05\n\x03cat\n\x17\n\x05image\x1...'
tfr.parse(spec).sample(tf.constant(serialized))
# { 'image': <tf.Tensor: shape=(1024, 768, 3) ...>, 'label': <tf.Tensor: shape=() ...> }
# or you can parse multiple at once
tfr.parse(spec).batch(tf.constant([serialized, serialized]))
# { 'image': <tf.Tensor: shape=(2, 1024, 768, 3) ...>, 'label': <tf.Tensor: shape=(2,) ...> }
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
Built Distribution
Close
Hashes for tensorflow_records-0.1.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59a147b7f6f05b5ad836f64df9b3c2fd406c893e5832fb68ec3a483b2d484633 |
|
MD5 | d413a3fb7bc42b5c830c083226626daa |
|
BLAKE2b-256 | 48e2b1ca07342b203d7e1640ca6a3d209fbbc8480a5f46b313789088ce82a24b |
Close
Hashes for tensorflow_records-0.1.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6608a83743454034a55e7c7e709bedb88d276b9b10f146bc1a27f70bd4b4bb9b |
|
MD5 | fe39d9ecc7fdd9934be883e3797258f3 |
|
BLAKE2b-256 | 68bd0cdf58dd185adc3cc3022394031d106dbe5281701f6586425659adc119fd |