未验证 提交 b7c8bfb4 编写于 作者: M MissPenguin 提交者: GitHub

Merge pull request #3253 from LDOUBLEV/fix_ci

Fix ci
...@@ -110,10 +110,12 @@ def main(): ...@@ -110,10 +110,12 @@ def main():
# build dataloader # build dataloader
valid_dataloader = build_dataloader(config, 'Eval', device, logger) valid_dataloader = build_dataloader(config, 'Eval', device, logger)
# start eval use_srn = config['Architecture']['algorithm'] == "SRN"
model_type = config['Architecture']['model_type'] model_type = config['Architecture']['model_type']
metric = program.eval(model, valid_dataloader, post_process_class, # start eval
eval_class, model_type) metirc = program.eval(model, valid_dataloader, post_process_class,
eval_class, model_type, use_srn)
logger.info('metric eval ***************') logger.info('metric eval ***************')
for k, v in metric.items(): for k, v in metric.items():
logger.info('{}:{}'.format(k, v)) logger.info('{}:{}'.format(k, v))
......
model_name:ocr_det model_name:ocr_det
python:python3.7 python:python3.7
gpu_list:-1|0|0,1 gpu_list:0|0,1
Global.auto_cast:False|True Global.auto_cast:False
Global.epoch_num:10 Global.epoch_num:10
Global.save_model_dir:./output/ Global.save_model_dir:./output/
Global.save_inference_dir:./output/ Global.save_inference_dir:./output/
...@@ -9,7 +9,7 @@ Train.loader.batch_size_per_card: ...@@ -9,7 +9,7 @@ Train.loader.batch_size_per_card:
Global.use_gpu Global.use_gpu
Global.pretrained_model Global.pretrained_model
trainer:norm|pact|fpgm trainer:norm|pact
norm_train:tools/train.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model=./pretrain_models/MobileNetV3_large_x0_5_pretrained norm_train:tools/train.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model=./pretrain_models/MobileNetV3_large_x0_5_pretrained
quant_train:deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model=./pretrain_models/det_mv3_db_v2.0_train/best_accuracy quant_train:deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model=./pretrain_models/det_mv3_db_v2.0_train/best_accuracy
fpgm_train:null fpgm_train:null
......
...@@ -94,7 +94,7 @@ for train_model in ${train_model_list[*]}; do ...@@ -94,7 +94,7 @@ for train_model in ${train_model_list[*]}; do
# eval # eval
for slim_trainer in ${trainer_list[*]}; do for slim_trainer in ${trainer_list[*]}; do
if [ ${slim_trainer} = "norm" ]; then if [ ${slim_trainer} = "norm" ]; then
if [ ${model_name} = "det" ]; then if [ ${model_name} = "ocr_det" ]; then
eval_model_name="ch_ppocr_mobile_v2.0_det_train" eval_model_name="ch_ppocr_mobile_v2.0_det_train"
wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_train.tar wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_train.tar
cd ./inference && tar xf ${eval_model_name}.tar && cd ../ cd ./inference && tar xf ${eval_model_name}.tar && cd ../
...@@ -104,7 +104,7 @@ for train_model in ${train_model_list[*]}; do ...@@ -104,7 +104,7 @@ for train_model in ${train_model_list[*]}; do
cd ./inference && tar xf ${eval_model_name}.tar && cd ../ cd ./inference && tar xf ${eval_model_name}.tar && cd ../
fi fi
elif [ ${slim_trainer} = "pact" ]; then elif [ ${slim_trainer} = "pact" ]; then
if [ ${model_name} = "det" ]; then if [ ${model_name} = "ocr_det" ]; then
eval_model_name="ch_ppocr_mobile_v2.0_det_quant_train" eval_model_name="ch_ppocr_mobile_v2.0_det_quant_train"
wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/slim/ch_ppocr_mobile_v2.0_det_quant_train.tar wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/slim/ch_ppocr_mobile_v2.0_det_quant_train.tar
cd ./inference && tar xf ${eval_model_name}.tar && cd ../ cd ./inference && tar xf ${eval_model_name}.tar && cd ../
...@@ -114,7 +114,7 @@ for train_model in ${train_model_list[*]}; do ...@@ -114,7 +114,7 @@ for train_model in ${train_model_list[*]}; do
cd ./inference && tar xf ${eval_model_name}.tar && cd ../ cd ./inference && tar xf ${eval_model_name}.tar && cd ../
fi fi
elif [ ${slim_trainer} = "distill" ]; then elif [ ${slim_trainer} = "distill" ]; then
if [ ${model_name} = "det" ]; then if [ ${model_name} = "ocr_det" ]; then
eval_model_name="ch_ppocr_mobile_v2.0_det_distill_train" eval_model_name="ch_ppocr_mobile_v2.0_det_distill_train"
wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/slim/ch_ppocr_mobile_v2.0_det_distill_train.tar wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/slim/ch_ppocr_mobile_v2.0_det_distill_train.tar
cd ./inference && tar xf ${eval_model_name}.tar && cd ../ cd ./inference && tar xf ${eval_model_name}.tar && cd ../
...@@ -124,7 +124,7 @@ for train_model in ${train_model_list[*]}; do ...@@ -124,7 +124,7 @@ for train_model in ${train_model_list[*]}; do
cd ./inference && tar xf ${eval_model_name}.tar && cd ../ cd ./inference && tar xf ${eval_model_name}.tar && cd ../
fi fi
elif [ ${slim_trainer} = "fpgm" ]; then elif [ ${slim_trainer} = "fpgm" ]; then
if [ ${model_name} = "det" ]; then if [ ${model_name} = "ocr_det" ]; then
eval_model_name="ch_ppocr_mobile_v2.0_det_prune_train" eval_model_name="ch_ppocr_mobile_v2.0_det_prune_train"
wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/slim/ch_ppocr_mobile_v2.0_det_prune_train.tar wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/slim/ch_ppocr_mobile_v2.0_det_prune_train.tar
cd ./inference && tar xf ${eval_model_name}.tar && cd ../ cd ./inference && tar xf ${eval_model_name}.tar && cd ../
......
...@@ -110,7 +110,7 @@ function func_inference(){ ...@@ -110,7 +110,7 @@ function func_inference(){
for threads in ${cpu_threads_list[*]}; do for threads in ${cpu_threads_list[*]}; do
for batch_size in ${batch_size_list[*]}; do for batch_size in ${batch_size_list[*]}; do
_save_log_path="${_log_path}/infer_cpu_usemkldnn_${use_mkldnn}_threads_${threads}_batchsize_${batch_size}" _save_log_path="${_log_path}/infer_cpu_usemkldnn_${use_mkldnn}_threads_${threads}_batchsize_${batch_size}"
command="${_python} ${_script} ${use_gpu_key}=${use_gpu} ${use_mkldnn_key}=${use_mkldnn} ${cpu_threads_key}=${threads} ${model_dir_key}=${_model_dir} ${batch_size_key}=${batch_size} ${image_dir_key}=${_img_dir} ${save_log_key}=${_save_log_path}" command="${_python} ${_script} ${use_gpu_key}=${use_gpu} ${use_mkldnn_key}=${use_mkldnn} ${cpu_threads_key}=${threads} ${model_dir_key}=${_model_dir} ${batch_size_key}=${batch_size} ${image_dir_key}=${_img_dir} ${save_log_key}=${_save_log_path} --benchmark=True"
eval $command eval $command
status_check $? "${command}" "${status_log}" status_check $? "${command}" "${status_log}"
done done
...@@ -124,7 +124,7 @@ function func_inference(){ ...@@ -124,7 +124,7 @@ function func_inference(){
fi fi
for batch_size in ${batch_size_list[*]}; do for batch_size in ${batch_size_list[*]}; do
_save_log_path="${_log_path}/infer_gpu_usetrt_${use_trt}_precision_${precision}_batchsize_${batch_size}" _save_log_path="${_log_path}/infer_gpu_usetrt_${use_trt}_precision_${precision}_batchsize_${batch_size}"
command="${_python} ${_script} ${use_gpu_key}=${use_gpu} ${use_trt_key}=${use_trt} ${precision_key}=${precision} ${model_dir_key}=${_model_dir} ${batch_size_key}=${batch_size} ${image_dir_key}=${_img_dir} ${save_log_key}=${_save_log_path}" command="${_python} ${_script} ${use_gpu_key}=${use_gpu} ${use_trt_key}=${use_trt} ${precision_key}=${precision} ${model_dir_key}=${_model_dir} ${batch_size_key}=${batch_size} ${image_dir_key}=${_img_dir} ${save_log_key}=${_save_log_path} --benchmark=True"
eval $command eval $command
status_check $? "${command}" "${status_log}" status_check $? "${command}" "${status_log}"
done done
...@@ -138,9 +138,9 @@ if [ ${MODE} != "infer" ]; then ...@@ -138,9 +138,9 @@ if [ ${MODE} != "infer" ]; then
IFS="|" IFS="|"
for gpu in ${gpu_list[*]}; do for gpu in ${gpu_list[*]}; do
use_gpu=True train_use_gpu=True
if [ ${gpu} = "-1" ];then if [ ${gpu} = "-1" ];then
use_gpu=False train_use_gpu=False
env="" env=""
elif [ ${#gpu} -le 1 ];then elif [ ${#gpu} -le 1 ];then
env="export CUDA_VISIBLE_DEVICES=${gpu}" env="export CUDA_VISIBLE_DEVICES=${gpu}"
...@@ -181,7 +181,7 @@ for gpu in ${gpu_list[*]}; do ...@@ -181,7 +181,7 @@ for gpu in ${gpu_list[*]}; do
save_log="${LOG_PATH}/${trainer}_gpus_${gpu}_autocast_${autocast}" save_log="${LOG_PATH}/${trainer}_gpus_${gpu}_autocast_${autocast}"
if [ ${#gpu} -le 2 ];then # epoch_num #TODO if [ ${#gpu} -le 2 ];then # epoch_num #TODO
cmd="${python} ${run_train} ${train_use_gpu_key}=${use_gpu} ${autocast_key}=${autocast} ${epoch_key}=${epoch_num} ${save_model_key}=${save_log} " cmd="${python} ${run_train} ${train_use_gpu_key}=${train_use_gpu} ${autocast_key}=${autocast} ${epoch_key}=${epoch_num} ${save_model_key}=${save_log} "
elif [ ${#gpu} -le 15 ];then elif [ ${#gpu} -le 15 ];then
cmd="${python} -m paddle.distributed.launch --gpus=${gpu} ${run_train} ${autocast_key}=${autocast} ${epoch_key}=${epoch_num} ${save_model_key}=${save_log}" cmd="${python} -m paddle.distributed.launch --gpus=${gpu} ${run_train} ${autocast_key}=${autocast} ${epoch_key}=${epoch_num} ${save_model_key}=${save_log}"
else else
......
...@@ -106,7 +106,7 @@ class TextDetector(object): ...@@ -106,7 +106,7 @@ class TextDetector(object):
model_precision=args.precision, model_precision=args.precision,
batch_size=1, batch_size=1,
data_shape="dynamic", data_shape="dynamic",
save_path="./output/auto_log.lpg", save_path=args.save_log_path,
inference_config=self.config, inference_config=self.config,
pids=pid, pids=pid,
process_name=None, process_name=None,
...@@ -174,7 +174,7 @@ class TextDetector(object): ...@@ -174,7 +174,7 @@ class TextDetector(object):
data = {'image': img} data = {'image': img}
st = time.time() st = time.time()
if args.benchmark: if args.benchmark:
self.autolog.times.start() self.autolog.times.start()
...@@ -212,7 +212,7 @@ class TextDetector(object): ...@@ -212,7 +212,7 @@ class TextDetector(object):
else: else:
raise NotImplementedError raise NotImplementedError
self.predictor.try_shrink_memory() #self.predictor.try_shrink_memory()
post_result = self.postprocess_op(preds, shape_list) post_result = self.postprocess_op(preds, shape_list)
dt_boxes = post_result[0]['points'] dt_boxes = post_result[0]['points']
if self.det_algorithm == "SAST" and self.det_sast_polygon: if self.det_algorithm == "SAST" and self.det_sast_polygon:
...@@ -262,7 +262,6 @@ if __name__ == "__main__": ...@@ -262,7 +262,6 @@ if __name__ == "__main__":
"det_res_{}".format(img_name_pure)) "det_res_{}".format(img_name_pure))
cv2.imwrite(img_path, src_im) cv2.imwrite(img_path, src_im)
logger.info("The visualized image saved in {}".format(img_path)) logger.info("The visualized image saved in {}".format(img_path))
if args.benchmark: if args.benchmark:
text_detector.autolog.report() text_detector.autolog.report()
...@@ -176,6 +176,7 @@ def create_predictor(args, mode, logger): ...@@ -176,6 +176,7 @@ def create_predictor(args, mode, logger):
"conv2d_59.tmp_0": [1, 96, 20, 20], "conv2d_59.tmp_0": [1, 96, 20, 20],
"nearest_interp_v2_1.tmp_0": [1, 96, 10, 10], "nearest_interp_v2_1.tmp_0": [1, 96, 10, 10],
"nearest_interp_v2_2.tmp_0": [1, 96, 20, 20], "nearest_interp_v2_2.tmp_0": [1, 96, 20, 20],
"conv2d_124.tmp_0": [1, 96, 20, 20],
"nearest_interp_v2_3.tmp_0": [1, 24, 20, 20], "nearest_interp_v2_3.tmp_0": [1, 24, 20, 20],
"nearest_interp_v2_4.tmp_0": [1, 24, 20, 20], "nearest_interp_v2_4.tmp_0": [1, 24, 20, 20],
"nearest_interp_v2_5.tmp_0": [1, 24, 20, 20], "nearest_interp_v2_5.tmp_0": [1, 24, 20, 20],
...@@ -188,6 +189,7 @@ def create_predictor(args, mode, logger): ...@@ -188,6 +189,7 @@ def create_predictor(args, mode, logger):
"conv2d_91.tmp_0": [1, 96, 200, 200], "conv2d_91.tmp_0": [1, 96, 200, 200],
"conv2d_59.tmp_0": [1, 96, 400, 400], "conv2d_59.tmp_0": [1, 96, 400, 400],
"nearest_interp_v2_1.tmp_0": [1, 96, 200, 200], "nearest_interp_v2_1.tmp_0": [1, 96, 200, 200],
"conv2d_124.tmp_0": [1, 256, 400, 400],
"nearest_interp_v2_2.tmp_0": [1, 96, 400, 400], "nearest_interp_v2_2.tmp_0": [1, 96, 400, 400],
"nearest_interp_v2_3.tmp_0": [1, 24, 400, 400], "nearest_interp_v2_3.tmp_0": [1, 24, 400, 400],
"nearest_interp_v2_4.tmp_0": [1, 24, 400, 400], "nearest_interp_v2_4.tmp_0": [1, 24, 400, 400],
...@@ -202,6 +204,7 @@ def create_predictor(args, mode, logger): ...@@ -202,6 +204,7 @@ def create_predictor(args, mode, logger):
"conv2d_59.tmp_0": [1, 96, 160, 160], "conv2d_59.tmp_0": [1, 96, 160, 160],
"nearest_interp_v2_1.tmp_0": [1, 96, 80, 80], "nearest_interp_v2_1.tmp_0": [1, 96, 80, 80],
"nearest_interp_v2_2.tmp_0": [1, 96, 160, 160], "nearest_interp_v2_2.tmp_0": [1, 96, 160, 160],
"conv2d_124.tmp_0": [1, 256, 160, 160],
"nearest_interp_v2_3.tmp_0": [1, 24, 160, 160], "nearest_interp_v2_3.tmp_0": [1, 24, 160, 160],
"nearest_interp_v2_4.tmp_0": [1, 24, 160, 160], "nearest_interp_v2_4.tmp_0": [1, 24, 160, 160],
"nearest_interp_v2_5.tmp_0": [1, 24, 160, 160], "nearest_interp_v2_5.tmp_0": [1, 24, 160, 160],
...@@ -237,7 +240,7 @@ def create_predictor(args, mode, logger): ...@@ -237,7 +240,7 @@ def create_predictor(args, mode, logger):
# enable memory optim # enable memory optim
config.enable_memory_optim() config.enable_memory_optim()
config.disable_glog_info() #config.disable_glog_info()
config.delete_pass("conv_transpose_eltwiseadd_bn_fuse_pass") config.delete_pass("conv_transpose_eltwiseadd_bn_fuse_pass")
if mode == 'table': if mode == 'table':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册