mask-rcnn_r50-caffe-c4.py 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # model settings
  2. norm_cfg = dict(type='BN', requires_grad=False)
  3. model = dict(
  4. type='MaskRCNN',
  5. data_preprocessor=dict(
  6. type='DetDataPreprocessor',
  7. mean=[103.530, 116.280, 123.675],
  8. std=[1.0, 1.0, 1.0],
  9. bgr_to_rgb=False,
  10. pad_mask=True,
  11. pad_size_divisor=32),
  12. backbone=dict(
  13. type='ResNet',
  14. depth=50,
  15. num_stages=3,
  16. strides=(1, 2, 2),
  17. dilations=(1, 1, 1),
  18. out_indices=(2, ),
  19. frozen_stages=1,
  20. norm_cfg=norm_cfg,
  21. norm_eval=True,
  22. style='caffe',
  23. init_cfg=dict(
  24. type='Pretrained',
  25. checkpoint='open-mmlab://detectron2/resnet50_caffe')),
  26. rpn_head=dict(
  27. type='RPNHead',
  28. in_channels=1024,
  29. feat_channels=1024,
  30. anchor_generator=dict(
  31. type='AnchorGenerator',
  32. scales=[2, 4, 8, 16, 32],
  33. ratios=[0.5, 1.0, 2.0],
  34. strides=[16]),
  35. bbox_coder=dict(
  36. type='DeltaXYWHBBoxCoder',
  37. target_means=[.0, .0, .0, .0],
  38. target_stds=[1.0, 1.0, 1.0, 1.0]),
  39. loss_cls=dict(
  40. type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
  41. loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
  42. roi_head=dict(
  43. type='StandardRoIHead',
  44. shared_head=dict(
  45. type='ResLayer',
  46. depth=50,
  47. stage=3,
  48. stride=2,
  49. dilation=1,
  50. style='caffe',
  51. norm_cfg=norm_cfg,
  52. norm_eval=True),
  53. bbox_roi_extractor=dict(
  54. type='SingleRoIExtractor',
  55. roi_layer=dict(type='RoIAlign', output_size=14, sampling_ratio=0),
  56. out_channels=1024,
  57. featmap_strides=[16]),
  58. bbox_head=dict(
  59. type='BBoxHead',
  60. with_avg_pool=True,
  61. roi_feat_size=7,
  62. in_channels=2048,
  63. num_classes=80,
  64. bbox_coder=dict(
  65. type='DeltaXYWHBBoxCoder',
  66. target_means=[0., 0., 0., 0.],
  67. target_stds=[0.1, 0.1, 0.2, 0.2]),
  68. reg_class_agnostic=False,
  69. loss_cls=dict(
  70. type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
  71. loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
  72. mask_roi_extractor=None,
  73. mask_head=dict(
  74. type='FCNMaskHead',
  75. num_convs=0,
  76. in_channels=2048,
  77. conv_out_channels=256,
  78. num_classes=80,
  79. loss_mask=dict(
  80. type='CrossEntropyLoss', use_mask=True, loss_weight=1.0))),
  81. # model training and testing settings
  82. train_cfg=dict(
  83. rpn=dict(
  84. assigner=dict(
  85. type='MaxIoUAssigner',
  86. pos_iou_thr=0.7,
  87. neg_iou_thr=0.3,
  88. min_pos_iou=0.3,
  89. match_low_quality=True,
  90. ignore_iof_thr=-1),
  91. sampler=dict(
  92. type='RandomSampler',
  93. num=256,
  94. pos_fraction=0.5,
  95. neg_pos_ub=-1,
  96. add_gt_as_proposals=False),
  97. allowed_border=0,
  98. pos_weight=-1,
  99. debug=False),
  100. rpn_proposal=dict(
  101. nms_pre=12000,
  102. max_per_img=2000,
  103. nms=dict(type='nms', iou_threshold=0.7),
  104. min_bbox_size=0),
  105. rcnn=dict(
  106. assigner=dict(
  107. type='MaxIoUAssigner',
  108. pos_iou_thr=0.5,
  109. neg_iou_thr=0.5,
  110. min_pos_iou=0.5,
  111. match_low_quality=False,
  112. ignore_iof_thr=-1),
  113. sampler=dict(
  114. type='RandomSampler',
  115. num=512,
  116. pos_fraction=0.25,
  117. neg_pos_ub=-1,
  118. add_gt_as_proposals=True),
  119. mask_size=14,
  120. pos_weight=-1,
  121. debug=False)),
  122. test_cfg=dict(
  123. rpn=dict(
  124. nms_pre=6000,
  125. nms=dict(type='nms', iou_threshold=0.7),
  126. max_per_img=1000,
  127. min_bbox_size=0),
  128. rcnn=dict(
  129. score_thr=0.05,
  130. nms=dict(type='nms', iou_threshold=0.5),
  131. max_per_img=100,
  132. mask_thr_binary=0.5)))