Repository navigation
Resize the object feature embeddings with torch to optimize feature computation time - #1392
Merged
anwai98 merged 2 commits intoOct 19, 2026
Conversation
'skimage.transform.resize' took 94% of the object feature time: about 0.5 s per tile, so 8 s for a 2048 px field with the default tiling. 'torch.nn.functional.interpolate' takes about 0.01 s per tile. The values match, except in the 2 px edge of the resized embedding, where torch repeats the edge pixel and skimage mirrors it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
|
Thanks @titusgriebel. I'll check this later today too (could also port this to |
constantinpape
approved these changes
Oct 16, 2026
constantinpape
left a comment
Contributor
There was a problem hiding this comment.
Makes sense from my end. @anwai98 feel free to merge later. We can use torch; as long as the results are numerically the same (2 px edge artifacts don't matter) . We don't need to check for alternatives.
anwai98
approved these changes
Oct 19, 2026
anwai98
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the PR @titusgriebel. Looks good to me and CP. I"ll go ahead and merge this once the CIs pass!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@anwai98
Motivation: In a scenario where a user wants to locally annotate a series of images using object classification, object features are not cached right now between sessions. This means that if the annotation process is split into several portions, significant waiting times occur, especially in data with larger object counts.
'skimage.transform.resize' took 94% of the object feature computation time: about 0.5 s per tile, so 8 s for a 2048 px field with the default tiling. 'torch.nn.functional.interpolate' takes about 0.01 s per tile. The values match, except in the 2 px edge of the resized embedding, where torch repeats the edge pixel and skimage mirrors it.
Thus, even without feature caching, recomputing features would become much less of a burden.