alkzar90 commited on
Commit
5d2aa2d
1 Parent(s): aaf8b27

Update CC6204-Hackaton-Cub-Dataset.py

Browse files
Files changed (1) hide show
  1. CC6204-Hackaton-Cub-Dataset.py +2 -2
CC6204-Hackaton-Cub-Dataset.py CHANGED
@@ -36,7 +36,7 @@ for row in classes:
36
  row = row.decode("UTF8")
37
  if row != "":
38
  idx, label = row.split(" ")
39
- _ID2LABEL[idx] = re.search("[^\d\.\_+].+", label).group(0).replace("_", " ")
40
 
41
 
42
  _NAMES = list(_ID2LABEL.values())
@@ -132,6 +132,6 @@ class CubDataset(datasets.GeneratorBasedBuilder):
132
  if file_name.endswith(".jpg"):
133
  yield i, {
134
  "image": path,
135
- "labels": os.path.basename(os.path.dirname(path)).lower(),
136
  }
137
 
 
36
  row = row.decode("UTF8")
37
  if row != "":
38
  idx, label = row.split(" ")
39
+ _ID2LABEL[int(idx)] = re.search("[^\d\.\_+].+", label).group(0).replace("_", " ")
40
 
41
 
42
  _NAMES = list(_ID2LABEL.values())
 
132
  if file_name.endswith(".jpg"):
133
  yield i, {
134
  "image": path,
135
+ "labels": _ID2LABEL[int(re.search("^\d+", file_name).group(0))],
136
  }
137