Skip to content

Commit f96ca7a

Browse files
Adding notes on coordinate conversion to match main docs. (#471)
* Adding notes on coordinate conversion to match main docs. * format --------- Co-authored-by: Mark Daoust <[email protected]>
1 parent fe17edb commit f96ca7a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

site/en/gemini-api/docs/vision.ipynb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,9 @@
394394
"source": [
395395
"### Get bounding boxes\n",
396396
"\n",
397-
"You can ask the model for the coordinates of bounding boxes for objects in images."
397+
"You can ask the model for the coordinates of bounding boxes for objects in images. For object detection, the Gemini model has been trained to provide\n",
398+
"these coordinates as relative widths or heights in range `[0,1]`, scaled by 1000 and converted to an integer. Effectively, the coordinates given are for a\n",
399+
"1000x1000 version of the original image, and need to be converted back to the dimensions of the original image."
398400
]
399401
},
400402
{
@@ -414,6 +416,19 @@
414416
"print(response.text)"
415417
]
416418
},
419+
{
420+
"cell_type": "markdown",
421+
"metadata": {
422+
"id": "b8e422c55df2"
423+
},
424+
"source": [
425+
"To convert these coordinates to the dimensions of the original image:\n",
426+
"\n",
427+
"1. Divide each output coordinate by 1000.\n",
428+
"1. Multiply the x-coordinates by the original image width.\n",
429+
"1. Multiply the y-coordinates by the original image height."
430+
]
431+
},
417432
{
418433
"cell_type": "markdown",
419434
"metadata": {

0 commit comments

Comments
 (0)