alkzar90 commited on
Commit
51a3670
1 Parent(s): ad90602

Update CC6204-Hackaton-Cub-Dataset.py

Browse files
Files changed (1) hide show
  1. CC6204-Hackaton-Cub-Dataset.py +9 -10
CC6204-Hackaton-Cub-Dataset.py CHANGED
@@ -112,18 +112,17 @@ class CubDataset(datasets.GeneratorBasedBuilder):
112
 
113
  for img, text in zip(img_path_files, text_path_files):
114
  #for img in img_path_files:
115
- print(img)
116
- print(os.path.basename(img))
117
- print(text)
118
- print(os.path.basename(text))
119
  #text = text_path_files[text_path_files.index(os.path.basename(img).replace("jpg", "txt"))]
120
  img_idx = _IMGNAME2ID[os.path.basename(img)]
121
- if img_idx in _TRAIN_IDX_SET:
122
- train_files.append((img, text))
123
- train_idx.append(img_idx)
124
- else:
125
- test_files.append((img, text))
126
- test_idx.append(img_idx)
 
127
 
128
  return [
129
  datasets.SplitGenerator(
 
112
 
113
  for img, text in zip(img_path_files, text_path_files):
114
  #for img in img_path_files:
115
+ #print(os.path.basename(img))
116
+ #print(os.path.basename(text))
 
 
117
  #text = text_path_files[text_path_files.index(os.path.basename(img).replace("jpg", "txt"))]
118
  img_idx = _IMGNAME2ID[os.path.basename(img)]
119
+ if os.path.basename(img).replace(".jpg", "") == os.path.basename(text).replace(".txt", ""):
120
+ if img_idx in _TRAIN_IDX_SET:
121
+ train_files.append((img, text))
122
+ train_idx.append(img_idx)
123
+ else:
124
+ test_files.append((img, text))
125
+ test_idx.append(img_idx)
126
 
127
  return [
128
  datasets.SplitGenerator(