condinst_r50_fpn_ms-poly-90k_coco_instance.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. _base_ = '../common/ms-poly-90k_coco-instance.py'
  2. # model settings
  3. model = dict(
  4. type='CondInst',
  5. data_preprocessor=dict(
  6. type='DetDataPreprocessor',
  7. mean=[123.675, 116.28, 103.53],
  8. std=[58.395, 57.12, 57.375],
  9. bgr_to_rgb=True,
  10. pad_mask=True,
  11. pad_size_divisor=32),
  12. backbone=dict(
  13. type='ResNet',
  14. depth=50,
  15. num_stages=4,
  16. out_indices=(0, 1, 2, 3),
  17. frozen_stages=1,
  18. norm_cfg=dict(type='BN', requires_grad=True),
  19. norm_eval=True,
  20. init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50'),
  21. style='pytorch'),
  22. neck=dict(
  23. type='FPN',
  24. in_channels=[256, 512, 1024, 2048],
  25. out_channels=256,
  26. start_level=1,
  27. add_extra_convs='on_output', # use P5
  28. num_outs=5,
  29. relu_before_extra_convs=True),
  30. bbox_head=dict(
  31. type='CondInstBboxHead',
  32. num_params=169,
  33. num_classes=80,
  34. in_channels=256,
  35. stacked_convs=4,
  36. feat_channels=256,
  37. strides=[8, 16, 32, 64, 128],
  38. norm_on_bbox=True,
  39. centerness_on_reg=True,
  40. dcn_on_last_conv=False,
  41. center_sampling=True,
  42. conv_bias=True,
  43. loss_cls=dict(
  44. type='FocalLoss',
  45. use_sigmoid=True,
  46. gamma=2.0,
  47. alpha=0.25,
  48. loss_weight=1.0),
  49. loss_bbox=dict(type='GIoULoss', loss_weight=1.0),
  50. loss_centerness=dict(
  51. type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0)),
  52. mask_head=dict(
  53. type='CondInstMaskHead',
  54. num_layers=3,
  55. feat_channels=8,
  56. size_of_interest=8,
  57. mask_out_stride=4,
  58. max_masks_to_train=300,
  59. mask_feature_head=dict(
  60. in_channels=256,
  61. feat_channels=128,
  62. start_level=0,
  63. end_level=2,
  64. out_channels=8,
  65. mask_stride=8,
  66. num_stacked_convs=4,
  67. norm_cfg=dict(type='BN', requires_grad=True)),
  68. loss_mask=dict(
  69. type='DiceLoss',
  70. use_sigmoid=True,
  71. activate=True,
  72. eps=5e-6,
  73. loss_weight=1.0)),
  74. # model training and testing settings
  75. test_cfg=dict(
  76. nms_pre=1000,
  77. min_bbox_size=0,
  78. score_thr=0.05,
  79. nms=dict(type='nms', iou_threshold=0.6),
  80. max_per_img=100,
  81. mask_thr=0.5))
  82. # optimizer
  83. optim_wrapper = dict(optimizer=dict(lr=0.01))