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

username: ll2pakll
cooked: <p>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?<br>
This is what the target looks like for the image below - it is a set of coordinates</p>
<pre><code class="lang-auto">[[1253  368]
 [1251  589]
 [1386  579]
 [1368  800]]
</code></pre>
<p>Translated with <a href="http://www.DeepL.com/Translator" class="inline-onebox" rel="noopener nofollow ugc">DeepL Translate: The world's most accurate translator</a> (free version)<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/a/4/a42479de600cfeea600338e2c44220885e23a8df.png" data-download-href="https://discuss.pytorch.org/uploads/default/a42479de600cfeea600338e2c44220885e23a8df" title="Снимок экрана 2021-12-09 080614"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/a/4/a42479de600cfeea600338e2c44220885e23a8df_2_690x391.png" alt="Снимок экрана 2021-12-09 080614" data-base62-sha1="nq4sbYGf3glZS555tGzOzexGuYv" width="690" height="391" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/a/4/a42479de600cfeea600338e2c44220885e23a8df_2_690x391.png, https://discuss.pytorch.org/uploads/default/original/3X/a/4/a42479de600cfeea600338e2c44220885e23a8df.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/a/4/a42479de600cfeea600338e2c44220885e23a8df.png 2x" data-dominant-color="1C3C5E"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Снимок экрана 2021-12-09 080614</span><span class="informations">720×408 321 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

username: mMagmer
cooked: <p>you can use :</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://albumentations.ai/docs/examples/example_keypoints/">
  <header class="source">
      <img src="https://albumentations.ai/docs/examples/example_keypoints/../../images/logo.png" class="site-icon" width="190" height="182">

      <a href="https://albumentations.ai/docs/examples/example_keypoints/" target="_blank" rel="noopener nofollow ugc">albumentations.ai</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/309;"><img src="https://albumentations.ai/docs/images/albumentations_card.png" class="thumbnail" width="690" height="309"></div>

<h3><a href="https://albumentations.ai/docs/examples/example_keypoints/" target="_blank" rel="noopener nofollow ugc">Albumentations Documentation - Using Albumentations to augment keypoints</a></h3>

  <p>Albumentations: fast and flexible image augmentations</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>


username: ll2pakll
cooked: <p>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?</p>

username: mMagmer
cooked: <p>i don’t know .<br>
maybe you can find a solution <a href="https://github.com/MIPT-Oulu/solt/issues/11" rel="noopener nofollow ugc">here</a> or in this <a href="https://github.com/uoip/transforms/blob/master/transforms.py#L1004-L1054" rel="noopener nofollow ugc">code</a> .<br>
Also, elastic transform doesn’t change pixel locality by much, so maybe you can use original key points.</p>