centernet-update_r50_fpn_8xb8-amp-lsj-200e_coco.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. _base_ = '../common/lsj-200e_coco-detection.py'
  2. image_size = (1024, 1024)
  3. batch_augments = [dict(type='BatchFixedSizePad', size=image_size)]
  4. model = dict(
  5. type='CenterNet',
  6. data_preprocessor=dict(
  7. type='DetDataPreprocessor',
  8. mean=[123.675, 116.28, 103.53],
  9. std=[58.395, 57.12, 57.375],
  10. bgr_to_rgb=True,
  11. pad_size_divisor=32,
  12. batch_augments=batch_augments),
  13. backbone=dict(
  14. type='ResNet',
  15. depth=50,
  16. num_stages=4,
  17. out_indices=(0, 1, 2, 3),
  18. frozen_stages=1,
  19. norm_cfg=dict(type='BN', requires_grad=True),
  20. norm_eval=True,
  21. style='pytorch',
  22. init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
  23. neck=dict(
  24. type='FPN',
  25. in_channels=[256, 512, 1024, 2048],
  26. out_channels=256,
  27. start_level=1,
  28. add_extra_convs='on_output',
  29. num_outs=5,
  30. init_cfg=dict(type='Caffe2Xavier', layer='Conv2d'),
  31. relu_before_extra_convs=True),
  32. bbox_head=dict(
  33. type='CenterNetUpdateHead',
  34. num_classes=80,
  35. in_channels=256,
  36. stacked_convs=4,
  37. feat_channels=256,
  38. strides=[8, 16, 32, 64, 128],
  39. loss_cls=dict(
  40. type='GaussianFocalLoss',
  41. pos_weight=0.25,
  42. neg_weight=0.75,
  43. loss_weight=1.0),
  44. loss_bbox=dict(type='GIoULoss', loss_weight=2.0),
  45. ),
  46. train_cfg=None,
  47. test_cfg=dict(
  48. nms_pre=1000,
  49. min_bbox_size=0,
  50. score_thr=0.05,
  51. nms=dict(type='nms', iou_threshold=0.6),
  52. max_per_img=100))
  53. train_dataloader = dict(batch_size=8, num_workers=4)
  54. # Enable automatic-mixed-precision training with AmpOptimWrapper.
  55. optim_wrapper = dict(
  56. type='AmpOptimWrapper',
  57. optimizer=dict(
  58. type='SGD', lr=0.01 * 4, momentum=0.9, weight_decay=0.00004),
  59. paramwise_cfg=dict(norm_decay_mult=0.))
  60. param_scheduler = [
  61. dict(
  62. type='LinearLR',
  63. start_factor=0.00025,
  64. by_epoch=False,
  65. begin=0,
  66. end=4000),
  67. dict(
  68. type='MultiStepLR',
  69. begin=0,
  70. end=25,
  71. by_epoch=True,
  72. milestones=[22, 24],
  73. gamma=0.1)
  74. ]
  75. # NOTE: `auto_scale_lr` is for automatically scaling LR,
  76. # USER SHOULD NOT CHANGE ITS VALUES.
  77. # base_batch_size = (8 GPUs) x (8 samples per GPU)
  78. auto_scale_lr = dict(base_batch_size=64)