object_to_pascal_voc applied the 1-index offset in place (xyxy += 1). Because Detections.__iter__ yields each row of xyxy as a view sharing memory with detections.xyxy, detections_to_pascal_voc wrote the +1 shift straight back into the caller's array. A single export shifted every box by +1px; a second export compounded it, producing wrong XML. A single export-then-reload happened to round-trip because from_pascal_voc subtracts 1, which is why no test caught it. Rebind to a new array (xyxy = xyxy + 1) instead of mutating in place. On-disk output is unchanged; the source detections are left intact. Add regression tests asserting object_to_pascal_voc does not mutate its inputs and that two consecutive exports are identical and leave xyxy unchanged. --------- Co-authored-by: jirka <6035284+Borda@users.noreply.github.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| annotators | ||
| assets | ||
| classification | ||
| dataset | ||
| detection | ||
| draw | ||
| geometry | ||
| key_points | ||
| metrics | ||
| tracker | ||
| utils | ||
| __init__.py | ||
| conftest.py | ||
| helpers.py | ||
| test_validate_deprecations.py | ||