"tools/vscode:/vscode.git/clone" did not exist on "22402e99a06cfffb322bf6ea59e0002ec09908d6"
Commit 9997b250 authored by BoyuanJiang's avatar BoyuanJiang Committed by GitHub
Browse files

Update build_image_data.py

_bytes_feature excepted class bytes, but in python3 in class str,so use tf.compat.as_bytes for compatibility !
parent bfa1bb1b
...@@ -137,13 +137,13 @@ def _convert_to_example(filename, image_buffer, label, text, height, width): ...@@ -137,13 +137,13 @@ def _convert_to_example(filename, image_buffer, label, text, height, width):
example = tf.train.Example(features=tf.train.Features(feature={ example = tf.train.Example(features=tf.train.Features(feature={
'image/height': _int64_feature(height), 'image/height': _int64_feature(height),
'image/width': _int64_feature(width), 'image/width': _int64_feature(width),
'image/colorspace': _bytes_feature(colorspace), 'image/colorspace': _bytes_feature(tf.compat.as_bytes(colorspace)),
'image/channels': _int64_feature(channels), 'image/channels': _int64_feature(channels),
'image/class/label': _int64_feature(label), 'image/class/label': _int64_feature(label),
'image/class/text': _bytes_feature(text), 'image/class/text': _bytes_feature(tf.compat.as_bytes(text)),
'image/format': _bytes_feature(image_format), 'image/format': _bytes_feature(tf.compat.as_bytes(image_format)),
'image/filename': _bytes_feature(os.path.basename(filename)), 'image/filename': _bytes_feature(tf.compat.as_bytes(os.path.basename(filename))),
'image/encoded': _bytes_feature(image_buffer)})) 'image/encoded': _bytes_feature(tf.compat.as_bytes(image_buffer))}))
return example return example
......
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