Closed programatix closed 3 years ago
@programatix Did you use Cnn model in multi thread?
Cnn model does not support in multi thread. Please check this comment. https://github.com/takuya-takeuchi/FaceRecognitionDotNet/issues/24#issuecomment-458744002
I'm using AForge.Video to capture image, so the event CameraNewFrame
is running on a different thread from the UI thread. So I tried running it in the main thread by doing something like this as below and it still crashed with the same exception.
if (mut.WaitOne(0))
{
Application.Current.Dispatcher.Invoke(()=>
{
try
{
_FaceRecognition.FaceLocations(FaceImage, 0, Model.Cnn).ToArray();
}
finally
{
mut.ReleaseMutex();
}
}
}
The link you provided seems to indicate that it would crash if multiple thread running it at the same time. In the case above, I already placed a mutex to avoid that.
I tried putting it in Loaded
event of a Window and it crashed too. Does this mean that it cannot be used inside WPF window? It runs fine in WPF Application_Startup
event.
[update]
I created a new project file and test it. It runs fine. It can already runs inside a Task
. However, in my main project, it crashed. I tried removing some threads and I am able to get it to run without crashing. I'm still looking at it. Most of the threads are doing things such as discovering hardware (smartcard readers, fingerprint readers, iris camera and etc) and doesn't involve FaceRecognition. So, I'm stumped.
Hi,
Following FaceDetection example project, I am able to call
FaceLocations
withModel.Hog
. However when I triedModel.Cnn
, I get the following exception,I'm using the models found in https://github.com/ageitgey/face_recognition_models/. Am I missing any components?