alexrods commited on
Commit
5953923
1 Parent(s): 737a44e

Update mini_car_bikes_detection.py

Browse files
Files changed (1) hide show
  1. mini_car_bikes_detection.py +4 -4
mini_car_bikes_detection.py CHANGED
@@ -1,6 +1,4 @@
1
- from PIL import Image
2
- import numpy as np
3
-
4
  import json
5
  import os
6
 
@@ -42,6 +40,7 @@ class MiniCarBikesDetection(datasets.GeneratorBasedBuilder):
42
  "height": datasets.Value("int32"),
43
  "objects": datasets.Sequence(
44
  {
 
45
  "bbox": datasets.Sequence(datasets.Value("float32"), length=4),
46
  "category": datasets.ClassLabel(names=_CATEGORIES),
47
  }
@@ -85,7 +84,8 @@ class MiniCarBikesDetection(datasets.GeneratorBasedBuilder):
85
  }
86
  with open(annotations_file) as jf:
87
  annotations = json.load(jf)
88
- category_id_to_category = {1: categoty["name"] if categoty["name"] == "Car" else 2 for category in annotations["name"]}
 
89
  image_id_to_annotations = collections.defaultdict(list)
90
  for image_file in image_files:
91
  image_name = image_file[0].split("/")[1]
 
1
+ import collections
 
 
2
  import json
3
  import os
4
 
 
40
  "height": datasets.Value("int32"),
41
  "objects": datasets.Sequence(
42
  {
43
+ "id": datasets.Value("int32"),
44
  "bbox": datasets.Sequence(datasets.Value("float32"), length=4),
45
  "category": datasets.ClassLabel(names=_CATEGORIES),
46
  }
 
84
  }
85
  with open(annotations_file) as jf:
86
  annotations = json.load(jf)
87
+ labels = {"id":1, "name":'Car'}, {"id":2, "name":'bike'}
88
+ category_id_to_category = {category["id"]: category["name"] for category in annotations["name"]}
89
  image_id_to_annotations = collections.defaultdict(list)
90
  for image_file in image_files:
91
  image_name = image_file[0].split("/")[1]