Datasets:
"""CC6204-Hackaton-Cub-Dataset: Multimodal""" | |
import os | |
import re | |
import datasets | |
import pandas as pd | |
datasets.logging.set_verbosity_info() | |
logger = datasets.logging.get_logger(__name__) | |
_REPO = "https://huggingface.co/datasets/alkzar90/CC6204-Hackaton-Cub-Dataset/resolve/main/data/" | |
_URLS = { | |
"train_test_split": f"{_REPO}/train_test_split.txt", | |
"classes": f"{_REPO}/classes.txt", | |
"image_class_labels": f"{_REPO}/image_class_labels.txt", | |
"images": f"{_REPO}/images.txt", | |
"image_url": f"{_REPO}/images.zip", | |
"text_url": f"{_REPO}/text.zip", | |
} | |
# Create id-to-label dictionary using the classes file | |
_ID2LABEL = {} | |
with open(_URLS["classes", "r") as f: | |
for row in f.read().rsplit("\n"): | |
if row != '': | |
idx, label = row.split(" ") | |
classes[idx] = re.search("[^\d\.\_+].+", label).group(0).replace("_", " ") | |
logger.info(f"_ID2LABEL: {_ID2LABEL}") | |