Output coordinates
The script prints JSON with the raw model text, pixel boxes (boxes_xyxy_pixels) and normalized boxes (boxes_xyxy_normalized). Coordinates are ordered [x1, y1, x2, y2]. It preserves the paper's conversion heuristic: raw values exceeding 1.05 times the image's largest dimension are treated as 0–1000 coordinates; otherwise as pixels. This can be ambiguous for some image sizes and boxes.
Use
Run from this directory. The script loads the required Qwen base model and this PEFT LoRA adapter.
python -m pip install -r requirements.txtpython infer.py --image /path/to/food_crop.jpg --device cuda:0
CUDA inference uses one GPU in BF16. For CPU inference, use --device cpu (float32; more RAM required). Training photos are not included.
Project
Automating Dish-Level Annotation of Real Food-Diary Photos
License
Adapter weights and inference code: Apache-2.0. The Qwen base model is separately distributed under Apache-2.0.