Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions utils/llm/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@
Output a only JSON list of bounding boxes where each entry contains
the 2D bounding box in the key "box_2d",
and the stage name in the key "label".
Include in the bounding boxes only the illustrations of the objects themselves,
not any surrounding text or arrows.

"""

Expand Down
21 changes: 19 additions & 2 deletions utils/segmentation/sam_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,25 @@ def segment_with_boxes(
)
continue

logging.pii(f"Processing bounding box for label: '{label}'")
bboxes.append(bbox)
logging.pii(
f"Processing bounding box for label: '{label}' "
f"(normalized coords: {bbox})"
)

# Convert normalized coordinates (0-1000) received from Qwen 3
# to pixel coordinates
bbox_pixels = [
(bbox[0] / 1000.0) * width,
(bbox[1] / 1000.0) * height,
(bbox[2] / 1000.0) * width,
(bbox[3] / 1000.0) * height
]

logging.pii(
f"Converted to pixel coords: {bbox_pixels}"
)

bboxes.append(bbox_pixels)
labels.append(label)

if not bboxes:
Expand Down