Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
59c35095
Commit
59c35095
authored
Jun 24, 2021
by
Fan Yang
Committed by
A. Unique TensorFlower
Jun 24, 2021
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
1d62fa0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
official/vision/beta/dataloaders/tfexample_utils.py
official/vision/beta/dataloaders/tfexample_utils.py
+21
-0
No files found.
official/vision/beta/dataloaders/tfexample_utils.py
View file @
59c35095
...
...
@@ -143,3 +143,24 @@ def create_classification_example(
int64_list
=
tf
.
train
.
Int64List
(
value
=
labels
))),
})).
SerializeToString
()
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
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment