Skip to main content
← Lab

kpflip

confirmedupstream bugPython · torchvisionSystems & data structuresJuly 25, 2026

the question

Do torchvision transforms.v2 flip keypoints about the same frame as boxes, affine, and rotate?

what came out

torchvision's `transforms.v2` flips keypoints about `W-1`/`H-1` while boxes flip about `W`/`H` and affine/rotate reflect about the continuous centre. So a hflipped keypoint lands one pixel off its content and off its box corner, and `rotate(180)` != `hflip` then `vflip` for keypoints (holds for boxes). Fix: reflect about `W` and `H`.

method & receipts

  • Result: confirmed
  • Reproducible one script re-runs the whole thing from scratch.
  • Tested — a correctness/benchmark suite ships alongside the code.

→ read the code and re-run it

github.com/v-code01/kpflip