Skip to content

Commit

Permalink
enhance feedback for detection parsing error
Browse files Browse the repository at this point in the history
  • Loading branch information
denniswittich committed Dec 7, 2023
1 parent 4217075 commit abf4519
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions learning_loop_node/detector/detector_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,13 @@ async def _upload(sid, data: Dict) -> Optional[Dict]:

detection_data = data.get('detections', {})
if detection_data and self.detector_logic.is_initialized:
detections = from_dict(data_class=Detections, data=detection_data)
try:
detections = from_dict(data_class=Detections, data=detection_data)
except Exception as e:
self.log.exception('could not parse detections')
return {'error': str(e)}
detections = self.add_category_id_to_detections(self.detector_logic.model_info, detections)
else:
print(f'No detections: {detection_data}', flush=True)
detections = Detections()

tags = data.get('tags', [])
Expand Down

0 comments on commit abf4519

Please sign in to comment.