EnoxSoftware / OpenCVForUnity

OpenCV for Unity (Untiy Asset Plugin)
https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088
557 stars 175 forks source link

Error on FaceDetectorYN.create() in UWP / Face Detection Performance Doubt #163

Closed andresilmor closed 1 year ago

andresilmor commented 1 year ago

Greetings, I'm trying to use the FaceDetectorYN to analyse frames (from the Windows API) on a UWP application, more precisely, on a HoloLens 2 application, I already confirmed that the logic does work on "no-UWP" applications, and the error happens on the "FaceDetectorYN.create()" moment, he also detects the ONNX model as it should be (in "StreamingAssets/..."), so im really lost.

Since I have to build the application to test, the best "error identification" that i got using try... catch... was the following: "An error occured on the C++ side, causing the class initialization to fail. Enclose the point where the error occurs in Utils.setDebugModel() method, and the error on the C++ side will be displayed on the console." I dont see how i can use that method since the code that gives the error is from the asset, and even then i am unable to "see" the console :/

Just to note, the detection with HAARS and LPB works perfectly, I did not tried the others like ResnetSSD.

Taking the opportunity, Im kinda "noob" on this field, for simple face detection on a "mobile" device which of the models/examples provided in the asset would be best on speed/low resources consumption? With LPB the app kinda shutdown after some time, and since that example have HAARS on a secondary thread "with a sleep" I took it as signal that is also not what im looking for 😆, as far i can understand my other best option was using the DNN Module (LibFaceDetectionV3Example), but UWP does not support based on what i read on older issues, so i was thinking on using YuNet.

Thanks in advance for your attention.

EnoxSoftware commented 1 year ago

Thank you for your inquiry.

FaceDetectorYN uses the Dnn module internally and is not supported on UWP platforms. https://github.com/opencv/opencv/blob/4.x/modules/objdetect/src/face_detect.cpp#L290-L295