未验证 提交 aa655564 编写于 作者: T Tingquan Gao 提交者: GitHub

Adapt to PaddleHub2.0 (#512)

上级 5b01de1e
......@@ -62,6 +62,7 @@ class ClasSystem(hub.Module):
else:
print("Use CPU")
print("Enable MKL-DNN") if enable_mkldnn else None
self.predictor = create_paddle_predictor(self.args)
def read_images(self, paths=[]):
images = []
......@@ -96,7 +97,6 @@ class ClasSystem(hub.Module):
assert predicted_data != [], "There is not any image to be predicted. Please check the input data."
predictor = create_paddle_predictor(self.args)
all_results = []
for img in predicted_data:
if img is None:
......@@ -107,7 +107,7 @@ class ClasSystem(hub.Module):
self.args.image_file = img
self.args.top_k = top_k
classes, scores = paddle_predict.predict(self.args, predictor)
classes, scores = paddle_predict.predict(self.args, self.predictor)
elapse = time.time() - starttime
logger.info("Predict time: {}".format(elapse))
......
......@@ -14,8 +14,8 @@ deploy/hubserving/clas/
## 快速启动服务
### 1. 准备环境
```shell
# 安装paddlehub
pip3 install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple
# 安装paddlehub,请安装2.0版本
pip3 install paddlehub==2.0.0b1 --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple
```
### 2. 下载推理模型
......
......@@ -14,8 +14,8 @@ deploy/hubserving/clas/
## Quick start service
### 1. Prepare the environment
```shell
# Install paddlehub
pip3 install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple
# Install version 2.0 of PaddleHub
pip3 install paddlehub==2.0.0b1 --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple
```
### 2. Download inference model
......
......@@ -73,7 +73,7 @@ def main(url, image_path, top_k=1):
continue
elapse = time.time() - starttime
total_time += elapse
if r.json()['status'] != '0':
if r.json()['status'] != '000':
logger.error(
"File:{}, The parameters returned by the server are: {}".
format(file_str, r.json()['msg']))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册