python-animeface
python-animeface copied to clipboard
there's alittle bit slow
i am using this within a flask backend and it works well , but i get base64 encode face image quiet slow. Theres is at least 2s delay.
def detect2(file):
ret = []
img = Image.open(file)
faces = animeface.detect(img)
for it in faces:
fp = it.face.pos
# print(fp)
buffer = BytesIO()
crop = img.crop((fp.x, fp.y, fp.x + fp.width, fp.y + fp.height))
crop.save(buffer, format='png')
byte_data = buffer.getvalue()
image_str = base64.b64encode(byte_data).decode()
ret.append({"face": image_str})
return ret