Murad Mebrahtu commited on
Commit
04db8c1
·
1 Parent(s): 931988f

updated loading script

Browse files
Files changed (1) hide show
  1. EMT.py +15 -1
EMT.py CHANGED
@@ -29,6 +29,20 @@ _IMAGE_ARCHIVE_URL = "https://huggingface.co/datasets/KuAvLab/EMT/blob/main/emt_
29
  # Annotations URL (organized in train/test subfolders)
30
  _ANNOTATION_REPO = "https://huggingface.co/datasets/Murdism/EMT/resolve/main/annotations"
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  class EMT(datasets.GeneratorBasedBuilder):
34
  """EMT dataset."""
@@ -91,7 +105,7 @@ class EMT(datasets.GeneratorBasedBuilder):
91
  parts = line.strip().split()
92
  frame_id, track_id, class_name = parts[:3]
93
  bbox = list(map(float, parts[4:8])) # Extract bounding box
94
- class_id = hash(class_name) % 1000 # Convert class_name to numeric ID
95
 
96
  img_path = f"{frame_id}.jpg"
97
  if img_path not in annotations:
 
29
  # Annotations URL (organized in train/test subfolders)
30
  _ANNOTATION_REPO = "https://huggingface.co/datasets/Murdism/EMT/resolve/main/annotations"
31
 
32
+ _GT_OBJECT_CLASSES = {
33
+ 0: "Pedestrian",
34
+ 1: "Cyclist",
35
+ 2: "Motorbike",
36
+ 3: "Small_motorised_vehicle",
37
+ 4: "Car",
38
+ 5: "Medium_vehicle",
39
+ 6: "Large_vehicle",
40
+ 7: "Bus",
41
+ 8: "Emergency_vehicle",
42
+ }
43
+
44
+ # Update: Consider using a predefined set of object classes for easier filtering
45
+ OBJECT_CLASSES = {v: k for k, v in _GT_OBJECT_CLASSES.items()}
46
 
47
  class EMT(datasets.GeneratorBasedBuilder):
48
  """EMT dataset."""
 
105
  parts = line.strip().split()
106
  frame_id, track_id, class_name = parts[:3]
107
  bbox = list(map(float, parts[4:8])) # Extract bounding box
108
+ class_id = _GT_OBJECT_CLASSES.get(class_name, -1) # Convert class_name to numeric ID, default to -1 if not found
109
 
110
  img_path = f"{frame_id}.jpg"
111
  if img_path not in annotations: