Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding notes on coordinate conversion to match main docs. #471

Merged
merged 2 commits into from
Jun 24, 2024
Merged
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
17 changes: 16 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,19 @@
"print(response.text)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "b8e422c55df2"
},
"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
Loading