opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.43k stars 5.76k forks source link

CUDA CascadeClassifier no longer available #2048

Closed xsacha closed 4 years ago

xsacha commented 5 years ago

This PR (https://github.com/opencv/opencv_contrib/pull/1889) removed objdetect related classes such as cv::cuda::CascadeClassifier. For me, the best part about OpenCV (recently moved to contrib).

The pull request states it is obsolete. If so, what is the replacement? I have not seen anything similar. Please do not suggest DNN as it is far slower and not equivalent at all.

I am still unable to use OpenCV 4.X due to this PR.

Ayke commented 5 years ago

+1. Does anyone know any workaround for this?

xsacha commented 5 years ago

Does not look like they care about CUDA support anymore. You will have to move on I feel. I already have.

Ayke commented 5 years ago

Does not look like they care about CUDA support anymore. You will have to move on I feel. I already have.

Me too. Have installed OpenCV 3.4, it works fine with CUDA 10.0.

c-x-berger commented 5 years ago

Yikes. Can confirm this is still the case for... some reason.

Why this was removed I have no idea, since the PR is nondescript about it. If @alalek would be more specific about what was legacy needing removal I'd happily try to patch, but the removed stuff doesn't mention cvLoad, which was apparently what was supposed to be removed? Is Open CV dropping Cascade Classifiers entirely going forward? What's the deal?

You could maybe get away with using the HOG detector? That's still included in 4.1.0. But seeing as the DNN module is slow for you I'm guessing the same applies. (Also, the CUDA HOG detectMultiScale needs a CV_WRAP, so it's not available from Python.)

06needhamt commented 5 years ago

Are the CPU bound cascade classifiers going to be dropped eventually, as I am planning on using them in the near future?

xsacha commented 5 years ago

Probably not as it is easier to maintain

06needhamt commented 5 years ago

Are there any plans to re-add the CUDA classifiers with the new APIs?

alalek commented 5 years ago

There are no resources planned for that. Feel free to prepare patch with migration of disabled code from removed legacy API and validate proposed changes.

Raffaello commented 4 years ago

@alalek shouldn't be deprecated and replace with the new one before disabling it?

xsacha commented 4 years ago

There is no new one unless someone added one recently

nosajthenitram commented 4 years ago

I know this thread is dated at bit at this time, but I've started the effort of getting openCV 4.3.0 to work with cuda cascade classifiers. I have it functioning against simple classifiers, so there's still a little more work to do. I'll push this up to a branch on my work when it's in better shape.

06needhamt commented 4 years ago

Sounds great. Keep us updated on your progress. As I am keen to upgrade to OpenCV 4 but not having CUDA accelerated classifiers is a key blocker.

nosajthenitram commented 4 years ago

I've pushed up my first branch with the fix for CUDA cascade classifiers in OpenCV4.x.

https://github.com/nosajthenitram/opencv_contrib/tree/2048_cuda_cascade_no_longer_available

nosajthenitram commented 4 years ago

@alalek Who maintains the xml parser for the persistence module? I've got some questions regarding the cuda cascade classifier xml and how it's consumed. I'm not an xml expert, so I'm not sure what this should look like as it's represented in the file nodes.