solo_r50_fpn_8xb8-lsj-200e_coco.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. _base_ = '../common/lsj-200e_coco-instance.py'
  2. image_size = (1024, 1024)
  3. batch_augments = [dict(type='BatchFixedSizePad', size=image_size)]
  4. # model settings
  5. model = dict(
  6. type='SOLO',
  7. data_preprocessor=dict(
  8. type='DetDataPreprocessor',
  9. mean=[123.675, 116.28, 103.53],
  10. std=[58.395, 57.12, 57.375],
  11. bgr_to_rgb=True,
  12. pad_size_divisor=32,
  13. batch_augments=batch_augments),
  14. backbone=dict(
  15. type='ResNet',
  16. depth=50,
  17. num_stages=4,
  18. out_indices=(0, 1, 2, 3),
  19. frozen_stages=1,
  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=0,
  27. num_outs=5),
  28. mask_head=dict(
  29. type='SOLOHead',
  30. num_classes=80,
  31. in_channels=256,
  32. stacked_convs=7,
  33. feat_channels=256,
  34. strides=[8, 8, 16, 32, 32],
  35. scale_ranges=((1, 96), (48, 192), (96, 384), (192, 768), (384, 2048)),
  36. pos_scale=0.2,
  37. num_grids=[40, 36, 24, 16, 12],
  38. cls_down_index=0,
  39. loss_mask=dict(type='DiceLoss', use_sigmoid=True, loss_weight=3.0),
  40. loss_cls=dict(
  41. type='FocalLoss',
  42. use_sigmoid=True,
  43. gamma=2.0,
  44. alpha=0.25,
  45. loss_weight=1.0),
  46. norm_cfg=dict(type='GN', num_groups=32, requires_grad=True)),
  47. # model training and testing settings
  48. test_cfg=dict(
  49. nms_pre=500,
  50. score_thr=0.1,
  51. mask_thr=0.5,
  52. filter_thr=0.05,
  53. kernel='gaussian', # gaussian/linear
  54. sigma=2.0,
  55. max_per_img=100))
  56. train_dataloader = dict(batch_size=8, num_workers=4)
  57. # Enable automatic-mixed-precision training with AmpOptimWrapper.
  58. optim_wrapper = dict(
  59. type='AmpOptimWrapper',
  60. optimizer=dict(
  61. type='SGD', lr=0.01 * 4, momentum=0.9, weight_decay=0.00004),
  62. clip_grad=dict(max_norm=35, norm_type=2))
  63. # NOTE: `auto_scale_lr` is for automatically scaling LR,
  64. # USER SHOULD NOT CHANGE ITS VALUES.
  65. # base_batch_size = (8 GPUs) x (8 samples per GPU)
  66. auto_scale_lr = dict(base_batch_size=64)