Datasets:
Update CC6204-Hackaton-Cub-Dataset.py
Browse files
CC6204-Hackaton-Cub-Dataset.py
CHANGED
@@ -34,7 +34,7 @@ for row in classes:
|
|
34 |
row = row.decode("UTF8")
|
35 |
if row != "":
|
36 |
idx, label = row.split(" ")
|
37 |
-
_ID2LABEL[
|
38 |
|
39 |
logger.info(f"_ID2LABEL: {_ID2LABEL}")
|
40 |
|
@@ -48,7 +48,7 @@ for row in imgpath_to_ids:
|
|
48 |
row = row.decode("UTF8")
|
49 |
if row != "":
|
50 |
idx, img_name = row.split(" ")
|
51 |
-
_IMGNAME2ID[os.path.basename(img_name)] =
|
52 |
|
53 |
|
54 |
# Create TRAIN_IDX_SET
|
@@ -60,7 +60,7 @@ for row in train_test_split:
|
|
60 |
idx, train_bool = row.split(" ")
|
61 |
# 1: train, 0: test
|
62 |
if train_bool == "1":
|
63 |
-
_TRAIN_IDX_SET.add(
|
64 |
|
65 |
|
66 |
class CubDataset(datasets.GeneratorBasedBuilder):
|
|
|
34 |
row = row.decode("UTF8")
|
35 |
if row != "":
|
36 |
idx, label = row.split(" ")
|
37 |
+
_ID2LABEL[idx] = re.search("[^\d\.\_+].+", label).group(0).replace("_", " ")
|
38 |
|
39 |
logger.info(f"_ID2LABEL: {_ID2LABEL}")
|
40 |
|
|
|
48 |
row = row.decode("UTF8")
|
49 |
if row != "":
|
50 |
idx, img_name = row.split(" ")
|
51 |
+
_IMGNAME2ID[os.path.basename(img_name)] = idx
|
52 |
|
53 |
|
54 |
# Create TRAIN_IDX_SET
|
|
|
60 |
idx, train_bool = row.split(" ")
|
61 |
# 1: train, 0: test
|
62 |
if train_bool == "1":
|
63 |
+
_TRAIN_IDX_SET.add(idx)
|
64 |
|
65 |
|
66 |
class CubDataset(datasets.GeneratorBasedBuilder):
|