This is a small utility library to create random large deformations in tensorflow. It is mainly intended for data-augmentation.
Example of deforming the "face" image. The size (distance travelled) of the deformation is approximately 100 pixels with a correlation length of 100 pixels.
# Generate a deformation field
offset = tfdeform.create_deformation_momentum(
shape=[1, *shape], std=100.0, distance=100.0)
# Apply the deformation field to an image
face_deform = tfdeform.dense_image_warp(face, offset)
Input image | Deformed image |
---|---|
The implementation is done using the geodesic shooting method, which should guarantee that the generated deformation is a diffeomorphism. Everything runs in tensorflow so it should be reasonably fast. Batch computation is supported.