Unverified Commit 748ed3b6 authored by Yukun Zhu's avatar Yukun Zhu Committed by GitHub
Browse files

Merge pull request #3941 from qlzh727/3885-fix

Fix string to bytes conversion in deeplab data input. #3885
parents 310f70d5 d4aa1a24
...@@ -30,6 +30,7 @@ The Example proto contains the following fields: ...@@ -30,6 +30,7 @@ The Example proto contains the following fields:
image/segmentation/class/format: semantic segmentation file format. image/segmentation/class/format: semantic segmentation file format.
""" """
import collections import collections
import six
import tensorflow as tf import tensorflow as tf
FLAGS = tf.app.flags.FLAGS FLAGS = tf.app.flags.FLAGS
...@@ -126,7 +127,7 @@ def _bytes_list_feature(values): ...@@ -126,7 +127,7 @@ def _bytes_list_feature(values):
A TF-Feature. A TF-Feature.
""" """
def norm2bytes(value): def norm2bytes(value):
return value.encode() if isinstance(value, str) else value return value.encode() if isinstance(value, str) and six.PY3 else value
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[norm2bytes(values)])) return tf.train.Feature(bytes_list=tf.train.BytesList(value=[norm2bytes(values)]))
......
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