vision
vision copied to clipboard
[feature request] Connected components labeling / detection (batched, on GPU) and some morphological operations in general
🚀 The feature
Some useful morphological operations would be nice to have in the core (and on CUDA):
- Connected components labeling (hard to do with existing primitives): skimage.measure.label, pytorch cuda impl: https://github.com/zsef123/Connected_components_PyTorch
- Labeled component areas (related to batched bincount/histc)
- Batched retrieval of unique labels count
- Dilation / erosion (can be modeled with max/min pooling)
Motivation, pitch
N/A
Alternatives
No response
Additional context
No response
Hi @vadimkantorov I guess kornia has these applications. https://kornia.readthedocs.io/en/latest/morphology.html
Just for my knowledge, How does this fit into torchvision's perspective? If yes, then how should these be added?
For connected components labeling, kornia contrib solution works by running max pooling 100 times (this number depends on the size of the largest component) which works as a simple solution for small inputs but is inefficient for larger inputs / in general.
About general torchvision's perspective and how image processing stuff fits in, I personally have no insights :)