提交 5857d016 编写于 作者: B bjjwwang

fix web service

上级 178c5bd3
......@@ -53,7 +53,7 @@ class FasterRCNNOp(Op):
def postprocess(self, input_dicts, fetch_dict, log_id):
#print(fetch_dict)
res_dict = {"bbox_result": str(self.img_postprocess(fetch_dict))}
res_dict = {"bbox_result": str(self.img_postprocess(fetch_dict, visualize=False))}
return res_dict, None, ""
......
......@@ -54,7 +54,7 @@ class PPYoloMbvOp(Op):
def postprocess(self, input_dicts, fetch_dict, log_id):
#print(fetch_dict)
res_dict = {"bbox_result": str(self.img_postprocess(fetch_dict))}
res_dict = {"bbox_result": str(self.img_postprocess(fetch_dict, visualize=False))}
return res_dict, None, ""
......
......@@ -53,7 +53,7 @@ class Yolov3Op(Op):
def postprocess(self, input_dicts, fetch_dict, log_id):
#print(fetch_dict)
res_dict = {"bbox_result": str(self.img_postprocess(fetch_dict))}
res_dict = {"bbox_result": str(self.img_postprocess(fetch_dict, visualize=False))}
return res_dict, None, ""
......
......@@ -415,7 +415,7 @@ class RCNNPostprocess(object):
out_path = os.path.join(self.output_dir, image_path)
image.save(out_path, quality=95)
def __call__(self, image_with_bbox):
def __call__(self, image_with_bbox, visualize=True):
fetch_name = ""
for key in image_with_bbox:
if key == "image":
......@@ -427,6 +427,8 @@ class RCNNPostprocess(object):
self.clsid2catid)
if os.path.isdir(self.output_dir) is False:
os.mkdir(self.output_dir)
if visualize is False:
return bbox_result
self.visualize(image_with_bbox["image"], bbox_result, self.catid2name,
len(self.label_list))
if os.path.isdir(self.output_dir) is False:
......@@ -434,6 +436,7 @@ class RCNNPostprocess(object):
bbox_file = os.path.join(self.output_dir, 'bbox.json')
with open(bbox_file, 'w') as f:
json.dump(bbox_result, f, indent=4)
return bbox_result
def __repr__(self):
return self.__class__.__name__ + "label_file: {1}, output_dir: {2}".format(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册