diff --git a/demo/auto-compression/configs/CV/mbv2_qat_dis.yaml b/demo/auto-compression/configs/CV/mbv2_qat_dis.yaml index fd5a6977864fc4d08c2cfe0c3b3f32a77189b8d5..f68e24dc597161d6f1ffd469329cbb3cea7f651d 100644 --- a/demo/auto-compression/configs/CV/mbv2_qat_dis.yaml +++ b/demo/auto-compression/configs/CV/mbv2_qat_dis.yaml @@ -58,5 +58,6 @@ TrainConfig: eval_iter: 1000 learning_rate: 0.0001 optimizer: SGD + optim_args: + weight_decay: 4.0e-05 origin_metric: 0.765 - weight_decay: 4.0e-05 diff --git a/demo/auto-compression/configs/PaddleDet/coco_dataset.yml b/demo/auto-compression/configs/PaddleDet/coco_dataset.yml new file mode 100644 index 0000000000000000000000000000000000000000..7a62c3b0b57a5d76c8ed519d3a3940c1b4532c15 --- /dev/null +++ b/demo/auto-compression/configs/PaddleDet/coco_dataset.yml @@ -0,0 +1,19 @@ +metric: COCO +num_classes: 80 + +TrainDataset: + !COCODataSet + image_dir: train2017 + anno_path: annotations/instances_train2017.json + dataset_dir: dataset/coco + data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd'] + +EvalDataset: + !COCODataSet + image_dir: val2017 + anno_path: annotations/instances_val2017.json + dataset_dir: dataset/coco + +TestDataset: + !ImageFolder + anno_path: annotations/instances_val2017.json diff --git a/demo/auto-compression/configs/PaddleDet/ppyoloe_reader.yml b/demo/auto-compression/configs/PaddleDet/ppyoloe_reader.yml new file mode 100644 index 0000000000000000000000000000000000000000..a6a1ce6b22fa3a9d765a85a807aa407893cb6c9f --- /dev/null +++ b/demo/auto-compression/configs/PaddleDet/ppyoloe_reader.yml @@ -0,0 +1,40 @@ +_BASE_: [ + './coco_dataset.yml', +] + +worker_num: 8 +TrainReader: + sample_transforms: + - Decode: {} + - RandomDistort: {} + - RandomExpand: {fill_value: [123.675, 116.28, 103.53]} + - RandomCrop: {} + - RandomFlip: {} + batch_transforms: + - BatchRandomResize: {target_size: [320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, 768], random_size: True, random_interp: True, keep_ratio: False} + - NormalizeImage: {mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225], is_scale: True} + - Permute: {} + - PadGT: {} + batch_size: 24 + shuffle: true + drop_last: true + use_shared_memory: true + collate_batch: true + +EvalReader: + sample_transforms: + - Decode: {} + - Resize: {target_size: [640, 640], keep_ratio: False, interp: 2} + - NormalizeImage: {mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225], is_scale: True} + - Permute: {} + batch_size: 4 + +TestReader: + inputs_def: + image_shape: [3, 640, 640] + sample_transforms: + - Decode: {} + - Resize: {target_size: [640, 640], keep_ratio: False, interp: 2} + - NormalizeImage: {mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225], is_scale: True} + - Permute: {} + batch_size: 1 diff --git a/demo/auto-compression/demo_coco.py b/demo/auto-compression/demo_coco.py new file mode 100644 index 0000000000000000000000000000000000000000..0164b28cdd55b3ffbd48fa74bca6811f243319a2 --- /dev/null +++ b/demo/auto-compression/demo_coco.py @@ -0,0 +1,16 @@ +import os +import sys +sys.path[0] = os.path.join(os.path.dirname("__file__"), os.path.pardir) +import argparse + +from ppdet.core.workspace import load_config, merge_config +from ppdet.core.workspace import create + +cfg = load_config('./configs/PaddleDet/ppyoloe_reader.yml') + +print(cfg) + +coco_loader = create('TestReader')(cfg['TrainDataset'], cfg['worker_num']) + +for data in coco_loader: + print(data.keys())