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.12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e58d7d8eb77737b00c1cdc539d64ce59b863b6176ce94511d29cc47fcc1e7b2 |
|
MD5 | e3a5ca893dea4d6bf369534321de9b28 |
|
BLAKE2b-256 | d99cc4824235755751334f924c7f2437975afe47a804600adc4731c81bfd81ee |
Close
Hashes for tensorflow_records-0.1.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23e6f6c163f5253a97e9723bfc579bc069956cc207d8291a4a16ce8e7785935c |
|
MD5 | 6998b63806f52565504b455126b927e4 |
|
BLAKE2b-256 | 36d58485c598fed79065bb5283d5d7b4bf423bc23c6d36618ee15eb85468d34e |