Skip to content

Commit

Permalink
Adding notes on coordinate conversion to match main docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
data-wombat authored Jun 24, 2024
1 parent 2fcd37c commit 643a153
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion site/en/gemini-api/docs/vision.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@
"source": [
"### Get bounding boxes\n",
"\n",
"You can ask the model for the coordinates of bounding boxes for objects in images."
"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",
"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",
"1000x1000 version of the original image, and need to be converted back to the dimensions of the original image."
]
},
{
Expand All @@ -414,6 +416,17 @@
"print(response.text)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To convert these coordinates to the dimensions of the original image:\n",
"\n",
"1. Divide each output coordinate by 1000.\n",
"1. Multiply the x-coordinates by the original image width.\n",
"1. Multiply the y-coordinates by the original image height."
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down

0 comments on commit 643a153

Please sign in to comment.