FasterRCNN-ResNet101.yaml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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: -1}
  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: -1}
  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: -1}
  65. batch_size: 1
  66. shuffle: false
  67. drop_last: false
  68. # Model
  69. architecture: FasterRCNN
  70. pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet101_pretrained.pdparams
  71. FasterRCNN:
  72. backbone: ResNet
  73. rpn_head: RPNHead
  74. bbox_head: BBoxHead
  75. # post process
  76. bbox_post_process: BBoxPostProcess
  77. ResNet:
  78. # index 0 stands for res2
  79. depth: 101
  80. norm_type: bn
  81. freeze_at: 0
  82. return_idx: [2]
  83. num_stages: 3
  84. RPNHead:
  85. anchor_generator:
  86. aspect_ratios: [0.5, 1.0, 2.0]
  87. anchor_sizes: [32, 64, 128, 256, 512]
  88. strides: [16]
  89. rpn_target_assign:
  90. batch_size_per_im: 256
  91. fg_fraction: 0.5
  92. negative_overlap: 0.3
  93. positive_overlap: 0.7
  94. use_random: True
  95. train_proposal:
  96. min_size: 0.0
  97. nms_thresh: 0.7
  98. pre_nms_top_n: 12000
  99. post_nms_top_n: 2000
  100. topk_after_collect: False
  101. test_proposal:
  102. min_size: 0.0
  103. nms_thresh: 0.7
  104. pre_nms_top_n: 6000
  105. post_nms_top_n: 1000
  106. BBoxHead:
  107. head: Res5Head
  108. roi_extractor:
  109. resolution: 14
  110. sampling_ratio: 0
  111. aligned: True
  112. bbox_assigner: BBoxAssigner
  113. with_pool: true
  114. BBoxAssigner:
  115. batch_size_per_im: 512
  116. bg_thresh: 0.5
  117. fg_thresh: 0.5
  118. fg_fraction: 0.25
  119. use_random: True
  120. BBoxPostProcess:
  121. decode: RCNNBox
  122. nms:
  123. name: MultiClassNMS
  124. keep_top_k: 100
  125. score_threshold: 0.05
  126. nms_threshold: 0.5
  127. # Optimizer
  128. epoch: 12
  129. LearningRate:
  130. base_lr: 0.01
  131. schedulers:
  132. - !PiecewiseDecay
  133. gamma: 0.1
  134. milestones: [8, 11]
  135. - !LinearWarmup
  136. start_factor: 0.1
  137. steps: 1000
  138. OptimizerBuilder:
  139. optimizer:
  140. momentum: 0.9
  141. type: Momentum
  142. regularizer:
  143. factor: 0.0001
  144. type: L2
  145. # Exporting the model
  146. export:
  147. post_process: True # Whether post-processing is included in the network when export model.
  148. nms: True # Whether NMS is included in the network when export model.
  149. benchmark: False # It is used to testing model performance, if set `True`, post-process and NMS will not be exported.
  150. fuse_conv_bn: False