From 7fdf4607df3b60a888c25273c2b219b78db91e57 Mon Sep 17 00:00:00 2001 From: dongshuilong Date: Mon, 29 Nov 2021 04:34:15 +0000 Subject: [PATCH] update tipc for basic link --- deploy/python/predict_cls.py | 4 +- ...iT_base_patch16_384_train_infer_python.txt | 2 +- .../LeViT/LeViT_384_train_infer_python.txt | 2 +- .../ResNeSt/ResNeSt101_train_infer_python.txt | 52 ------------------- ...patch4_window12_384_train_infer_python.txt | 2 +- ...patch4_window12_384_train_infer_python.txt | 4 +- ..._patch4_window7_224_train_infer_python.txt | 2 +- ...iT_base_patch16_384_train_infer_python.txt | 2 +- ...iT_base_patch32_384_train_infer_python.txt | 2 +- ...iT_huge_patch32_384_train_infer_python.txt | 2 +- ...T_large_patch16_384_train_infer_python.txt | 2 +- ...T_large_patch32_384_train_infer_python.txt | 2 +- test_tipc/prepare.sh | 5 ++ 13 files changed, 19 insertions(+), 64 deletions(-) delete mode 100644 test_tipc/config/ResNeSt/ResNeSt101_train_infer_python.txt diff --git a/deploy/python/predict_cls.py b/deploy/python/predict_cls.py index cdeb32e4..7d6d8616 100644 --- a/deploy/python/predict_cls.py +++ b/deploy/python/predict_cls.py @@ -47,12 +47,14 @@ class ClsPredictor(Predictor): import auto_log import os pid = os.getpid() + size = config["PreProcess"]["transform_ops"][1]["CropImage"][ + "size"] self.auto_logger = auto_log.AutoLogger( model_name=config["Global"].get("model_name", "cls"), model_precision='fp16' if config["Global"]["use_fp16"] else 'fp32', batch_size=config["Global"].get("batch_size", 1), - data_shape=[3, 224, 224], + data_shape=[3, size, size], save_path=config["Global"].get("save_log_path", "./auto_log.log"), inference_config=self.config, diff --git a/test_tipc/config/DeiT/DeiT_base_patch16_384_train_infer_python.txt b/test_tipc/config/DeiT/DeiT_base_patch16_384_train_infer_python.txt index f6e034d0..c8fc60e0 100644 --- a/test_tipc/config/DeiT/DeiT_base_patch16_384_train_infer_python.txt +++ b/test_tipc/config/DeiT/DeiT_base_patch16_384_train_infer_python.txt @@ -37,7 +37,7 @@ pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/D infer_model:../inference/ infer_export:True infer_quant:Fasle -inference:python/predict_cls.py -c configs/inference_cls.yaml +inference:python/predict_cls.py -c configs/inference_cls.yaml -o PreProcess.transform_ops.0.ResizeImage.resize_short=384 -o PreProcess.transform_ops.1.CropImage.size=384 -o Global.use_gpu:True|False -o Global.enable_mkldnn:True|False -o Global.cpu_num_threads:1|6 diff --git a/test_tipc/config/LeViT/LeViT_384_train_infer_python.txt b/test_tipc/config/LeViT/LeViT_384_train_infer_python.txt index b5afe81c..47451d4f 100644 --- a/test_tipc/config/LeViT/LeViT_384_train_infer_python.txt +++ b/test_tipc/config/LeViT/LeViT_384_train_infer_python.txt @@ -37,7 +37,7 @@ pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/L infer_model:../inference/ infer_export:True infer_quant:Fasle -inference:python/predict_cls.py -c configs/inference_cls.yaml +inference:python/predict_cls.py -c configs/inference_cls.yaml -o PreProcess.transform_ops.0.ResizeImage.resize_short=384 -o PreProcess.transform_ops.1.CropImage.size=384 -o Global.use_gpu:True|False -o Global.enable_mkldnn:True|False -o Global.cpu_num_threads:1|6 diff --git a/test_tipc/config/ResNeSt/ResNeSt101_train_infer_python.txt b/test_tipc/config/ResNeSt/ResNeSt101_train_infer_python.txt deleted file mode 100644 index 30fbdf73..00000000 --- a/test_tipc/config/ResNeSt/ResNeSt101_train_infer_python.txt +++ /dev/null @@ -1,52 +0,0 @@ -===========================train_params=========================== -model_name:ResNeSt101 -python:python3.7 -gpu_list:0|0,1 --o Global.device:gpu --o Global.auto_cast:null --o Global.epochs:lite_train_lite_infer=2|whole_train_whole_infer=120 --o Global.output_dir:./output/ --o DataLoader.Train.sampler.batch_size:8 --o Global.pretrained_model:null -train_model_name:latest -train_infer_img_dir:./dataset/ILSVRC2012/val -null:null -## -trainer:norm_train -norm_train:tools/train.py -c ppcls/configs/ImageNet/ResNeSt/ResNeSt101.yaml -o Global.seed=1234 -o DataLoader.Train.sampler.shuffle=False -o DataLoader.Train.loader.num_workers=0 -o DataLoader.Train.loader.use_shared_memory=False -pact_train:null -fpgm_train:null -distill_train:null -null:null -null:null -## -===========================eval_params=========================== -eval:tools/eval.py -c ppcls/configs/ImageNet/ResNeSt/ResNeSt101.yaml -null:null -## -===========================infer_params========================== --o Global.save_inference_dir:./inference --o Global.pretrained_model: -norm_export:tools/export_model.py -c ppcls/configs/ImageNet/ResNeSt/ResNeSt101.yaml -quant_export:null -fpgm_export:null -distill_export:null -kl_quant:null -export2:null -pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/ResNeSt101_pretrained.pdparams -infer_model:../inference/ -infer_export:True -infer_quant:Fasle -inference:python/predict_cls.py -c configs/inference_cls.yaml --o Global.use_gpu:True|False --o Global.enable_mkldnn:True|False --o Global.cpu_num_threads:1|6 --o Global.batch_size:1|16 --o Global.use_tensorrt:True|False --o Global.use_fp16:True|False --o Global.inference_model_dir:../inference --o Global.infer_imgs:../dataset/ILSVRC2012/val --o Global.save_log_path:null --o Global.benchmark:True -null:null -null:null diff --git a/test_tipc/config/SwinTransformer/SwinTransformer_base_patch4_window12_384_train_infer_python.txt b/test_tipc/config/SwinTransformer/SwinTransformer_base_patch4_window12_384_train_infer_python.txt index e91974a2..e7161c8d 100644 --- a/test_tipc/config/SwinTransformer/SwinTransformer_base_patch4_window12_384_train_infer_python.txt +++ b/test_tipc/config/SwinTransformer/SwinTransformer_base_patch4_window12_384_train_infer_python.txt @@ -37,7 +37,7 @@ pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/S infer_model:../inference/ infer_export:True infer_quant:Fasle -inference:python/predict_cls.py -c configs/inference_cls.yaml +inference:python/predict_cls.py -c configs/inference_cls.yaml -o PreProcess.transform_ops.0.ResizeImage.resize_short=384 -o PreProcess.transform_ops.1.CropImage.size=384 -o Global.use_gpu:True|False -o Global.enable_mkldnn:True|False -o Global.cpu_num_threads:1|6 diff --git a/test_tipc/config/SwinTransformer/SwinTransformer_large_patch4_window12_384_train_infer_python.txt b/test_tipc/config/SwinTransformer/SwinTransformer_large_patch4_window12_384_train_infer_python.txt index 14d883a9..6da5cedf 100644 --- a/test_tipc/config/SwinTransformer/SwinTransformer_large_patch4_window12_384_train_infer_python.txt +++ b/test_tipc/config/SwinTransformer/SwinTransformer_large_patch4_window12_384_train_infer_python.txt @@ -33,11 +33,11 @@ fpgm_export:null distill_export:null kl_quant:null export2:null -pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/SwinTransformer_large_patch4_window12_384_pretrained.pdparams +pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/SwinTransformer_large_patch4_window12_384_22kto1k_pretrained.pdparams infer_model:../inference/ infer_export:True infer_quant:Fasle -inference:python/predict_cls.py -c configs/inference_cls.yaml +inference:python/predict_cls.py -c configs/inference_cls.yaml -o PreProcess.transform_ops.0.ResizeImage.resize_short=384 -o PreProcess.transform_ops.1.CropImage.size=384 -o Global.use_gpu:True|False -o Global.enable_mkldnn:True|False -o Global.cpu_num_threads:1|6 diff --git a/test_tipc/config/SwinTransformer/SwinTransformer_large_patch4_window7_224_train_infer_python.txt b/test_tipc/config/SwinTransformer/SwinTransformer_large_patch4_window7_224_train_infer_python.txt index 84c1e4bd..359899e1 100644 --- a/test_tipc/config/SwinTransformer/SwinTransformer_large_patch4_window7_224_train_infer_python.txt +++ b/test_tipc/config/SwinTransformer/SwinTransformer_large_patch4_window7_224_train_infer_python.txt @@ -33,7 +33,7 @@ fpgm_export:null distill_export:null kl_quant:null export2:null -pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/SwinTransformer_large_patch4_window7_224_pretrained.pdparams +pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/SwinTransformer_large_patch4_window7_224_22kto1k_pretrained.pdparams infer_model:../inference/ infer_export:True infer_quant:Fasle diff --git a/test_tipc/config/VisionTransformer/ViT_base_patch16_384_train_infer_python.txt b/test_tipc/config/VisionTransformer/ViT_base_patch16_384_train_infer_python.txt index 6d629122..ed88b515 100644 --- a/test_tipc/config/VisionTransformer/ViT_base_patch16_384_train_infer_python.txt +++ b/test_tipc/config/VisionTransformer/ViT_base_patch16_384_train_infer_python.txt @@ -37,7 +37,7 @@ pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/V infer_model:../inference/ infer_export:True infer_quant:Fasle -inference:python/predict_cls.py -c configs/inference_cls.yaml +inference:python/predict_cls.py -c configs/inference_cls.yaml -o PreProcess.transform_ops.0.ResizeImage.resize_short=384 -o PreProcess.transform_ops.1.CropImage.size=384 -o Global.use_gpu:True|False -o Global.enable_mkldnn:True|False -o Global.cpu_num_threads:1|6 diff --git a/test_tipc/config/VisionTransformer/ViT_base_patch32_384_train_infer_python.txt b/test_tipc/config/VisionTransformer/ViT_base_patch32_384_train_infer_python.txt index 0febb01a..9c3abcdc 100644 --- a/test_tipc/config/VisionTransformer/ViT_base_patch32_384_train_infer_python.txt +++ b/test_tipc/config/VisionTransformer/ViT_base_patch32_384_train_infer_python.txt @@ -37,7 +37,7 @@ pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/V infer_model:../inference/ infer_export:True infer_quant:Fasle -inference:python/predict_cls.py -c configs/inference_cls.yaml +inference:python/predict_cls.py -c configs/inference_cls.yaml -o PreProcess.transform_ops.0.ResizeImage.resize_short=384 -o PreProcess.transform_ops.1.CropImage.size=384 -o Global.use_gpu:True|False -o Global.enable_mkldnn:True|False -o Global.cpu_num_threads:1|6 diff --git a/test_tipc/config/VisionTransformer/ViT_huge_patch32_384_train_infer_python.txt b/test_tipc/config/VisionTransformer/ViT_huge_patch32_384_train_infer_python.txt index b6384854..942302f2 100644 --- a/test_tipc/config/VisionTransformer/ViT_huge_patch32_384_train_infer_python.txt +++ b/test_tipc/config/VisionTransformer/ViT_huge_patch32_384_train_infer_python.txt @@ -37,7 +37,7 @@ pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/V infer_model:../inference/ infer_export:True infer_quant:Fasle -inference:python/predict_cls.py -c configs/inference_cls.yaml +inference:python/predict_cls.py -c configs/inference_cls.yaml -o PreProcess.transform_ops.0.ResizeImage.resize_short=384 -o PreProcess.transform_ops.1.CropImage.size=384 -o Global.use_gpu:True|False -o Global.enable_mkldnn:True|False -o Global.cpu_num_threads:1|6 diff --git a/test_tipc/config/VisionTransformer/ViT_large_patch16_384_train_infer_python.txt b/test_tipc/config/VisionTransformer/ViT_large_patch16_384_train_infer_python.txt index 3a15cf03..dd067233 100644 --- a/test_tipc/config/VisionTransformer/ViT_large_patch16_384_train_infer_python.txt +++ b/test_tipc/config/VisionTransformer/ViT_large_patch16_384_train_infer_python.txt @@ -37,7 +37,7 @@ pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/V infer_model:../inference/ infer_export:True infer_quant:Fasle -inference:python/predict_cls.py -c configs/inference_cls.yaml +inference:python/predict_cls.py -c configs/inference_cls.yaml -o PreProcess.transform_ops.0.ResizeImage.resize_short=384 -o PreProcess.transform_ops.1.CropImage.size=384 -o Global.use_gpu:True|False -o Global.enable_mkldnn:True|False -o Global.cpu_num_threads:1|6 diff --git a/test_tipc/config/VisionTransformer/ViT_large_patch32_384_train_infer_python.txt b/test_tipc/config/VisionTransformer/ViT_large_patch32_384_train_infer_python.txt index bde16065..b5211889 100644 --- a/test_tipc/config/VisionTransformer/ViT_large_patch32_384_train_infer_python.txt +++ b/test_tipc/config/VisionTransformer/ViT_large_patch32_384_train_infer_python.txt @@ -37,7 +37,7 @@ pretrained_model_url:https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/V infer_model:../inference/ infer_export:True infer_quant:Fasle -inference:python/predict_cls.py -c configs/inference_cls.yaml +inference:python/predict_cls.py -c configs/inference_cls.yaml -o PreProcess.transform_ops.0.ResizeImage.resize_short=384 -o PreProcess.transform_ops.1.CropImage.size=384 -o Global.use_gpu:True|False -o Global.enable_mkldnn:True|False -o Global.cpu_num_threads:1|6 diff --git a/test_tipc/prepare.sh b/test_tipc/prepare.sh index bbedf940..db9b4fda 100644 --- a/test_tipc/prepare.sh +++ b/test_tipc/prepare.sh @@ -86,6 +86,11 @@ elif [ ${MODE} = "whole_infer" ] || [ ${MODE} = "klquant_whole_infer" ];then rm -rf inference tar xf "${model_name}_inference.tar" fi + if [[ $model_name == "SwinTransformer_large_patch4_window7_224" || $model_name == "SwinTransformer_large_patch4_window12_384" ]];then + cmd="mv ${model_name}_22kto1k_pretrained.pdparams ${model_name}_pretrained.pdparams" + eval $cmd + fi + elif [ ${MODE} = "whole_train_whole_infer" ];then cd dataset rm -rf ILSVRC2012 -- GitLab