faster-rcnn_r50_fpn.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # model settings
  2. model = dict(
  3. type='FasterRCNN',
  4. data_preprocessor=dict(
  5. type='DetDataPreprocessor',
  6. mean=[123.675, 116.28, 103.53],
  7. std=[58.395, 57.12, 57.375],
  8. bgr_to_rgb=True,
  9. pad_size_divisor=32),
  10. backbone=dict(
  11. type='ResNet',
  12. depth=50,
  13. num_stages=4,
  14. out_indices=(0, 1, 2, 3),
  15. frozen_stages=1,
  16. norm_cfg=dict(type='BN', requires_grad=True),
  17. norm_eval=True,
  18. style='pytorch',
  19. init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
  20. neck=dict(
  21. type='FPN',
  22. in_channels=[256, 512, 1024, 2048],
  23. out_channels=256,
  24. num_outs=5),
  25. rpn_head=dict(
  26. type='RPNHead',
  27. in_channels=256,
  28. feat_channels=256,
  29. anchor_generator=dict(
  30. type='AnchorGenerator',
  31. scales=[8],
  32. ratios=[0.5, 1.0, 2.0],
  33. strides=[4, 8, 16, 32, 64]),
  34. bbox_coder=dict(
  35. type='DeltaXYWHBBoxCoder',
  36. target_means=[.0, .0, .0, .0],
  37. target_stds=[1.0, 1.0, 1.0, 1.0]),
  38. loss_cls=dict(
  39. type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
  40. loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
  41. roi_head=dict(
  42. type='StandardRoIHead',
  43. bbox_roi_extractor=dict(
  44. type='SingleRoIExtractor',
  45. roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0),
  46. out_channels=256,
  47. featmap_strides=[4, 8, 16, 32]),
  48. bbox_head=dict(
  49. type='Shared2FCBBoxHead',
  50. in_channels=256,
  51. fc_out_channels=1024,
  52. roi_feat_size=7,
  53. num_classes=80,
  54. bbox_coder=dict(
  55. type='DeltaXYWHBBoxCoder',
  56. target_means=[0., 0., 0., 0.],
  57. target_stds=[0.1, 0.1, 0.2, 0.2]),
  58. reg_class_agnostic=False,
  59. loss_cls=dict(
  60. type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
  61. loss_bbox=dict(type='L1Loss', loss_weight=1.0))),
  62. # model training and testing settings
  63. train_cfg=dict(
  64. rpn=dict(
  65. assigner=dict(
  66. type='MaxIoUAssigner',
  67. pos_iou_thr=0.7,
  68. neg_iou_thr=0.3,
  69. min_pos_iou=0.3,
  70. match_low_quality=True,
  71. ignore_iof_thr=-1),
  72. sampler=dict(
  73. type='RandomSampler',
  74. num=256,
  75. pos_fraction=0.5,
  76. neg_pos_ub=-1,
  77. add_gt_as_proposals=False),
  78. allowed_border=-1,
  79. pos_weight=-1,
  80. debug=False),
  81. rpn_proposal=dict(
  82. nms_pre=2000,
  83. max_per_img=1000,
  84. nms=dict(type='nms', iou_threshold=0.7),
  85. min_bbox_size=0),
  86. rcnn=dict(
  87. assigner=dict(
  88. type='MaxIoUAssigner',
  89. pos_iou_thr=0.5,
  90. neg_iou_thr=0.5,
  91. min_pos_iou=0.5,
  92. match_low_quality=False,
  93. ignore_iof_thr=-1),
  94. sampler=dict(
  95. type='RandomSampler',
  96. num=512,
  97. pos_fraction=0.25,
  98. neg_pos_ub=-1,
  99. add_gt_as_proposals=True),
  100. pos_weight=-1,
  101. debug=False)),
  102. test_cfg=dict(
  103. rpn=dict(
  104. nms_pre=1000,
  105. max_per_img=1000,
  106. nms=dict(type='nms', iou_threshold=0.7),
  107. min_bbox_size=0),
  108. rcnn=dict(
  109. score_thr=0.05,
  110. nms=dict(type='nms', iou_threshold=0.5),
  111. max_per_img=100)
  112. # soft-nms is also supported for rcnn testing
  113. # e.g., nms=dict(type='soft_nms', iou_threshold=0.5, min_score=0.05)
  114. ))