face_dlib.py error after upgrading to Fedora 40

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
kenworth
Posts: 54
Joined: Tue Feb 11, 2014 1:04 pm

face_dlib.py error after upgrading to Fedora 40

Post by kenworth »

I recently upgraded my server to Fedora 40 which also updated Python to 3.12 making it necessary to reinstall all of the packages necessary for ZMES to function. Everything is now working normally except for face recognition which throws the following error:

zmesdetect[1247004] ERR face_dlib.py:110 [Error loading KNN model: Can't get attribute 'EuclideanDistance' on <module 'sklearn.metrics._dist_metrics' from '/usr/local/lib64/python3.12/site-packages/sklearn/metrics/_dist_metrics.cpython-312-x86_64-linux-gnu.so'>]

I have done some research on this issue and it appears that versions of sklearn 1.3.0 and greater have changed the EuclideanDistance attribute names. The latest version of sklearn is 1.5.0 which is what I have installed. What I can't find is where this attribute is referenced in the code.

If anyone has seen this problem or has any suggestions please respond. Thanks!
kenworth
Posts: 54
Joined: Tue Feb 11, 2014 1:04 pm

Re: face_dlib.py error after upgrading to Fedora 40

Post by kenworth »

I figured this out. The error was happening when face_dlib.py was trying to load the file /var/lib/zmeventnotification/known_faces/faces.dat into a KNN object. Since the structure of this object class changed in later versions of sklearn, I needed to rerun /var/lib/zmeventnotification/bin/zm_train_faces.py to update the structure of the faces.dat file.

This resolved the error.
eckerc
Posts: 1
Joined: Wed Jul 10, 2024 3:43 pm

Re: face_dlib.py error after upgrading to Fedora 40

Post by eckerc »

That's good news!snake game Can I send private message for you, I have some problems that involves it and I hope to receive some advices from you!
Post Reply