未验证 提交 22973cb9 编写于 作者: Z zhiboniu 提交者: GitHub

update vehicle plate trt params (#6658)

* fix trt params

* update config to make safe of trt input shape
上级 b98f0df3
...@@ -10,7 +10,7 @@ MOT: ...@@ -10,7 +10,7 @@ MOT:
VEHICLE_PLATE: VEHICLE_PLATE:
det_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz det_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz
det_limit_side_len: 480 det_limit_side_len: 736
det_limit_type: "max" det_limit_type: "max"
rec_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz rec_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz
rec_image_shape: [3, 48, 320] rec_image_shape: [3, 48, 320]
......
...@@ -15,7 +15,7 @@ MOT: ...@@ -15,7 +15,7 @@ MOT:
VEHICLE_PLATE: VEHICLE_PLATE:
det_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz det_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz
det_limit_side_len: 736 det_limit_side_len: 736
det_limit_type: "min" det_limit_type: "max"
rec_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz rec_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz
rec_image_shape: [3, 48, 320] rec_image_shape: [3, 48, 320]
rec_batch_num: 6 rec_batch_num: 6
......
...@@ -15,7 +15,7 @@ MOT: ...@@ -15,7 +15,7 @@ MOT:
VEHICLE_PLATE: VEHICLE_PLATE:
det_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz det_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz
det_limit_side_len: 736 det_limit_side_len: 736
det_limit_type: "min" det_limit_type: "max"
rec_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz rec_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz
rec_image_shape: [3, 48, 320] rec_image_shape: [3, 48, 320]
rec_batch_num: 6 rec_batch_num: 6
......
...@@ -36,6 +36,8 @@ MODEL_URL_MD5_DICT = { ...@@ -36,6 +36,8 @@ MODEL_URL_MD5_DICT = {
'64fa0e0701efd93c7db52a9b685b3de6', '64fa0e0701efd93c7db52a9b685b3de6',
"https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip": "https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip":
"3859d1a26e0c498285c2374b1a347013", "3859d1a26e0c498285c2374b1a347013",
"https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_s_36e_ppvehicle.zip":
"4ed58b546be2a76d8ccbb138f64874ac",
"https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.zip": "https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.zip":
"a20d5f6ca087bff0e9f2b18df45a36f2", "a20d5f6ca087bff0e9f2b18df45a36f2",
"https://bj.bcebos.com/v1/paddledet/models/pipeline/PPLCNet_x1_0_person_attribute_945_infer.zip": "https://bj.bcebos.com/v1/paddledet/models/pipeline/PPLCNet_x1_0_person_attribute_945_infer.zip":
......
...@@ -123,7 +123,6 @@ class PlateDetector(object): ...@@ -123,7 +123,6 @@ class PlateDetector(object):
img, shape_list = self.preprocess(image) img, shape_list = self.preprocess(image)
if img is None: if img is None:
return None, 0 return None, 0
self.input_tensor.copy_from_cpu(img) self.input_tensor.copy_from_cpu(img)
self.predictor.run() self.predictor.run()
outputs = [] outputs = []
......
...@@ -61,14 +61,13 @@ def create_predictor(args, cfg, mode): ...@@ -61,14 +61,13 @@ def create_predictor(args, cfg, mode):
'trt_fp32': inference.PrecisionType.Float32, 'trt_fp32': inference.PrecisionType.Float32,
'trt_fp16': inference.PrecisionType.Half 'trt_fp16': inference.PrecisionType.Half
} }
min_subgraph_size = 15
if args.run_mode in precision_map.keys(): if args.run_mode in precision_map.keys():
config.enable_tensorrt_engine( config.enable_tensorrt_engine(
workspace_size=(1 << 25) * batch_size, workspace_size=(1 << 25) * batch_size,
max_batch_size=batch_size, max_batch_size=batch_size,
min_subgraph_size=min_subgraph_size, min_subgraph_size=min_subgraph_size,
precision_mode=precision_map[args.run_mode], precision_mode=precision_map[args.run_mode])
use_static=False,
use_calib_mode=trt_calib_mode)
use_dynamic_shape = True use_dynamic_shape = True
if mode == "det": if mode == "det":
......
...@@ -89,21 +89,15 @@ class Resize_Mult32(object): ...@@ -89,21 +89,15 @@ class Resize_Mult32(object):
# limit the max side # limit the max side
if self.limit_type == 'max': if self.limit_type == 'max':
if max(h, w) > limit_side_len:
if h > w: if h > w:
ratio = float(limit_side_len) / h ratio = float(limit_side_len) / h
else: else:
ratio = float(limit_side_len) / w ratio = float(limit_side_len) / w
else:
ratio = 1.
elif self.limit_type == 'min': elif self.limit_type == 'min':
if min(h, w) < limit_side_len:
if h < w: if h < w:
ratio = float(limit_side_len) / h ratio = float(limit_side_len) / h
else: else:
ratio = float(limit_side_len) / w ratio = float(limit_side_len) / w
else:
ratio = 1.
elif self.limit_type == 'resize_long': elif self.limit_type == 'resize_long':
ratio = float(limit_side_len) / max(h, w) ratio = float(limit_side_len) / max(h, w)
else: else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册