David Ko commited on
Commit
efeb7fa
·
1 Parent(s): e95c1b8

Fix: Serialize bbox dict as JSON string for ChromaDB metadata

Browse files
Files changed (1) hide show
  1. api.py +9 -6
api.py CHANGED
@@ -703,16 +703,19 @@ def add_detected_objects():
703
  continue
704
 
705
  # 메타데이터 구성
 
 
 
 
 
 
 
 
706
  metadata = {
707
  "image_id": image_id,
708
  "class": obj.get('class', ''),
709
  "confidence": obj.get('confidence', 0),
710
- "bbox": {
711
- "x": x1,
712
- "y": y1,
713
- "width": width,
714
- "height": height
715
- }
716
  }
717
 
718
  object_ids.append(object_id)
 
703
  continue
704
 
705
  # 메타데이터 구성
706
+ # bbox를 JSON 문자열로 직렬화하여 ChromaDB 메타데이터 제한 우회
707
+ bbox_json = json.dumps({
708
+ "x": x1,
709
+ "y": y1,
710
+ "width": width,
711
+ "height": height
712
+ })
713
+
714
  metadata = {
715
  "image_id": image_id,
716
  "class": obj.get('class', ''),
717
  "confidence": obj.get('confidence', 0),
718
+ "bbox": bbox_json # JSON 문자열로 저장
 
 
 
 
 
719
  }
720
 
721
  object_ids.append(object_id)