From 74de24f6212c619b2bc1cc752e82812d2434c618 Mon Sep 17 00:00:00 2001 From: zhangyubo0722 Date: Fri, 6 Jan 2023 12:45:49 +0000 Subject: [PATCH] add swinv2 --- .../backbone/model_zoo/swin_transformer_v2.py | 3 +- ...formerV2_base_patch4_window12to16_256.yaml | 160 ------------------ ...h4_window12to16_256_train_infer_python.txt | 60 ------- 3 files changed, 1 insertion(+), 222 deletions(-) delete mode 100644 ppcls/configs/ImageNet/SwinTransformerV2/SwinTransformerV2_base_patch4_window12to16_256.yaml delete mode 100644 test_tipc/configs/SwinTransformerV2/SwinTransformerV2_base_patch4_window12to16_256_train_infer_python.txt diff --git a/ppcls/arch/backbone/model_zoo/swin_transformer_v2.py b/ppcls/arch/backbone/model_zoo/swin_transformer_v2.py index 67a1b36e..f3944d07 100644 --- a/ppcls/arch/backbone/model_zoo/swin_transformer_v2.py +++ b/ppcls/arch/backbone/model_zoo/swin_transformer_v2.py @@ -883,8 +883,7 @@ def SwinTransformerV2_base_patch4_window8_256(pretrained=False, pretrained, model, MODEL_URLS["SwinTransformerV2_base_patch4_window8_256"], - use_ssld=use_ssld, - use_imagenet22k_pretrained=use_imagenet22k_pretrained) + use_ssld=use_ssld) return model diff --git a/ppcls/configs/ImageNet/SwinTransformerV2/SwinTransformerV2_base_patch4_window12to16_256.yaml b/ppcls/configs/ImageNet/SwinTransformerV2/SwinTransformerV2_base_patch4_window12to16_256.yaml deleted file mode 100644 index fc3f9460..00000000 --- a/ppcls/configs/ImageNet/SwinTransformerV2/SwinTransformerV2_base_patch4_window12to16_256.yaml +++ /dev/null @@ -1,160 +0,0 @@ -# global configs -Global: - checkpoints: null - pretrained_model: null - output_dir: ./output/ - device: gpu - save_interval: 1 - eval_during_train: True - eval_interval: 1 - epochs: 300 - print_batch_step: 10 - use_visualdl: False - # used for static mode and model export - image_shape: [3, 256, 256] - save_inference_dir: ./inference - # training model under @to_static - to_static: False - -# model architecture -Arch: - name: SwinTransformerV2_base_patch4_window12to16_256 - class_num: 1000 - -# loss function config for traing/eval process -Loss: - Train: - - CELoss: - weight: 1.0 - epsilon: 0.1 - Eval: - - CELoss: - weight: 1.0 - - -Optimizer: - name: AdamW - beta1: 0.9 - beta2: 0.999 - epsilon: 1e-8 - weight_decay: 0.05 - no_weight_decay_name: absolute_pos_embed relative_position_bias_table .bias norm - one_dim_param_no_weight_decay: True - lr: - # for 8 cards - name: Cosine - learning_rate: 1e-3 - eta_min: 1e-5 - warmup_epoch: 20 - warmup_start_lr: 1e-6 - - -# data loader for train and eval -DataLoader: - Train: - dataset: - name: ImageNetDataset - image_root: ./dataset/ILSVRC2012/ - cls_label_path: ./dataset/ILSVRC2012/train_list.txt - transform_ops: - - DecodeImage: - to_rgb: True - channel_first: False - - RandCropImage: - size: 256 - interpolation: bicubic - backend: pil - - RandFlipImage: - flip_code: 1 - - TimmAutoAugment: - config_str: rand-m9-mstd0.5-inc1 - interpolation: bicubic - img_size: 256 - - NormalizeImage: - scale: 1.0/255.0 - mean: [0.485, 0.456, 0.406] - std: [0.229, 0.224, 0.225] - order: '' - - RandomErasing: - EPSILON: 0.25 - sl: 0.02 - sh: 1.0/3.0 - r1: 0.3 - attempt: 10 - use_log_aspect: True - mode: pixel - batch_transform_ops: - - OpSampler: - MixupOperator: - alpha: 0.8 - prob: 0.5 - CutmixOperator: - alpha: 1.0 - prob: 0.5 - - sampler: - name: DistributedBatchSampler - batch_size: 128 - drop_last: False - shuffle: True - loader: - num_workers: 4 - use_shared_memory: True - - Eval: - dataset: - name: ImageNetDataset - image_root: ./dataset/ILSVRC2012/ - cls_label_path: ./dataset/ILSVRC2012/val_list.txt - transform_ops: - - DecodeImage: - to_rgb: True - channel_first: False - - ResizeImage: - resize_short: 292 - interpolation: bicubic - backend: pil - - CropImage: - size: 256 - - NormalizeImage: - scale: 1.0/255.0 - mean: [0.485, 0.456, 0.406] - std: [0.229, 0.224, 0.225] - order: '' - sampler: - name: DistributedBatchSampler - batch_size: 128 - drop_last: False - shuffle: False - loader: - num_workers: 4 - use_shared_memory: True - -Infer: - infer_imgs: docs/images/inference_deployment/whl_demo.jpg - batch_size: 10 - transforms: - - DecodeImage: - to_rgb: True - channel_first: False - - ResizeImage: - resize_short: 292 - interpolation: bicubic - backend: pil - - CropImage: - size: 256 - - NormalizeImage: - scale: 1.0/255.0 - mean: [0.485, 0.456, 0.406] - std: [0.229, 0.224, 0.225] - order: '' - - ToCHWImage: - PostProcess: - name: Topk - topk: 5 - class_id_map_file: ppcls/utils/imagenet1k_label_list.txt - -Metric: - Eval: - - TopkAcc: - topk: [1, 5] diff --git a/test_tipc/configs/SwinTransformerV2/SwinTransformerV2_base_patch4_window12to16_256_train_infer_python.txt b/test_tipc/configs/SwinTransformerV2/SwinTransformerV2_base_patch4_window12to16_256_train_infer_python.txt deleted file mode 100644 index d774ca97..00000000 --- a/test_tipc/configs/SwinTransformerV2/SwinTransformerV2_base_patch4_window12to16_256_train_infer_python.txt +++ /dev/null @@ -1,60 +0,0 @@ -===========================train_params=========================== -model_name:SwinTransformerV2_base_patch4_window12to16_256 -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/SwinTransformerV2/SwinTransformerV2_base_patch4_window12to16_256.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 -o Global.eval_during_train=False -o Global.save_interval=2 -pact_train:null -fpgm_train:null -distill_train:null -null:null -null:null -## -===========================eval_params=========================== -eval:tools/eval.py -c ppcls/configs/ImageNet/SwinTransformerV2/SwinTransformerV2_base_patch4_window12to16_256.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/SwinTransformerV2/SwinTransformerV2_base_patch4_window12to16_256.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/SwinTransformerV2_base_patch4_window12to16_256_22kto1k_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:False --o Global.cpu_num_threads:1 --o Global.batch_size:1 --o Global.use_tensorrt:False --o Global.use_fp16:False --o Global.inference_model_dir:../inference --o Global.infer_imgs:../dataset/ILSVRC2012/val/ILSVRC2012_val_00000001.JPEG --o Global.save_log_path:null --o Global.benchmark:False -null:null -null:null -===========================train_benchmark_params========================== -batch_size:104|128 -fp_items:fp32|fp16 -epoch:1 ---profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile -flags:FLAGS_eager_delete_tensor_gb=0.0;FLAGS_fraction_of_gpu_memory_to_use=0.98;FLAGS_conv_workspace_size_limit=4096 -===========================infer_benchmark_params========================== -random_infer_input:[{float32,[3,256,256]}] \ No newline at end of file -- GitLab