DETR-R50.yaml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. # Runtime
  2. use_ema: true
  3. find_unused_parameters: True
  4. use_gpu: true
  5. use_xpu: false
  6. use_mlu: false
  7. use_npu: false
  8. log_iter: 20
  9. save_dir: output
  10. snapshot_epoch: 1
  11. print_flops: false
  12. print_params: false
  13. # Dataset
  14. metric: COCO
  15. num_classes: 80
  16. TrainDataset:
  17. name: COCODataSet
  18. image_dir: train2017
  19. anno_path: annotations/instances_train2017.json
  20. dataset_dir: dataset/coco
  21. data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
  22. EvalDataset:
  23. name: COCODataSet
  24. image_dir: val2017
  25. anno_path: annotations/instances_val2017.json
  26. dataset_dir: dataset/coco
  27. allow_empty: true
  28. TestDataset:
  29. name: ImageFolder
  30. anno_path: annotations/instances_val2017.json # also support txt (like VOC's label_list.txt)
  31. dataset_dir: dataset/coco # if set, anno_path will be 'dataset_dir/anno_path'
  32. # Reader
  33. worker_num: 0
  34. TrainReader:
  35. sample_transforms:
  36. - Decode: {}
  37. - RandomFlip: {prob: 0.5}
  38. - RandomSelect: { transforms1: [ RandomShortSideResize: { short_side_sizes: [ 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800 ], max_size: 1333 } ],
  39. transforms2: [
  40. RandomShortSideResize: { short_side_sizes: [ 400, 500, 600 ] },
  41. RandomSizeCrop: { min_size: 384, max_size: 600 },
  42. RandomShortSideResize: { short_side_sizes: [ 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800 ], max_size: 1333 } ]
  43. }
  44. - NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
  45. - NormalizeBox: {}
  46. - BboxXYXY2XYWH: {}
  47. - Permute: {}
  48. batch_transforms:
  49. - PadMaskBatch: {pad_to_stride: -1, return_pad_mask: true}
  50. batch_size: 2
  51. shuffle: true
  52. drop_last: true
  53. collate_batch: false
  54. use_shared_memory: false
  55. EvalReader:
  56. sample_transforms:
  57. - Decode: {}
  58. - Resize: {target_size: [800, 1333], keep_ratio: True}
  59. - NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
  60. - Permute: {}
  61. batch_size: 1
  62. shuffle: false
  63. drop_last: false
  64. TestReader:
  65. sample_transforms:
  66. - Decode: {}
  67. - Resize: {target_size: [800, 1333], keep_ratio: True}
  68. - NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
  69. - Permute: {}
  70. batch_size: 1
  71. shuffle: false
  72. drop_last: false
  73. # Model
  74. architecture: DETR
  75. pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_vb_normal_pretrained.pdparams
  76. hidden_dim: 256
  77. DETR:
  78. backbone: ResNet
  79. transformer: DETRTransformer
  80. detr_head: DETRHead
  81. post_process: DETRPostProcess
  82. ResNet:
  83. # index 0 stands for res2
  84. depth: 50
  85. norm_type: bn
  86. freeze_at: 0
  87. return_idx: [3]
  88. lr_mult_list: [0.0, 0.1, 0.1, 0.1]
  89. num_stages: 4
  90. DETRTransformer:
  91. num_queries: 100
  92. position_embed_type: sine
  93. nhead: 8
  94. num_encoder_layers: 6
  95. num_decoder_layers: 6
  96. dim_feedforward: 2048
  97. dropout: 0.1
  98. activation: relu
  99. DETRHead:
  100. num_mlp_layers: 3
  101. DETRLoss:
  102. loss_coeff: {class: 1, bbox: 5, giou: 2, no_object: 0.1}
  103. aux_loss: True
  104. HungarianMatcher:
  105. matcher_coeff: {class: 1, bbox: 5, giou: 2}
  106. # Optimizer
  107. epoch: 500
  108. LearningRate:
  109. base_lr: 0.0001
  110. schedulers:
  111. - !PiecewiseDecay
  112. gamma: 0.1
  113. milestones: [400]
  114. use_warmup: false
  115. OptimizerBuilder:
  116. clip_grad_by_norm: 0.1
  117. regularizer: false
  118. optimizer:
  119. type: AdamW
  120. weight_decay: 0.0001
  121. # Exporting the model
  122. export:
  123. post_process: True # Whether post-processing is included in the network when export model.
  124. nms: True # Whether NMS is included in the network when export model.
  125. benchmark: False # It is used to testing model performance, if set `True`, post-process and NMS will not be exported.
  126. fuse_conv_bn: False