File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 138138Output a only JSON list of bounding boxes where each entry contains
139139the 2D bounding box in the key "box_2d",
140140and the stage name in the key "label".
141+ Include in the bounding boxes only the illustrations of the objects themselves,
142+ not any surrounding text or arrows.
141143
142144"""
143145
Original file line number Diff line number Diff line change @@ -136,8 +136,25 @@ def segment_with_boxes(
136136 )
137137 continue
138138
139- logging .pii (f"Processing bounding box for label: '{ label } '" )
140- bboxes .append (bbox )
139+ logging .pii (
140+ f"Processing bounding box for label: '{ label } ' "
141+ f"(normalized coords: { bbox } )"
142+ )
143+
144+ # Convert normalized coordinates (0-1000) received from Qwen 3
145+ # to pixel coordinates
146+ bbox_pixels = [
147+ (bbox [0 ] / 1000.0 ) * width ,
148+ (bbox [1 ] / 1000.0 ) * height ,
149+ (bbox [2 ] / 1000.0 ) * width ,
150+ (bbox [3 ] / 1000.0 ) * height
151+ ]
152+
153+ logging .pii (
154+ f"Converted to pixel coords: { bbox_pixels } "
155+ )
156+
157+ bboxes .append (bbox_pixels )
141158 labels .append (label )
142159
143160 if not bboxes :
You can’t perform that action at this time.
0 commit comments