Cascade-FasterRCNN-ResNet50-FPN.yaml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. # Runtime
  2. use_gpu: true
  3. use_xpu: false
  4. use_mlu: false
  5. use_npu: false
  6. log_iter: 20
  7. save_dir: output
  8. snapshot_epoch: 1
  9. print_flops: false
  10. print_params: false
  11. use_ema: true
  12. # Dataset
  13. metric: COCO
  14. num_classes: 80
  15. TrainDataset:
  16. name: COCODataSet
  17. image_dir: train2017
  18. anno_path: annotations/instances_train2017.json
  19. dataset_dir: dataset/coco
  20. data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
  21. EvalDataset:
  22. name: COCODataSet
  23. image_dir: val2017
  24. anno_path: annotations/instances_val2017.json
  25. dataset_dir: dataset/coco
  26. allow_empty: true
  27. TestDataset:
  28. name: ImageFolder
  29. anno_path: annotations/instances_val2017.json # also support txt (like VOC's label_list.txt)
  30. dataset_dir: dataset/coco # if set, anno_path will be 'dataset_dir/anno_path'
  31. # Reader
  32. worker_num: 2
  33. TrainReader:
  34. sample_transforms:
  35. - Decode: {}
  36. - RandomResize: {target_size: [[640, 1333], [672, 1333], [704, 1333], [736, 1333], [768, 1333], [800, 1333]], interp: 2, keep_ratio: True}
  37. - RandomFlip: {prob: 0.5}
  38. - NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
  39. - Permute: {}
  40. batch_transforms:
  41. - PadBatch: {pad_to_stride: 32}
  42. batch_size: 1
  43. shuffle: true
  44. drop_last: true
  45. collate_batch: false
  46. EvalReader:
  47. sample_transforms:
  48. - Decode: {}
  49. - Resize: {interp: 2, target_size: [800, 1333], keep_ratio: True}
  50. - NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
  51. - Permute: {}
  52. batch_transforms:
  53. - PadBatch: {pad_to_stride: 32}
  54. batch_size: 1
  55. shuffle: false
  56. drop_last: false
  57. TestReader:
  58. sample_transforms:
  59. - Decode: {}
  60. - Resize: {interp: 2, target_size: [800, 1333], keep_ratio: True}
  61. - NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
  62. - Permute: {}
  63. batch_transforms:
  64. - PadBatch: {pad_to_stride: 32}
  65. batch_size: 1
  66. shuffle: false
  67. drop_last: false
  68. # Model
  69. architecture: CascadeRCNN
  70. pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_cos_pretrained.pdparams
  71. CascadeRCNN:
  72. backbone: ResNet
  73. neck: FPN
  74. rpn_head: RPNHead
  75. bbox_head: CascadeHead
  76. # post process
  77. bbox_post_process: BBoxPostProcess
  78. ResNet:
  79. # index 0 stands for res2
  80. depth: 50
  81. norm_type: bn
  82. freeze_at: 0
  83. return_idx: [0,1,2,3]
  84. num_stages: 4
  85. FPN:
  86. out_channel: 256
  87. RPNHead:
  88. anchor_generator:
  89. aspect_ratios: [0.5, 1.0, 2.0]
  90. anchor_sizes: [[32], [64], [128], [256], [512]]
  91. strides: [4, 8, 16, 32, 64]
  92. rpn_target_assign:
  93. batch_size_per_im: 256
  94. fg_fraction: 0.5
  95. negative_overlap: 0.3
  96. positive_overlap: 0.7
  97. use_random: True
  98. train_proposal:
  99. min_size: 0.0
  100. nms_thresh: 0.7
  101. pre_nms_top_n: 2000
  102. post_nms_top_n: 2000
  103. topk_after_collect: True
  104. test_proposal:
  105. min_size: 0.0
  106. nms_thresh: 0.7
  107. pre_nms_top_n: 1000
  108. post_nms_top_n: 1000
  109. CascadeHead:
  110. head: CascadeTwoFCHead
  111. roi_extractor:
  112. resolution: 7
  113. sampling_ratio: 0
  114. aligned: True
  115. bbox_assigner: BBoxAssigner
  116. BBoxAssigner:
  117. batch_size_per_im: 512
  118. bg_thresh: 0.5
  119. fg_thresh: 0.5
  120. fg_fraction: 0.25
  121. cascade_iou: [0.5, 0.6, 0.7]
  122. use_random: True
  123. CascadeTwoFCHead:
  124. out_channel: 1024
  125. BBoxPostProcess:
  126. decode:
  127. name: RCNNBox
  128. prior_box_var: [30.0, 30.0, 15.0, 15.0]
  129. nms:
  130. name: MultiClassNMS
  131. keep_top_k: 100
  132. score_threshold: 0.05
  133. nms_threshold: 0.5
  134. # Optimizer
  135. epoch: 12
  136. LearningRate:
  137. base_lr: 0.01
  138. schedulers:
  139. - !PiecewiseDecay
  140. gamma: 0.1
  141. milestones: [8, 11]
  142. - !LinearWarmup
  143. start_factor: 0.001
  144. steps: 1000
  145. OptimizerBuilder:
  146. optimizer:
  147. momentum: 0.9
  148. type: Momentum
  149. regularizer:
  150. factor: 0.0001
  151. type: L2
  152. # Exporting the model
  153. export:
  154. post_process: True # Whether post-processing is included in the network when export model.
  155. nms: True # Whether NMS is included in the network when export model.
  156. benchmark: False # It is used to testing model performance, if set `True`, post-process and NMS will not be exported.
  157. fuse_conv_bn: False