提交 6a2b0695 编写于 作者: W wangjiawei04

move pddet to app/pddet and remove arg parse

上级 7a6f5c82
......@@ -16,19 +16,17 @@ from paddle_serving_client import Client
import sys
import os
import time
from paddle_serving_app.pddet import Detection, ArgParse
from paddle_serving_app.reader.pddet import Detection
import numpy as np
py_version = sys.version_info[0]
feed_var_names = ['image', 'im_shape', 'im_info']
fetch_var_names = ['multiclass_nms']
FLAGS = ArgParse()
pddet = Detection(FLAGS.config_path, FLAGS.visualize, FLAGS.dump_result,
FLAGS.output_dir)
feed_dict = pddet.preprocess(feed_var_names, FLAGS.infer_img)
pddet = Detection(config_path=sys.argv[2], output_dir="./output")
feed_dict = pddet.preprocess(feed_var_names, sys.argv[3])
client = Client()
client.load_client_config(FLAGS.serving_client_conf)
client.load_client_config(sys.argv[1])
client.connect(['127.0.0.1:9494'])
fetch_map = client.predict(feed=feed_dict, fetch=fetch_var_names)
outs = fetch_map.values()
......
......@@ -16,34 +16,3 @@ import os
import time
import argparse
from .image_tool import Resize, Detection
def ArgParse():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--config_path", type=str, default=None, help="preprocess config path.")
parser.add_argument(
"--infer_img", type=str, default=None, help="Image path")
parser.add_argument(
"--visualize",
action='store_true',
default=False,
help="Whether to visualize detection output")
parser.add_argument(
"--output_dir",
type=str,
default="output",
help="Directory for storing the output visualization files.")
parser.add_argument(
"--serving_client_conf",
type=str,
default='pddet_client_conf/serving_client_conf.prototxt',
help='Paddle Serving Client configuration')
parser.add_argument(
"--dump_result",
action='store_true',
default=False,
help="Whether to dump result")
global FLAGS
FLAGS = parser.parse_args()
return FLAGS
......@@ -151,10 +151,10 @@ class PadStride(object):
class Detection():
def __init__(self, config_path, if_visualize, if_dump_result, output_dir):
def __init__(self, config_path, output_dir):
self.config_path = config_path
self.if_visualize = if_visualize
self.if_dump_result = if_dump_result
self.if_visualize = True
self.if_dump_result = True
self.output_dir = output_dir
def DecodeImage(self, im_path):
......
......@@ -48,7 +48,7 @@ REQUIRED_PACKAGES = [
packages=['paddle_serving_app',
'paddle_serving_app.reader',
'paddle_serving_app.utils',
'paddle_serving_app.pddet']
'paddle_serving_app.reader.pddet']
package_data={}
package_dir={'paddle_serving_app':
......@@ -57,8 +57,8 @@ package_dir={'paddle_serving_app':
'${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_app/reader',
'paddle_serving_app.utils':
'${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_app/utils',
'paddle_serving_app.pddet':
'${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_app/pddet',}
'paddle_serving_app.reader.pddet':
'${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_app/reader/pddet',}
setup(
name='paddle-serving-app',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册