Datasets:
File size: 892 Bytes
808187d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
"""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}")
|