Project-MONAI / MONAI

AI Toolkit for Healthcare Imaging
https://monai.io/
Apache License 2.0
5.69k stars 1.04k forks source link

Implementing Haar-Like 2D/3D Hand-crafted Features in MONAI #3709

Open masadcv opened 2 years ago

masadcv commented 2 years ago

Is your feature request related to a problem? Please describe. Sometimes machine learning problems require usage of hand-crafted features instead of learning these within the network. This may be due to data constraints or cases where learning features may lead to degrading performance. Haar-Like features are one such category of hand-crafted features which have been widely used for object detection, e.g. face detection, organ detection/localization.

Describe the solution you'd like An implementation of 2D and 3D Haar-Like features in PyTorch has been recently implementation that utilizes convolution layers within PyTorch to extract these hand-crafted features: https://github.com/masadcv/PyTorchHaarFeatures Integrating these within MONAI will ensure wider applicability of this in other networks/techniques

Describe alternatives you've considered Using the library directly (https://github.com/masadcv/PyTorchHaarFeatures) as additional install on top of MONAI

I can help draft a PR in coming days to add support for this in MONAI.

Nic-Ma commented 2 years ago

Hi @ericspod @wyli ,

Could you please help share some comments from medical AI experts' perspective?

Thanks in advance.

masadcv commented 2 years ago

To add a bit more context, we have a few online learning methods that utilize these hand-crafted features in our work (https://arxiv.org/pdf/2201.04584.pdf). We think this kind of feature maybe best supported through MONAI for these methods as well as any future variations that use these.

tvercaut commented 2 years ago

Are the results expected to be the same as with scikit-image? https://scikit-image.org/docs/stable/api/skimage.feature.html#skimage.feature.haar_like_feature

If so, it would be nice to have a unit test for this. If not, I think it would be worth explaining why it's different.

Note that the example could mimick the scikit-image one (but using a NN instead of a RF classifier to be more pytorch friendly): https://scikit-image.org/docs/dev/auto_examples/applications/plot_haar_extraction_selection_classification.html

masadcv commented 2 years ago

Hi @tvercaut So currently there are more "types" of Haar features that are in repository (https://github.com/masadcv/PyTorchHaarFeatures/blob/f22af6744e6c474210e2d2ef3c8269cb4ece120f/pt_haarfeatures/haarfeatures.py#L302) than the original paper. I can certainly look into figuring out if we can have a version that is testable against scikit's implementation.

In addition to the above, we have 3D Haar features.

Thanks for the example, would be nice to show that in tutorials once this is added to MONAI.

ericspod commented 2 years ago

This isn't something I've used before or looked into. From an initial investigation this does look useful for object detection and related tasks which is an area we do want to support. I can't really say much more since it's not my area, but if you wanted to contribute this implementation in a PR with some example practical usage we can get some feedback hopefully from those in the same field.