Skip to content

Faster ElasticTransform using separable Gaussian filters - #9578

Open
Callidior wants to merge 1 commit into
pytorch:mainfrom
Callidior:elastic-transform-separable
Open

Faster ElasticTransform using separable Gaussian filters#9578
Callidior wants to merge 1 commit into
pytorch:mainfrom
Callidior:elastic-transform-separable

Conversation

@Callidior

Copy link
Copy Markdown
Contributor

Fix

Fixes #9577 by using separable Gaussian filters for smoothing the displacement field in torchvision.transforms.v2.ElasticTransform.

Runtime Comparison of ElasticTransform.make_params

Image Size 1008 x 1008

Sigma Old Implementation New Implementation
1.0 19 ms 35 ms
3.0 28 ms 35 ms
5.0 49 ms 35 ms
8.0 96 ms 35 ms
10.0 142 ms 36 ms
20.0 575 ms 37 ms
30.0 1,210 ms 43 ms
50.0 3,310 ms 47 ms
100.0 31,900 ms 77 ms

Image Size 256 x 256

Sigma Old Implementation New Implementation
1.0 0.6 ms 0.7 ms
3.0 1.4 ms 0.7 ms
5.0 2.7 ms 0.7 ms
10.0 9 ms 1 ms
20.0 34 ms 1 ms
30.0 82 ms 1 ms
50.0 276 ms 2 ms

Tests

Larger image sizes and different variants for sigma have been added to the test test_transforms_v2.py::TestElastic::test_transform. Run with:

pytest test/test_transforms_v2.py::TestElastic::test_transform

@pytorch-bot

pytorch-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9578

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the cla signed label Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ElasticTransform is slow for larger images and/or sigma

1 participant