SthPhoenix / InsightFace-REST

InsightFace REST API for easy deployment of face recognition services with TensorRT in Docker.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: operands could not be broadcast together with shapes (288,) (338,)

Vuong02011996 opened this issue · comments

import os
import json
import base64
import requests
from glob import glob


def file2base64(path):
    with open(path, mode='rb') as fl:
        encoded = base64.b64encode(fl.read()).decode('ascii')
        return encoded


def extract_vecs(ims, max_size=[200, 200]):
    target = [file2base64(im) for im in ims]
    req = {"images": {"data": target}, "max_size": max_size}
    resp = requests.post('http://localhost:18081/extract', json=req)
    data = resp.json()
    return data


images_path = '/src/api_trt/test_images/*'
images = glob(images_path)
data = extract_vecs(images)

When I run docker logs container_id, I get error

  File "/app/./modules/model_zoo/detectors/scrfd.py", line 39, in distance2bbox
    x1 = points[:, 0] - distance[:, 0]
ValueError: operands could not be broadcast together with shapes (288,) (338,)