PaddlePaddle(飞桨)一键部署face_landmark_localization模型

face_landmark_localization模型启动

config.json

可以看到里面包含两个模型,face_landmark_localization deeplabv3p_xception65_humanseg

{
  "modules_info": {
    "face_landmark_localization": {
      "init_args": {
        "version": "1.0.2"
      },
      "predict_args": {
        "batch_size": 1,
        "use_gpu": false
      }
    },
    "deeplabv3p_xception65_humanseg": {
      "init_args": {
        "version": "1.0.0"
      },
      "predict_args": {
        "batch_size": 1,
        "use_gpu": false
      }
    }
  },
  "port": 8866,
  "use_multiprocess": false,
  "workers": 2
}

一键部署服务启动

hub serving start --config config.json

调用一键部署服务

  url = "http://127.0.0.1:8866/predict/face_landmark_localization"
    data = {'images': [cv2_to_base64(cv2.imread(source_img_path))]}
    headers = {"Content-type": "application/json"}
    r = requests.post(url=url, headers=headers, data=json.dumps(data))
    # 打印预测结果
    result = r.json()["results"]
    data = result[0]['data'][0]
    face_landmark = np.array(data, dtype='int')

感言

debug一阵子,就明白了,知道接口什么样了。。。
有时候看文档,不自己动手,是会有点问题。
在这里插入图片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章