提交 01dc7125 编写于 作者: W wuzewu

Update detection module

上级 269e97d1
......@@ -28,6 +28,7 @@ class PyramidBoxLiteMobile(hub.Module):
self.default_pretrained_model_path = os.path.join(
self.directory, "pyramidbox_lite_mobile_face_detection")
self._set_config()
self.processor = self
def _set_config(self):
"""
......@@ -130,6 +131,9 @@ class PyramidBoxLiteMobile(hub.Module):
program, feeded_var_names, target_vars = fluid.io.load_inference_model(
dirname=self.default_pretrained_model_path, executor=exe)
var = program.global_block().vars['detection_output_0.tmp_1']
var.desc.set_dtype(fluid.core.VarDesc.VarType.INT32)
fluid.io.save_inference_model(
dirname=dirname,
main_program=program,
......
......@@ -37,6 +37,7 @@ class PyramidBoxLiteMobileMask(hub.Module):
else:
self.face_detector = face_detector_module
self._set_config()
self.processor = self
def _set_config(self):
"""
......
......@@ -94,12 +94,12 @@ def draw_bounding_box_on_image(save_im_path, output_data):
box_fill = (255)
text_fill = (0)
draw.rectangle(
xy=(bbox['left'], bbox['top'] - (textsize_height + 5),
bbox['left'] + textsize_width + 10, bbox['top'] - 3),
fill=box_fill)
draw.text(
xy=(bbox['left'], bbox['top'] - 15), text=text, fill=text_fill)
draw.rectangle(
xy=(bbox['left'], bbox['top'] - (textsize_height + 5),
bbox['left'] + textsize_width + 10, bbox['top'] - 3),
fill=box_fill)
draw.text(
xy=(bbox['left'], bbox['top'] - 15), text=text, fill=text_fill)
image.save(save_im_path)
......
......@@ -28,6 +28,7 @@ class PyramidBoxLiteServer(hub.Module):
self.default_pretrained_model_path = os.path.join(
self.directory, "pyramidbox_lite_server_face_detection")
self._set_config()
self.processor = self
def _set_config(self):
"""
......
......@@ -37,6 +37,7 @@ class PyramidBoxLiteServerMask(hub.Module):
else:
self.face_detector = face_detector_module
self._set_config()
self.processor = self
def _set_config(self):
"""
......
......@@ -94,12 +94,12 @@ def draw_bounding_box_on_image(save_im_path, output_data):
box_fill = (255)
text_fill = (0)
draw.rectangle(
xy=(bbox['left'], bbox['top'] - (textsize_height + 5),
bbox['left'] + textsize_width + 10, bbox['top'] - 3),
fill=box_fill)
draw.text(
xy=(bbox['left'], bbox['top'] - 15), text=text, fill=text_fill)
draw.rectangle(
xy=(bbox['left'], bbox['top'] - (textsize_height + 5),
bbox['left'] + textsize_width + 10, bbox['top'] - 3),
fill=box_fill)
draw.text(
xy=(bbox['left'], bbox['top'] - 15), text=text, fill=text_fill)
image.save(save_im_path)
......
......@@ -21,7 +21,7 @@ from ssd_mobilenet_v1_pascal.data_feed import reader
@moduleinfo(
name="ssd_mobilenet_v1_pascal",
version="1.1.0",
version="1.1.1",
type="cv/object_detection",
summary="SSD with backbone MobileNet_V1, trained with dataset Pasecal VOC.",
author="paddlepaddle",
......@@ -275,7 +275,7 @@ class SSDMobileNetv1(hub.Module):
self.add_module_config_arg()
self.add_module_input_arg()
args = self.parser.parse_args(argvs)
results = self.face_detection(
results = self.object_detection(
paths=[args.input_path],
batch_size=args.batch_size,
use_gpu=args.use_gpu,
......
......@@ -21,7 +21,7 @@ from ssd_vgg16_300_coco2017.data_feed import reader
@moduleinfo(
name="ssd_vgg16_300_coco2017",
version="1.0.0",
version="1.0.1",
type="cv/object_detection",
summary="SSD with backbone VGG16, trained with dataset COCO.",
author="paddlepaddle",
......@@ -264,7 +264,7 @@ class SSDVGG16(hub.Module):
self.add_module_config_arg()
self.add_module_input_arg()
args = self.parser.parse_args(argvs)
results = self.face_detection(
results = self.object_detection(
paths=[args.input_path],
batch_size=args.batch_size,
use_gpu=args.use_gpu,
......
......@@ -21,7 +21,7 @@ from ssd_vgg16_512_coco2017.data_feed import reader
@moduleinfo(
name="ssd_vgg16_512_coco2017",
version="1.0.0",
version="1.0.1",
type="cv/object_detection",
summary="SSD with backbone VGG16, trained with dataset COCO.",
author="paddlepaddle",
......@@ -278,7 +278,7 @@ class SSDVGG16_512(hub.Module):
self.add_module_config_arg()
self.add_module_input_arg()
args = self.parser.parse_args(argvs)
results = self.face_detection(
results = self.object_detection(
paths=[args.input_path],
batch_size=args.batch_size,
use_gpu=args.use_gpu,
......
......@@ -21,7 +21,7 @@ from yolov3_darknet53_coco2017.yolo_head import MultiClassNMS, YOLOv3Head
@moduleinfo(
name="yolov3_darknet53_coco2017",
version="1.1.0",
version="1.1.1",
type="CV/object_detection",
summary=
"Baidu's YOLOv3 model for object detection, with backbone DarkNet53, trained with dataset coco2017.",
......@@ -270,7 +270,7 @@ class YOLOv3DarkNet53Coco2017(hub.Module):
self.add_module_config_arg()
self.add_module_input_arg()
args = self.parser.parse_args(argvs)
results = self.face_detection(
results = self.object_detection(
paths=[args.input_path],
batch_size=args.batch_size,
use_gpu=args.use_gpu,
......
......@@ -21,7 +21,7 @@ from yolov3_darknet53_pedestrian.yolo_head import MultiClassNMS, YOLOv3Head
@moduleinfo(
name="yolov3_darknet53_pedestrian",
version="1.0.0",
version="1.0.1",
type="CV/object_detection",
summary=
"Baidu's YOLOv3 model for pedestrian detection, with backbone DarkNet53.",
......@@ -280,7 +280,7 @@ class YOLOv3DarkNet53Pedestrian(hub.Module):
self.add_module_config_arg()
self.add_module_input_arg()
args = self.parser.parse_args(argvs)
results = self.face_detection(
results = self.object_detection(
paths=[args.input_path],
batch_size=args.batch_size,
use_gpu=args.use_gpu,
......
......@@ -21,7 +21,7 @@ from yolov3_darknet53_vehicles.yolo_head import MultiClassNMS, YOLOv3Head
@moduleinfo(
name="yolov3_darknet53_vehicles",
version="1.0.0",
version="1.0.1",
type="CV/object_detection",
summary=
"Baidu's YOLOv3 model for vehicles detection, with backbone DarkNet53.",
......@@ -280,7 +280,7 @@ class YOLOv3DarkNet53Vehicles(hub.Module):
self.add_module_config_arg()
self.add_module_input_arg()
args = self.parser.parse_args(argvs)
results = self.face_detection(
results = self.object_detection(
paths=[args.input_path],
batch_size=args.batch_size,
use_gpu=args.use_gpu,
......
......@@ -21,7 +21,7 @@ from yolov3_mobilenet_v1_coco2017.yolo_head import MultiClassNMS, YOLOv3Head
@moduleinfo(
name="yolov3_mobilenet_v1_coco2017",
version="1.0.0",
version="1.0.1",
type="CV/object_detection",
summary=
"Baidu's YOLOv3 model for object detection with backbone MobileNet_V1, trained with dataset COCO2017.",
......@@ -270,7 +270,7 @@ class YOLOv3MobileNetV1Coco2017(hub.Module):
self.add_module_config_arg()
self.add_module_input_arg()
args = self.parser.parse_args(argvs)
results = self.face_detection(
results = self.object_detection(
paths=[args.input_path],
batch_size=args.batch_size,
use_gpu=args.use_gpu,
......
......@@ -21,7 +21,7 @@ from yolov3_resnet34_coco2017.yolo_head import MultiClassNMS, YOLOv3Head
@moduleinfo(
name="yolov3_resnet34_coco2017",
version="1.0.0",
version="1.0.1",
type="CV/object_detection",
summary=
"Baidu's YOLOv3 model for object detection with backbone ResNet34, trained with dataset coco2017.",
......@@ -272,7 +272,7 @@ class YOLOv3ResNet34Coco2017(hub.Module):
self.add_module_config_arg()
self.add_module_input_arg()
args = self.parser.parse_args(argvs)
results = self.face_detection(
results = self.object_detection(
paths=[args.input_path],
batch_size=args.batch_size,
use_gpu=args.use_gpu,
......
......@@ -21,7 +21,7 @@ from yolov3_resnet50_vd_coco2017.yolo_head import MultiClassNMS, YOLOv3Head
@moduleinfo(
name="yolov3_resnet50_vd_coco2017",
version="1.0.0",
version="1.0.1",
type="CV/object_detection",
summary=
"Baidu's YOLOv3 model for object detection with backbone ResNet50, trained with dataset coco2017.",
......@@ -274,7 +274,7 @@ class YOLOv3ResNet50Coco2017(hub.Module):
self.add_module_config_arg()
self.add_module_input_arg()
args = self.parser.parse_args(argvs)
results = self.face_detection(
results = self.object_detection(
paths=[args.input_path],
batch_size=args.batch_size,
use_gpu=args.use_gpu,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册