Skip to content

Commit

Permalink
fix config and add coco demo (PaddlePaddle#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
ceci3 committed Apr 1, 2022
1 parent 70a3642 commit fc0882b
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 1 deletion.
3 changes: 2 additions & 1 deletion demo/auto-compression/configs/CV/mbv2_qat_dis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 19 additions & 0 deletions demo/auto-compression/configs/PaddleDet/coco_dataset.yml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions demo/auto-compression/configs/PaddleDet/ppyoloe_reader.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions demo/auto-compression/demo_coco.py
Original file line number Diff line number Diff line change
@@ -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())

0 comments on commit fc0882b

Please sign in to comment.