cd scripts
./service.sh
Linux系统使用这个命令是前台启动,实际的启动用的是shell脚本,内容如下:
#!/bin/bash
nohup python -u ./api/api.py > ./deepfacelog.out 2>&1 &
Face recognition, facial attribute analysis and vector representation functions are covered in the API. You are expected to call these functions as http post methods. Default service endpoints will be http://localhost:5000/verify
for face recognition, http://localhost:detector_backend
for facial attribute analysis, and http://localhost:5000/represent
for vector representation. You can pass input images as exact image paths on your environment, base64 encoded strings or images on web. Here, you can find a postman project to find out how these methods should be called.
这里仅贴出如何传递base64进行接口调用:
{
"img\_path": "data:image/,image\_base64\_str"
}
仅看一下base64相关源码:
def load\_image(img):
# The image is a base64 string
if img.startswith("data:image/"):
return loadBase64Img(img)
def loadBase64Img(uri):
encoded_data = uri.split(",")[1]
nparr = np.fromstring(base64.b64decode(encoded_data), np.uint8)
img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)