From 1353aa5de2be1e81056702bff0445b2e6870bce2 Mon Sep 17 00:00:00 2001 From: shangliang Xu Date: Mon, 20 Jun 2022 20:28:26 +0800 Subject: [PATCH] [TIPC] add kl quant txt (#6237) --- deploy/python/infer.py | 18 ++++++++++------ ppdet/engine/trainer.py | 21 +++++++++++++++++-- ppdet/modeling/architectures/yolo.py | 3 +-- ppdet/modeling/heads/ppyoloe_head.py | 2 +- .../tinypose_128x96_train_infer_python.txt | 6 +++--- ...cnn_r50_fpn_1x_coco_train_infer_python.txt | 6 +++--- .../picodet_l_640_coco_train_infer_python.txt | 6 +++--- ...lcnet_1_5x_416_coco_train_infer_python.txt | 6 +++--- .../picodet_m_416_coco_train_infer_python.txt | 6 +++--- ...3_large_1x_416_coco_train_infer_python.txt | 6 +++--- ...icodet_r18_640_coco_train_infer_python.txt | 6 +++--- .../picodet_s_320_coco_train_infer_python.txt | 6 +++--- ...lenetv2_1x_416_coco_train_infer_python.txt | 6 +++--- ...olo_mbv3_large_coco_train_infer_python.txt | 4 ++-- ...olo_mbv3_small_coco_train_infer_python.txt | 6 +++--- .../ppyolo_r18vd_coco_train_infer_python.txt | 6 +++--- ...o_r50vd_dcn_1x_coco_train_infer_python.txt | 4 ++-- ...yolo_tiny_650e_coco_train_infer_python.txt | 6 +++--- ...101vd_dcn_365e_coco_train_infer_python.txt | 6 +++--- ...r50vd_dcn_365e_coco_train_infer_python.txt | 6 +++--- ...loe_crn_l_300e_coco_train_infer_python.txt | 6 +++--- ...loe_crn_m_300e_coco_train_infer_python.txt | 6 +++--- ...loe_crn_s_300e_coco_train_infer_python.txt | 6 +++--- ...loe_crn_x_300e_coco_train_infer_python.txt | 6 +++--- ...darknet53_270e_coco_train_infer_python.txt | 4 ++-- test_tipc/prepare.sh | 4 ++++ 26 files changed, 97 insertions(+), 71 deletions(-) diff --git a/deploy/python/infer.py b/deploy/python/infer.py index 4ce496da4..e7c22c76a 100644 --- a/deploy/python/infer.py +++ b/deploy/python/infer.py @@ -152,11 +152,17 @@ class Detector(object): def postprocess(self, inputs, result): # postprocess output of predictor np_boxes_num = result['boxes_num'] - if np_boxes_num[0] <= 0: - print('[WARNNING] No object detected.') - result = {'boxes': np.zeros([0, 6]), 'boxes_num': [0]} - result = {k: v for k, v in result.items() if v is not None} - return result + out_result = {k: [] for k, v in result.items() if v is not None} + idx = 0 + for num_box in np_boxes_num: + for k, v in out_result.items(): + v.append(result[k][idx:idx + num_box]) + idx += num_box + if num_box == 0: + print('[WARNNING] No object detected.') + out_result = {k: np.concatenate(v) for k, v in out_result.items()} + out_result['boxes_num'] = result['boxes_num'] + return out_result def filter_box(self, result, threshold): np_boxes_num = result['boxes_num'] @@ -307,7 +313,7 @@ class Detector(object): if not os.path.exists(self.output_dir): os.makedirs(self.output_dir) out_path = os.path.join(self.output_dir, video_out_name) - fourcc = cv2.VideoWriter_fourcc(* 'mp4v') + fourcc = cv2.VideoWriter_fourcc(*'mp4v') writer = cv2.VideoWriter(out_path, fourcc, fps, (width, height)) index = 1 while (1): diff --git a/ppdet/engine/trainer.py b/ppdet/engine/trainer.py index c180e2a31..b086705ac 100644 --- a/ppdet/engine/trainer.py +++ b/ppdet/engine/trainer.py @@ -687,7 +687,10 @@ class Trainer(object): name, ext = os.path.splitext(image_name) return os.path.join(output_dir, "{}".format(name)) + ext - def _get_infer_cfg_and_input_spec(self, save_dir, prune_input=True): + def _get_infer_cfg_and_input_spec(self, + save_dir, + prune_input=True, + kl_quant=False): image_shape = None im_shape = [None, 2] scale_factor = [None, 2] @@ -768,6 +771,19 @@ class Trainer(object): "image": InputSpec( shape=image_shape, name='image') }] + if kl_quant: + if self.cfg.architecture == 'PicoDet' or 'ppyoloe' in self.cfg.weights: + pruned_input_spec = [{ + "image": InputSpec( + shape=image_shape, name='image'), + "scale_factor": InputSpec( + shape=scale_factor, name='scale_factor') + }] + elif 'tinypose' in self.cfg.weights: + pruned_input_spec = [{ + "image": InputSpec( + shape=image_shape, name='image') + }] return static_model, pruned_input_spec @@ -811,8 +827,9 @@ class Trainer(object): break # TODO: support prune input_spec + kl_quant = True if hasattr(self.cfg.slim, 'ptq') else False _, pruned_input_spec = self._get_infer_cfg_and_input_spec( - save_dir, prune_input=False) + save_dir, prune_input=False, kl_quant=kl_quant) self.cfg.slim.save_quantized_model( self.model, diff --git a/ppdet/modeling/architectures/yolo.py b/ppdet/modeling/architectures/yolo.py index 00deb32ee..ce5be21cd 100644 --- a/ppdet/modeling/architectures/yolo.py +++ b/ppdet/modeling/architectures/yolo.py @@ -115,8 +115,7 @@ class YOLOv3(BaseArch): self.inputs['im_shape'], self.inputs['scale_factor']) else: bbox, bbox_num = self.yolo_head.post_process( - yolo_head_outs, self.inputs['im_shape'], - self.inputs['scale_factor']) + yolo_head_outs, self.inputs['scale_factor']) output = {'bbox': bbox, 'bbox_num': bbox_num} return output diff --git a/ppdet/modeling/heads/ppyoloe_head.py b/ppdet/modeling/heads/ppyoloe_head.py index b012806a5..15eff3d4d 100644 --- a/ppdet/modeling/heads/ppyoloe_head.py +++ b/ppdet/modeling/heads/ppyoloe_head.py @@ -366,7 +366,7 @@ class PPYOLOEHead(nn.Layer): } return out_dict - def post_process(self, head_outs, img_shape, scale_factor): + def post_process(self, head_outs, scale_factor): pred_scores, pred_dist, anchor_points, stride_tensor = head_outs pred_bboxes = batch_distance2bbox(anchor_points, pred_dist.transpose([0, 2, 1])) diff --git a/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt b/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt index 154d03559..34aade55d 100644 --- a/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt +++ b/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c test_tipc/configs/keypoint/tinypose_128x96. distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c test_tipc/configs/keypoint/tinypose_128x96.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c test_tipc/configs/keypoint/tinypose_128x96.yml --slim_config configs/slim/post_quant/tinypose_128x96_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/keypoint_infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt b/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt index 70dd8aaed..6071bdec3 100644 --- a/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco distill_export:null export1:null export_onnx:null -kl_quant_export:tools/post_quant.py -c configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/picodet/picodet_l_640_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_l_640_coco_train_infer_python.txt index f1c2e242c..cfd5bacd0 100644 --- a/test_tipc/configs/picodet/picodet_l_640_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_l_640_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/picodet/legacy_model/picodet_l_640_ distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/picodet_l_640_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/picodet_l_640_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt index 3fe4b4968..d7a5022a4 100644 --- a/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/picodet/legacy_model/more_config/pi distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_1_5x_416_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_1_5x_416_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/picodet/picodet_m_416_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_m_416_coco_train_infer_python.txt index a67b8004e..8abd2612e 100644 --- a/test_tipc/configs/picodet/picodet_m_416_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_m_416_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/picodet/legacy_model/picodet_m_416_ distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/picodet_m_416_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/picodet_m_416_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/picodet/picodet_mobilenetv3_large_1x_416_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_mobilenetv3_large_1x_416_coco_train_infer_python.txt index cf35991bf..261330ec7 100644 --- a/test_tipc/configs/picodet/picodet_mobilenetv3_large_1x_416_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_mobilenetv3_large_1x_416_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/picodet/legacy_model/more_config/pi distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/more_config/picodet_mobilenetv3_large_1x_416_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/more_config/picodet_mobilenetv3_large_1x_416_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/picodet/picodet_r18_640_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_r18_640_coco_train_infer_python.txt index 3162d2bbc..9bcfdd82d 100644 --- a/test_tipc/configs/picodet/picodet_r18_640_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_r18_640_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/picodet/legacy_model/more_config/pi distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/more_config/picodet_r18_640_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/more_config/picodet_r18_640_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt index 899b2375e..0868ac53d 100644 --- a/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/picodet/legacy_model/picodet_s_320_ distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/picodet_s_320_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/picodet_s_320_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/picodet/picodet_shufflenetv2_1x_416_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_shufflenetv2_1x_416_coco_train_infer_python.txt index 5491ede17..1e3c2bf74 100644 --- a/test_tipc/configs/picodet/picodet_shufflenetv2_1x_416_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_shufflenetv2_1x_416_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/picodet/legacy_model/more_config/pi distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/more_config/picodet_shufflenetv2_1x_416_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/more_config/picodet_shufflenetv2_1x_416_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt index 661f92f0b..d1fc912d0 100644 --- a/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt @@ -35,8 +35,8 @@ export1:null export2:null kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolo_mbv3_large_coco.yml --slim_config configs/slim/post_quant/ppyolo_mbv3_large_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/ppyolo/ppyolo_mbv3_small_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolo_mbv3_small_coco_train_infer_python.txt index 48c763d10..a0cd6a664 100644 --- a/test_tipc/configs/ppyolo/ppyolo_mbv3_small_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolo_mbv3_small_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/ppyolo/ppyolo_mbv3_small_coco.yml - distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolo_mbv3_small_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolo_mbv3_small_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/ppyolo/ppyolo_r18vd_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolo_r18vd_coco_train_infer_python.txt index 44f982e36..68dd7219d 100644 --- a/test_tipc/configs/ppyolo/ppyolo_r18vd_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolo_r18vd_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/ppyolo/ppyolo_r18vd_coco.yml --slim distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolo_r18vd_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolo_r18vd_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt index 5ccf8e137..33d1282ee 100644 --- a/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt @@ -35,8 +35,8 @@ export1:null export2:null kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml --slim_config configs/slim/post_quant/ppyolo_r50vd_dcn_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt index 4b0f84201..a3ff4f7ec 100644 --- a/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/ppyolo/ppyolo_tiny_650e_coco.yml -- distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolo_tiny_650e_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolo_tiny_650e_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/ppyolo/ppyolov2_r101vd_dcn_365e_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolov2_r101vd_dcn_365e_coco_train_infer_python.txt index af5181cba..4a621701a 100644 --- a/test_tipc/configs/ppyolo/ppyolov2_r101vd_dcn_365e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolov2_r101vd_dcn_365e_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/ppyolo/ppyolov2_r101vd_dcn_365e_coc distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolov2_r101vd_dcn_365e_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolov2_r101vd_dcn_365e_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt index 82e0e9f1b..a85d525d4 100644 --- a/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/ppyoloe/ppyoloe_crn_l_300e_coco_train_infer_python.txt b/test_tipc/configs/ppyoloe/ppyoloe_crn_l_300e_coco_train_infer_python.txt index f7327aee4..125c7ed3c 100644 --- a/test_tipc/configs/ppyoloe/ppyoloe_crn_l_300e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyoloe/ppyoloe_crn_l_300e_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/ppyoloe/ppyoloe_crn_l_300e_coco.yml distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/ppyoloe/ppyoloe_crn_l_300e_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/ppyoloe/ppyoloe_crn_l_300e_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/ppyoloe/ppyoloe_crn_m_300e_coco_train_infer_python.txt b/test_tipc/configs/ppyoloe/ppyoloe_crn_m_300e_coco_train_infer_python.txt index 71d70378e..02d6522a7 100644 --- a/test_tipc/configs/ppyoloe/ppyoloe_crn_m_300e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyoloe/ppyoloe_crn_m_300e_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/ppyoloe/ppyoloe_crn_m_300e_coco.yml distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/ppyoloe/ppyoloe_crn_m_300e_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/ppyoloe/ppyoloe_crn_m_300e_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt b/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt index 7bbc2cbfc..5e553badc 100644 --- a/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/ppyoloe/ppyoloe_crn_s_300e_coco.yml distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/ppyoloe/ppyoloe_crn_s_300e_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/ppyoloe/ppyoloe_crn_s_300e_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/ppyoloe/ppyoloe_crn_x_300e_coco_train_infer_python.txt b/test_tipc/configs/ppyoloe/ppyoloe_crn_x_300e_coco_train_infer_python.txt index 67b226bf5..09e13f647 100644 --- a/test_tipc/configs/ppyoloe/ppyoloe_crn_x_300e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyoloe/ppyoloe_crn_x_300e_coco_train_infer_python.txt @@ -33,10 +33,10 @@ fpgm_export:tools/export_model.py -c configs/ppyoloe/ppyoloe_crn_x_300e_coco.yml distill_export:null export1:null export2:null -kl_quant_export:tools/post_quant.py -c configs/ppyoloe/ppyoloe_crn_x_300e_coco.yml --slim_config _template_kl_quant -o +kl_quant_export:tools/post_quant.py -c configs/ppyoloe/ppyoloe_crn_x_300e_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt b/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt index e14751093..472b2af56 100644 --- a/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt +++ b/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt @@ -35,8 +35,8 @@ export1:null export2:null kl_quant_export:tools/post_quant.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o ## -infer_mode:norm -infer_quant:False +infer_mode:norm|kl_quant +infer_quant:False|True inference:./deploy/python/infer.py --device:gpu|cpu --enable_mkldnn:False diff --git a/test_tipc/prepare.sh b/test_tipc/prepare.sh index 769ee5663..e02fd5af2 100644 --- a/test_tipc/prepare.sh +++ b/test_tipc/prepare.sh @@ -81,6 +81,10 @@ elif [ ${MODE} = "paddle2onnx_infer" ];then ${python} -m pip install onnx onnxruntime elif [ ${MODE} = "serving_infer" ];then unset https_proxy http_proxy + # download coco lite data + wget -nc -P ./dataset/coco/ https://paddledet.bj.bcebos.com/data/tipc/coco_tipc.tar --no-check-certificate + cd ./dataset/coco/ && tar -xvf coco_tipc.tar && mv -n coco_tipc/* . + rm -rf coco_tipc/ && cd ../../ else # download coco lite data wget -nc -P ./dataset/coco/ https://paddledet.bj.bcebos.com/data/tipc/coco_tipc.tar --no-check-certificate -- GitLab