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.13.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69c895182fa672bd2bf96fef1b5e55ae77363d2e15e6585e863b6e47b2691aec |
|
MD5 | bc0b0786908273c27624547240efa9db |
|
BLAKE2b-256 | a2c2a367bcff983b7ecc6a0ef349aca0b57337f77e55ead2fdf3724d8a579652 |
Close
Hashes for tensorflow_records-0.1.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8a84524eea54167131b18efb12343bb346774756ad25c58386bc16f4c88dce2 |
|
MD5 | cd97d93fdd467fe46b835cc5be53886e |
|
BLAKE2b-256 | 7e5732b87fd576855322487af31381384f1dd0d2982f2a974f78b46a1389d6c2 |