"...resnet50_tensorflow.git" did not exist on "980b27d55b20ec79135b36fb5c5df80dadff8ff5"
Commit fd505f48 authored by Fan Yang's avatar Fan Yang Committed by A. Unique TensorFlower
Browse files

Add functionality to create fake data and use that in train_test to show how an e2e training works.

PiperOrigin-RevId: 381368435
parent c73c0127
...@@ -143,3 +143,24 @@ def create_classification_example( ...@@ -143,3 +143,24 @@ def create_classification_example(
int64_list=tf.train.Int64List(value=labels))), int64_list=tf.train.Int64List(value=labels))),
})).SerializeToString() })).SerializeToString()
return serialized_example return serialized_example
def create_3d_image_test_example(image_height: int, image_width: int,
image_volume: int,
image_channel: int) -> tf.train.Example:
"""Creates 3D image and label."""
images = np.random.rand(image_height, image_width, image_volume,
image_channel)
images = images.astype(np.float32)
labels = np.random.randint(
low=2, size=(image_height, image_width, image_volume, image_channel))
labels = labels.astype(np.float32)
feature = {
IMAGE_KEY: (tf.train.Feature(
bytes_list=tf.train.BytesList(value=[images.tobytes()]))),
CLASSIFICATION_LABEL_KEY: (tf.train.Feature(
bytes_list=tf.train.BytesList(value=[labels.tobytes()])))
}
return tf.train.Example(features=tf.train.Features(feature=feature))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment