# Runtime
use_ema: true
use_gpu: true
use_xpu: false
use_mlu: false
use_npu: false
log_iter: 20
save_dir: output
snapshot_epoch: 1
print_flops: false
print_params: false

# Dataset
metric: COCO
num_classes: 80

TrainDataset:
  name: COCODataSet
  image_dir: train2017
  anno_path: annotations/instances_train2017.json
  dataset_dir: dataset/coco
  data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']

EvalDataset:
  name: COCODataSet
  image_dir: val2017
  anno_path: annotations/instances_val2017.json
  dataset_dir: dataset/coco
  allow_empty: true

TestDataset:
  name: ImageFolder
  anno_path: annotations/instances_val2017.json # also support txt (like VOC's label_list.txt)
  dataset_dir: dataset/coco # if set, anno_path will be 'dataset_dir/anno_path'


# Reader
worker_num: 4
TrainReader:
  inputs_def:
    image_shape: [3, 512, 512]
  sample_transforms:
    - Decode: {}
    - FlipWarpAffine: {keep_res: False, input_h: 512, input_w: 512, use_random: True}
    - CenterRandColor: {}
    - Lighting: {eigval: [0.2141788, 0.01817699, 0.00341571], eigvec: [[-0.58752847, -0.69563484, 0.41340352], [-0.5832747, 0.00994535, -0.81221408], [-0.56089297, 0.71832671, 0.41158938]]}
    - NormalizeImage: {mean: [0.40789655, 0.44719303, 0.47026116], std: [0.2886383 , 0.27408165, 0.27809834], is_scale: False}
    - Permute: {}
    - Gt2CenterNetTarget: {down_ratio: 4, max_objs: 128}
  batch_size: 16
  shuffle: True
  drop_last: True
  use_shared_memory: True

EvalReader:
  sample_transforms:
    - Decode: {}
    - WarpAffine: {keep_res: True, input_h: 512, input_w: 512}
    - NormalizeImage: {mean: [0.40789655, 0.44719303, 0.47026116], std: [0.2886383 , 0.27408165, 0.27809834]}
    - Permute: {}
  batch_size: 1


TestReader:
  inputs_def:
    image_shape: [3, 512, 512]
  sample_transforms:
    - Decode: {}
    - WarpAffine: {keep_res: True, input_h: 512, input_w: 512}
    - NormalizeImage: {mean: [0.40789655, 0.44719303, 0.47026116], std: [0.2886383 , 0.27408165, 0.27809834], is_scale: True}
    - Permute: {}
  batch_size: 1

# Model
architecture: CenterNet
pretrain_weights: https://bj.bcebos.com/v1/paddledet/models/pretrained/DLA34_pretrain.pdparams

CenterNet:
  backbone: DLA
  neck: CenterNetDLAFPN
  head: CenterNetHead
  post_process: CenterNetPostProcess

DLA:
  depth: 34

CenterNetDLAFPN:
  down_ratio: 4

CenterNetHead:
  head_planes: 256
  regress_ltrb: False

CenterNetPostProcess:
  max_per_img: 100
  regress_ltrb: False

# Optimizer
epoch: 140

LearningRate:
  base_lr: 0.0005
  schedulers:
  - !PiecewiseDecay
    gamma: 0.1
    milestones: [90, 120]
    use_warmup: False

OptimizerBuilder:
  optimizer:
    type: Adam
  regularizer: NULL

# Exporting the model
export:
  post_process: True  # Whether post-processing is included in the network when export model.
  nms: True           # Whether NMS is included in the network when export model.
  benchmark: False    # It is used to testing model performance, if set `True`, post-process and NMS will not be exported.
  fuse_conv_bn: False
