fcos_r50_fpn_gn-head-center-normbbox-centeronreg-giou_8xb8-amp-lsj-200e_coco.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. _base_ = '../common/lsj-200e_coco-detection.py'
  2. image_size = (1024, 1024)
  3. batch_augments = [dict(type='BatchFixedSizePad', size=image_size)]
  4. # model settings
  5. model = dict(
  6. type='FCOS',
  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. norm_cfg=dict(type='BN', requires_grad=True),
  21. norm_eval=True,
  22. style='pytorch',
  23. init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
  24. neck=dict(
  25. type='FPN',
  26. in_channels=[256, 512, 1024, 2048],
  27. out_channels=256,
  28. start_level=1,
  29. add_extra_convs='on_output', # use P5
  30. num_outs=5,
  31. relu_before_extra_convs=True),
  32. bbox_head=dict(
  33. type='FCOSHead',
  34. num_classes=80,
  35. in_channels=256,
  36. stacked_convs=4,
  37. feat_channels=256,
  38. strides=[8, 16, 32, 64, 128],
  39. norm_on_bbox=True,
  40. centerness_on_reg=True,
  41. dcn_on_last_conv=False,
  42. center_sampling=True,
  43. conv_bias=True,
  44. loss_cls=dict(
  45. type='FocalLoss',
  46. use_sigmoid=True,
  47. gamma=2.0,
  48. alpha=0.25,
  49. loss_weight=1.0),
  50. loss_bbox=dict(type='GIoULoss', loss_weight=1.0),
  51. loss_centerness=dict(
  52. type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0)),
  53. # testing settings
  54. test_cfg=dict(
  55. nms_pre=1000,
  56. min_bbox_size=0,
  57. score_thr=0.05,
  58. nms=dict(type='nms', iou_threshold=0.6),
  59. max_per_img=100))
  60. train_dataloader = dict(batch_size=8, num_workers=4)
  61. # Enable automatic-mixed-precision training with AmpOptimWrapper.
  62. optim_wrapper = dict(
  63. type='AmpOptimWrapper',
  64. optimizer=dict(
  65. type='SGD', lr=0.01 * 4, momentum=0.9, weight_decay=0.00004),
  66. paramwise_cfg=dict(bias_lr_mult=2., bias_decay_mult=0.),
  67. clip_grad=dict(max_norm=35, norm_type=2))
  68. # NOTE: `auto_scale_lr` is for automatically scaling LR,
  69. # USER SHOULD NOT CHANGE ITS VALUES.
  70. # base_batch_size = (8 GPUs) x (8 samples per GPU)
  71. auto_scale_lr = dict(base_batch_size=64)