Skip to content

Commit 3ab2d10

Browse files
Merge pull request #961 from roboflow/fix-google-vision-block-bbox-parsing
Fix Google Vision Block bounding box parsing
2 parents 6b987a7 + d48005a commit 3ab2d10

File tree

1 file changed

+4
-4
lines changed
  • inference/core/workflows/core_steps/models/foundation/google_vision_ocr

1 file changed

+4
-4
lines changed

inference/core/workflows/core_steps/models/foundation/google_vision_ocr/v1.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ def run(
162162
for block in page["blocks"]:
163163
# Get bounding box coordinates
164164
box = block["boundingBox"]["vertices"]
165-
x_min = min(v["x"] for v in box)
166-
y_min = min(v["y"] for v in box)
167-
x_max = max(v["x"] for v in box)
168-
y_max = max(v["y"] for v in box)
165+
x_min = min(v.get("x", 0) for v in box)
166+
y_min = min(v.get("y", 0) for v in box)
167+
x_max = max(v.get("x", 0) for v in box)
168+
y_max = max(v.get("y", 0) for v in box)
169169
xyxy.append([x_min, y_min, x_max, y_max])
170170

171171
# Only DOCUMENT_TEXT_DETECTION provides confidence score, use 1.0 otherwise

0 commit comments

Comments
 (0)