Skip to content

Commit 9052f44

Browse files
committed
Workaround tensorflow#10474.
1 parent 2203595 commit 9052f44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

research/delf/delf/python/training/build_image_dataset.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def _get_all_image_files_and_labels(name, csv_path, image_dir):
114114
image_paths = tf.io.gfile.glob(os.path.join(image_dir, '*.jpg'))
115115
file_ids = [os.path.basename(os.path.normpath(f))[:-4] for f in image_paths]
116116
if name == _TRAIN_SPLIT:
117-
with tf.io.gfile.GFile(csv_path, 'rb') as csv_file:
117+
with tf.io.gfile.GFile(csv_path, 'r') as csv_file:
118118
df = pd.read_csv(csv_file)
119119
df = df.set_index('id')
120120
labels = [int(df.loc[fid]['landmark_id']) for fid in file_ids]
@@ -141,7 +141,7 @@ def _get_clean_train_image_files_and_labels(csv_path, image_dir):
141141
a continuous set of labels.
142142
"""
143143
# Load the content of the CSV file (landmark_id/label -> images).
144-
with tf.io.gfile.GFile(csv_path, 'rb') as csv_file:
144+
with tf.io.gfile.GFile(csv_path, 'r') as csv_file:
145145
df = pd.read_csv(csv_file)
146146

147147
# Create the dictionary (key = image_id, value = {label, file_id}).

0 commit comments

Comments
 (0)