Home Community Blog Buy Now

Misty Community Forum

Face Recognition using Python

Hello to everybody,
I am working with Python and I want to use the face recognition. If I use this code

while True:
    data = mia.faceRec()
    name      = data["personName"]  
    distance  = data["distance"]    # units in mm
    elevation = data["elevation"]

the printed data are always “{‘status’: ‘Not_Subscribed or just waiting for data’}” even if the face Recognition seems to start.
Any suggestion on how i can fix this problem?

can you give more detail about the implementation of mia.subscribe() and mia.faceRec() ?

mia.subscribe () and mia.faceRec() are defined inside the class Robot of mistyPy, the Python library to work with Misty robot.
I attach you the GitHub link where you can find the code that I wrote in the previous message.

I tried also the time_of_flight function and it works very well but for the face recognition the problem still the same.

did you already train it for faces (example code in the README)?

Yes, I did.

Today I was able to learn and recognize faces using my own Python code, but I have not tried https://github.com/MistyCommunity/Wrapper-Python yet.

My goal is to create a demo for you later today, to give you a working example that you run remotely on the Misty robot at sandbox - rerobots

many thanks!!

I saw the code that you shared with me and basically it is what I did.
The problem is that the information I need with the face recognition regards the distance, and I think that the only way to obtain this information is using Misty Python library.

From offboard the robot, you can get this information via WebSocket messages of type FaceRecognition. In other words, you do not need to use that Python library.

Can you tell me again precisely what is needed? You want a working example?

@s1090921 I made a complete example that learns a face and prints recognition messages via WebSocket: examples/facetraining.py at master · rerobots/examples · GitHub

You can run it on https://rerobots.net/sandbox/fixed_misty2. Copy-and-paste the mistyproxy HTTPS URL into the variable named MPURL.

many thanks for your help!!