alkzar90 commited on
Commit
df10ff5
1 Parent(s): a21fff4

Update CC6204-Hackaton-Cub-Dataset.py

Browse files
Files changed (1) hide show
  1. CC6204-Hackaton-Cub-Dataset.py +3 -6
CC6204-Hackaton-Cub-Dataset.py CHANGED
@@ -5,8 +5,8 @@ import datasets
5
 
6
  from requests import get
7
 
8
- datasets.logging.set_verbosity_debug()
9
- logger = datasets.logging.get_logger(__name__)
10
  #datasets.logging.set_verbosity_info()
11
  #datasets.logging.set_verbosity_debug()
12
 
@@ -112,11 +112,8 @@ class CubDataset(datasets.GeneratorBasedBuilder):
112
  text_path_files = dl_manager.iter_files(text_data_files)
113
 
114
  for img, text in zip(img_path_files, text_path_files):
115
- #for img in img_path_files:
116
- #print(os.path.basename(img))
117
- #print(os.path.basename(text))
118
- #text = text_path_files[text_path_files.index(os.path.basename(img).replace("jpg", "txt"))]
119
  img_idx = _IMGNAME2ID[os.path.basename(img)]
 
120
  if os.path.basename(img).replace(".jpg", "") == os.path.basename(text).replace(".txt", ""):
121
  if img_idx in _TRAIN_IDX_SET:
122
  train_files.append((img, text))
 
5
 
6
  from requests import get
7
 
8
+ #datasets.logging.set_verbosity_debug()
9
+ #logger = datasets.logging.get_logger(__name__)
10
  #datasets.logging.set_verbosity_info()
11
  #datasets.logging.set_verbosity_debug()
12
 
 
112
  text_path_files = dl_manager.iter_files(text_data_files)
113
 
114
  for img, text in zip(img_path_files, text_path_files):
 
 
 
 
115
  img_idx = _IMGNAME2ID[os.path.basename(img)]
116
+ # Sanity check to ensure that pairs of text and image are correct
117
  if os.path.basename(img).replace(".jpg", "") == os.path.basename(text).replace(".txt", ""):
118
  if img_idx in _TRAIN_IDX_SET:
119
  train_files.append((img, text))