I'm trying to implement face clustering in Python. Unfortunately function dlib.chinese_whispers_clustering(descriptors,0.5) triggers a Runtime error: Unable to cast Python instance to C++ type (compile in debug mode for details). I can't get it to install in debug mode with python setup.py build --debug. It fails near the end with an error: c++: internal compiler error: Killed (program cc1plus). Although it installs fine with command python setup.py install.
Function dlib.chinese_whispers() works fine, however I don't know how to cluster faces using this function. So alternatively I'd appreciate any outline on how to cluster faces using chinese_whispers() instead of chinese_whispers_clustering(). I couldn't find any details on how the latter one works.
Cluster descriptors of faces and return list of labels of those faces. By getting the length of the labels I could find out how many faces there are in the dataset.
Triggers a runtime error Unable to cast Python instance to C++ type (compile in debug mode for details)
dlib.chinese_whispers_clustering(descriptors, 0.5).Thank you very much.
Please post a small python program that runs and illustrates the issue.
Hello, I've just sorted it out. I was converting descriptors to a numpy array, and it apparently isn't accepted by dlib. I didn't imagine that it could be a problem with the code. I was thinking only about dlib installation.
Thank you again
@maromcik, What did you do to solve this problem. I tried to converting the embeddings into a list, but the problem is not solved.
I stumbled into this aswell and solved it by printing the descriptors from the example script and noticed that they are of type dlib.vector. Converted all my python lists to dlib.vectors and now its works.
descriptor = dlib.vector([0.1, 0.2, 0.3, ...])
Most helpful comment
I stumbled into this aswell and solved it by printing the descriptors from the example script and noticed that they are of type dlib.vector. Converted all my python lists to dlib.vectors and now its works.