Skip to content Skip to sidebar Skip to footer

Face Api Python Sdk "image Size Too Small" (persongroupperson Add_face_from_stream)

First things first, the documentation here says 'JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is from 1KB to 6MB.' I am sending a .jp

Solution 1:

I run your code on my side and got the same error .Seems there is something wrong with image param in code :

face_client.person_group_person.add_face_from_stream(PERSON_GROUP_ID, face.candidates[0].person_id, image)

at the phase:

#add face to person if match was found

When I changed this line code to :

face_client.person_group_person.add_face_from_stream(PERSON_GROUP_ID, face.candidates[0].person_id, open(image_name,"r+b"))

The issue was solved, faces has been added to a person successfully (this person has 1 face before) :

![enter image description here

Hope it helps.

Solution 2:

I ran into this as well. This is because the stream has already been read when you use it in the detect_with_stream

You can go image.seek(0) or close the image and reopen it - but seeking is the better solution.

Solution 3:

I was getting the same error because I was openning the photo before the recognition. So I removed the open and the code worked.

Post a Comment for "Face Api Python Sdk "image Size Too Small" (persongroupperson Add_face_from_stream)"