Transformations. How do I keep it synchronized with target if target is a pixel coordinate in the image?

I create a neural network, which should search the image for objects (faces away from the camera). In fact I need 4 coordinates, for the example I attach the image in which these coordinates are marked. There is a good set of transformers in pytorch, but the problem is that if the transformation is related to image distortion, you need to change the target respectively, otherwise the coordinates will not coincide with the desired points. What is the best way to do this? Maybe PyTorch already has tools implemented for such purposes?
This is what the target looks like for the image below - it is a set of coordinates

[[1253  368]
 [1251  589]
 [1386  579]
 [1368  800]]

Translated with (free version)

you can use :

1 Like

Thank you. That’s almost what I need, except for one thing. It doesn’t have elastic transformations, which are usually the most needed. More precisely, they are present as an option, but do not support points. Perhaps you know a package which implements this feature with point support?

i don’t know .
maybe you can find a solution here or in this code .
Also, elastic transform doesn’t change pixel locality by much, so maybe you can use original key points.