The common reason is that the post-processing forgets to subtract the supplementary edges. When adjusting YOLO on the Rockchip board, the original image size, scaled size and actual four-sided padding should be recorded at the same time. Model input size alone cannot restore all transformations.
Calculate a center point by hand
Scale 1280×720 to 640×640, the scaling factor is 0.5, and the effective picture is 640×360. If you want to pad the edges in the center, add 140 pixels to the top and bottom. The point (320,320) in the network input returns to (640,360) in the original image. The vertical coordinate must first be reduced by 140 and then divided by 0.5.
Processing the rounding of real images
If the new size is an odd number, the top and bottom or left and right supplementary edges may differ by one pixel. The left and upper offsets and effective width and height actually used in preprocessing are retained and reused during inverse transformation. To stretch to a fixed width and height, use the horizontal and vertical scaling ratios respectively.
Select samples where errors can be seen
Use a mark near the upper left corner and a mark near the bottom for regression, and test both horizontal and vertical screens at the same time. If the center box seems correct but the edge error increases, check the coordinate units, width and height order, and the timing of cropping to the image boundary.
Restore the two coordinates in the example
| Model input coordinates | Original image coordinates | meaning |
|---|---|---|
| 320 × 320 | 640 × 360 | Screen center |
| 0 × 140 | 0 × 0 | Upper left corner of effective screen |
| 0 × 0 | falls in the supplementary area | cannot be directly used as the upper left corner of the target |
Board documentation and references

- ArmSoM Sige7 · hardware and interface manual · Sige7 · product page
- Rockchip RKNN Model Zoo
- Rockchip librga interface and constraints
