Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. # model settings
  2. normalize = dict(type='GN', num_groups=32, frozen=False)
  3.  
  4. model = dict(
  5. type='MaskRCNN',
  6. pretrained='/nfs/project/libo_i/mmdetection/models/mask_rcnn_r50_fpn_gn_2x_20180113-86832cf2.pth',
  7. backbone=dict(
  8. type='ResNet',
  9. depth=50,
  10. num_stages=4,
  11. out_indices=(0, 1, 2, 3),
  12. frozen_stages=1,
  13. style='pytorch',
  14. normalize=normalize),
  15. neck=dict(
  16. type='FPN',
  17. in_channels=[256, 512, 1024, 2048],
  18. out_channels=256,
  19. num_outs=5,
  20. normalize=normalize),
  21. rpn_head=dict(
  22. type='RPNHead',
  23. in_channels=256,
  24. feat_channels=256,
  25. anchor_scales=[8],
  26. anchor_ratios=[0.5, 1.0, 2.0],
  27. anchor_strides=[4, 8, 16, 32, 64],
  28. target_means=[.0, .0, .0, .0],
  29. target_stds=[1.0, 1.0, 1.0, 1.0],
  30. use_sigmoid_cls=True),
  31. bbox_roi_extractor=dict(
  32. type='SingleRoIExtractor',
  33. roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2),
  34. out_channels=256,
  35. featmap_strides=[4, 8, 16, 32]),
  36. bbox_head=dict(
  37. type='ConvFCBBoxHead',
  38. num_shared_convs=4,
  39. num_shared_fcs=1,
  40. in_channels=256,
  41. conv_out_channels=256,
  42. fc_out_channels=1024,
  43. roi_feat_size=7,
  44. num_classes=81,
  45. target_means=[0., 0., 0., 0.],
  46. target_stds=[0.1, 0.1, 0.2, 0.2],
  47. reg_class_agnostic=False,
  48. normalize=normalize),
  49. mask_roi_extractor=dict(
  50. type='SingleRoIExtractor',
  51. roi_layer=dict(type='RoIAlign', out_size=14, sample_num=2),
  52. out_channels=256,
  53. featmap_strides=[4, 8, 16, 32]),
  54. mask_head=dict(
  55. type='FCNMaskHead',
  56. num_convs=4,
  57. in_channels=256,
  58. conv_out_channels=256,
  59. num_classes=81,
  60. normalize=normalize))
  61.  
  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. ignore_iof_thr=-1),
  71. sampler=dict(
  72. type='RandomSampler',
  73. num=256,
  74. pos_fraction=0.5,
  75. neg_pos_ub=-1,
  76. add_gt_as_proposals=False),
  77. allowed_border=0,
  78. pos_weight=-1,
  79. smoothl1_beta=1 / 9.0,
  80. debug=False),
  81. rcnn=dict(
  82. assigner=dict(
  83. type='MaxIoUAssigner',
  84. pos_iou_thr=0.5,
  85. neg_iou_thr=0.5,
  86. min_pos_iou=0.5,
  87. ignore_iof_thr=-1),
  88. sampler=dict(
  89. type='RandomSampler',
  90. num=512,
  91. pos_fraction=0.25,
  92. neg_pos_ub=-1,
  93. add_gt_as_proposals=True),
  94. mask_size=28,
  95. pos_weight=-1,
  96. debug=False))
  97. test_cfg = dict(
  98. rpn=dict(
  99. nms_across_levels=False,
  100. nms_pre=2000,
  101. nms_post=2000,
  102. max_num=2000,
  103. nms_thr=0.7,
  104. min_bbox_size=0),
  105. rcnn=dict(
  106. score_thr=0.05,
  107. nms=dict(type='nms', iou_thr=0.5),
  108. max_per_img=100,
  109. mask_thr_binary=0.5))
  110. # dataset settings
  111. dataset_type = 'CocoDataset'
  112. data_root = '/nfs/project/libo_i/mmdetection/data/cityscapes/'
  113. img_norm_cfg = dict(
  114. mean=[102.9801, 115.9465, 122.7717], std=[1.0, 1.0, 1.0], to_rgb=False)
  115. data = dict(
  116. imgs_per_gpu=2,
  117. workers_per_gpu=0,
  118. train=dict(
  119. type=dataset_type,
  120. ann_file=data_root + 'annotations/instancesonly_filtered_gtFine_train.json',
  121. img_prefix=data_root + 'leftImg8bit/train/',
  122. img_scale=(1333, 800),
  123. img_norm_cfg=img_norm_cfg,
  124. size_divisor=32,
  125. flip_ratio=0.5,
  126. with_mask=True,
  127. with_crowd=True,
  128. with_label=True),
  129. val=dict(
  130. type=dataset_type,
  131. ann_file=data_root + 'annotations/instancesonly_filtered_gtFine_val.json',
  132. img_prefix=data_root + 'leftImg8bit/val/',
  133. img_scale=(1333, 800),
  134. img_norm_cfg=img_norm_cfg,
  135. size_divisor=32,
  136. flip_ratio=0,
  137. with_mask=True,
  138. with_crowd=True,
  139. with_label=True),
  140. test=dict(
  141. type=dataset_type,
  142. ann_file=data_root + 'annotations/instancesonly_filtered_gtFine_test.json',
  143. img_prefix=data_root + 'leftImg8bit/test/',
  144. img_scale=(1333, 800),
  145. img_norm_cfg=img_norm_cfg,
  146. size_divisor=32,
  147. flip_ratio=0,
  148. with_mask=False,
  149. with_label=False,
  150. test_mode=True))
  151. # optimizer
  152. optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
  153. optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
  154. # learning policy
  155. lr_config = dict(
  156. policy='step',
  157. warmup='linear',
  158. warmup_iters=500,
  159. warmup_ratio=1.0 / 3,
  160. step=[16, 22])
  161. checkpoint_config = dict(interval=1)
  162. # yapf:disable
  163. log_config = dict(
  164. interval=50,
  165. hooks=[
  166. dict(type='TextLoggerHook'),
  167. # dict(type='TensorboardLoggerHook')
  168. ])
  169. # yapf:enable
  170. # runtime settings
  171. total_epochs = 24
  172. dist_params = dict(backend='nccl')
  173. log_level = 'INFO'
  174. work_dir = './work_dirs/cityscapes_mask_rcnn_r50_fpn_gn_2x'
  175. load_from = None
  176. resume_from = None
  177. workflow = [('train', 1)]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement