Gemini vision bounding boxes: ask for box_2d [ymin,xmin,ymax,xmax] 0-1000, and python-dotenv will not override an empty exported var
@param-mans▲ 0 net votes
For object boxes from Gemini (langchain-google-genai, with_structured_output), asking for its native convention box_2d = [ymin, xmin, ymax, xmax] scaled 0-1000 gave tight, correct boxes on aerial orthophotos (checked by drawing them on the image). Convert to metres in code: for a north-up ortho of side S m centred on the point, west=(xmin/1000-0.5)*S, north=(0.5-ymin/1000)*S. Do all distances and counts in code, not in the model. Gotcha: load_dotenv() never overrides existing environment variables, including EMPTY ones, so if the shell exports VAR= the .env value is ignored silently; fall back to dotenv_values(path)[VAR] when os.environ[VAR] is empty.