alkzar90 commited on
Commit
808187d
1 Parent(s): 144aa7c

Create CC6204-Hackaton-Cub-Dataset.py

Browse files
Files changed (1) hide show
  1. CC6204-Hackaton-Cub-Dataset.py +32 -0
CC6204-Hackaton-Cub-Dataset.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """CC6204-Hackaton-Cub-Dataset: Multimodal"""
2
+ import os
3
+ import re
4
+ import datasets
5
+
6
+ import pandas as pd
7
+
8
+ datasets.logging.set_verbosity_info()
9
+ logger = datasets.logging.get_logger(__name__)
10
+
11
+
12
+ _REPO = "https://huggingface.co/datasets/alkzar90/CC6204-Hackaton-Cub-Dataset/resolve/main/data/"
13
+
14
+ _URLS = {
15
+ "train_test_split": f"{_REPO}/train_test_split.txt",
16
+ "classes": f"{_REPO}/classes.txt",
17
+ "image_class_labels": f"{_REPO}/image_class_labels.txt",
18
+ "images": f"{_REPO}/images.txt",
19
+ "image_url": f"{_REPO}/images.zip",
20
+ "text_url": f"{_REPO}/text.zip",
21
+ }
22
+
23
+ # Create id-to-label dictionary using the classes file
24
+ _ID2LABEL = {}
25
+ with open(_URLS["classes", "r") as f:
26
+ for row in f.read().rsplit("\n"):
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
+