Skip to content

Commit

Permalink
Workaround tensorflow#10474.
Browse files Browse the repository at this point in the history
  • Loading branch information
khatchad committed Aug 7, 2024
1 parent 2203595 commit 9052f44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions research/delf/delf/python/training/build_image_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _get_all_image_files_and_labels(name, csv_path, image_dir):
image_paths = tf.io.gfile.glob(os.path.join(image_dir, '*.jpg'))
file_ids = [os.path.basename(os.path.normpath(f))[:-4] for f in image_paths]
if name == _TRAIN_SPLIT:
with tf.io.gfile.GFile(csv_path, 'rb') as csv_file:
with tf.io.gfile.GFile(csv_path, 'r') as csv_file:
df = pd.read_csv(csv_file)
df = df.set_index('id')
labels = [int(df.loc[fid]['landmark_id']) for fid in file_ids]
Expand All @@ -141,7 +141,7 @@ def _get_clean_train_image_files_and_labels(csv_path, image_dir):
a continuous set of labels.
"""
# Load the content of the CSV file (landmark_id/label -> images).
with tf.io.gfile.GFile(csv_path, 'rb') as csv_file:
with tf.io.gfile.GFile(csv_path, 'r') as csv_file:
df = pd.read_csv(csv_file)

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

0 comments on commit 9052f44

Please sign in to comment.