vision icon indicating copy to clipboard operation
vision copied to clipboard

[feature request] Connected components labeling / detection (batched, on GPU) and some morphological operations in general

Open vadimkantorov opened this issue 3 years ago • 2 comments

🚀 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

vadimkantorov avatar Dec 08 '21 15:12 vadimkantorov

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?

oke-aditya avatar Dec 09 '21 10:12 oke-aditya

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 :)

vadimkantorov avatar Dec 09 '21 11:12 vadimkantorov