SIA86 commited on
Commit
5827598
·
1 Parent(s): 7f4693c

Update WaterFlowCountersRecognition.py

Browse files
Files changed (1) hide show
  1. WaterFlowCountersRecognition.py +6 -3
WaterFlowCountersRecognition.py CHANGED
@@ -126,6 +126,7 @@ class WaterFlowCounter(datasets.GeneratorBasedBuilder):
126
  all_x = []
127
  all_y = []
128
  names = []
 
129
 
130
  for el in annotations['_via_img_metadata']:
131
 
@@ -134,11 +135,13 @@ class WaterFlowCounter(datasets.GeneratorBasedBuilder):
134
  for region in annotations['_via_img_metadata'][el]['regions']:
135
  all_x.append(region['shape_attributes']['all_points_x'])
136
  all_y.append(region['shape_attributes']['all_points_y'])
137
- names.append(name_to_id[list(region['region_attributes']['name'].keys())[0]])
 
138
  try:
139
- rotated = [rotation_to_id[list(region['region_attributes']['rotated'].keys())[0]]]
 
140
  except:
141
- rotated = [int(region['region_attributes']['rotated'])]
142
 
143
 
144
  yield idx, {
 
126
  all_x = []
127
  all_y = []
128
  names = []
129
+ rotated = []
130
 
131
  for el in annotations['_via_img_metadata']:
132
 
 
135
  for region in annotations['_via_img_metadata'][el]['regions']:
136
  all_x.append(region['shape_attributes']['all_points_x'])
137
  all_y.append(region['shape_attributes']['all_points_y'])
138
+ for name in list(region['region_attributes']['name'].keys()):
139
+ names.append(name_to_id(name))
140
  try:
141
+ for rot in list(region['region_attributes']['rotated'].keys()):
142
+ rotated.append(rotation_to_id(rot))
143
  except:
144
+ rotated.append(int(region['region_attributes']['rotated']))
145
 
146
 
147
  yield idx, {