0

I am trying to write a face verification API in python. For image detection and calculating the embeddings, I have used InsightFace package provided by http://insightface.ai/. But for specific images (images having no face, more than one face and HQ images) it is giving some exception -

libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument
Abort trap: 6

and program (webserver) gets aborted.

As I can debug is that, this exception is coming from model.get() function (its syntax can be found at above link). Now two things -

1) How to handle this exception in my python program, so that I can prevent my server from getting stopped?

2) Also, in case someone suggests how to avoid this error, it will also be great.

Looking forward to this.

user3457384
  • 593
  • 6
  • 14
  • Are you writing your own Python package in C++ or are you using some existing Python bindings? – Michael Kenzel Dec 11 '19 at 11:31
  • Python and C++ have separate exception handling. A C++ exception should not fall into the Python interpreter. The Python interpreter (at least the one I embedded into our software) is written in C and very probably not prepared for C++ exception handling. Hence, the Python C functions are unwound leaving the Python interpreter in an undeterminate state. If the C++ library (which is called out of Python) is not yours I would contact the author. To me it looks like something has been overseen in this code. – Scheff's Cat Dec 11 '19 at 11:46
  • @MichaelKenzel, I am using an existing Python Package named insightface. – user3457384 Dec 11 '19 at 12:32
  • File a bug with these people. This looks like a programming error. – Botje Dec 11 '19 at 12:42
  • Ok, in this case, like @Scheff said, this would seem to be an issue with the implementation of this library. Unless you can modify the source code and build your own version, there's nothing you can do really besides filing a bug… – Michael Kenzel Dec 11 '19 at 12:43
  • Yes, I was also thinking on the same lines. But I have found a solution for this. Actually, this problem is not coming in newer version of mxnet. Earlier I was using mxnet==1.3.0 and now I am using mxnet-mkl==1.6.0 . It might be helpful for others, who might want to use the above stack to build the face verfication algorithm. – user3457384 Dec 11 '19 at 14:13

0 Answers0