alexrods commited on
Commit
25ae286
1 Parent(s): 0edb31a

Update mini_car_bikes_detection.py

Browse files
Files changed (1) hide show
  1. mini_car_bikes_detection.py +0 -17
mini_car_bikes_detection.py CHANGED
@@ -77,29 +77,12 @@ class MiniCarBikesDetection(datasets.GeneratorBasedBuilder):
77
  ]
78
 
79
  def _generate_examples(self, image_files, annotations_file):
80
- # def process_annot(annot, category_id_to_category):
81
- # labels = {}
82
- # return{
83
- # "bbox": annot["bbox"],
84
- # "category": category_id_to_category[annot["name"]],
85
- # }
86
  with open(annotations_file) as jf:
87
  annotations = json.load(jf)
88
- # labels = {"id":1, "name":'Car'}, {"id":2, "name":'bike'}
89
- # category_id_to_category = {category["id"]: category["name"] for category in annotations["name"]}
90
- # image_id_to_annotations = collections.defaultdict(list)
91
- # id = []
92
  for image_file in image_files:
93
- # objects = {
94
- # # "id": [],
95
- # "category": [],
96
- # "bbox": [],
97
- # }
98
  image_name = image_file[0].split("/")[1]
99
  for annotation in annotations:
100
  if image_name == annotation["image"]:
101
- # objects["category"].append(annotation["name"])
102
- # objects["bbox"].append(float(n) for n in annotation["bbox"])
103
  yield image_file, {
104
  "image": {"path": image_file[0], "bytes": image_file[1].read()},
105
  "image_name": image_name,
 
77
  ]
78
 
79
  def _generate_examples(self, image_files, annotations_file):
 
 
 
 
 
 
80
  with open(annotations_file) as jf:
81
  annotations = json.load(jf)
 
 
 
 
82
  for image_file in image_files:
 
 
 
 
 
83
  image_name = image_file[0].split("/")[1]
84
  for annotation in annotations:
85
  if image_name == annotation["image"]:
 
 
86
  yield image_file, {
87
  "image": {"path": image_file[0], "bytes": image_file[1].read()},
88
  "image_name": image_name,