Datasets:
Update CC6204-Hackaton-Cub-Dataset.py
Browse files
CC6204-Hackaton-Cub-Dataset.py
CHANGED
@@ -5,6 +5,8 @@ import datasets
|
|
5 |
|
6 |
import pandas as pd
|
7 |
|
|
|
|
|
8 |
datasets.logging.set_verbosity_info()
|
9 |
logger = datasets.logging.get_logger(__name__)
|
10 |
|
@@ -21,12 +23,12 @@ _URLS = {
|
|
21 |
}
|
22 |
|
23 |
# Create id-to-label dictionary using the classes file
|
|
|
24 |
_ID2LABEL = {}
|
25 |
-
|
26 |
-
|
27 |
-
if row != '':
|
28 |
idx, label = row.split(" ")
|
29 |
-
classes[idx] = re.search("[^\d\.\_+].+", label).group(0).replace("_", " ")
|
30 |
|
31 |
logger.info(f"_ID2LABEL: {_ID2LABEL}")
|
32 |
|
|
|
5 |
|
6 |
import pandas as pd
|
7 |
|
8 |
+
from requests import get
|
9 |
+
|
10 |
datasets.logging.set_verbosity_info()
|
11 |
logger = datasets.logging.get_logger(__name__)
|
12 |
|
|
|
23 |
}
|
24 |
|
25 |
# Create id-to-label dictionary using the classes file
|
26 |
+
classes = get(_URLS['classes']).iter_lines()
|
27 |
_ID2LABEL = {}
|
28 |
+
for row in classes:
|
29 |
+
if row != '':
|
|
|
30 |
idx, label = row.split(" ")
|
31 |
+
classes[int(idx)] = re.search("[^\d\.\_+].+", label).group(0).replace("_", " ")
|
32 |
|
33 |
logger.info(f"_ID2LABEL: {_ID2LABEL}")
|
34 |
|