atss_r50_fpn_8xb8-amp-lsj-200e_coco.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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='ATSS',
  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. bbox_head=dict(
  31. type='ATSSHead',
  32. num_classes=80,
  33. in_channels=256,
  34. stacked_convs=4,
  35. feat_channels=256,
  36. anchor_generator=dict(
  37. type='AnchorGenerator',
  38. ratios=[1.0],
  39. octave_base_scale=8,
  40. scales_per_octave=1,
  41. strides=[8, 16, 32, 64, 128]),
  42. bbox_coder=dict(
  43. type='DeltaXYWHBBoxCoder',
  44. target_means=[.0, .0, .0, .0],
  45. target_stds=[0.1, 0.1, 0.2, 0.2]),
  46. loss_cls=dict(
  47. type='FocalLoss',
  48. use_sigmoid=True,
  49. gamma=2.0,
  50. alpha=0.25,
  51. loss_weight=1.0),
  52. loss_bbox=dict(type='GIoULoss', loss_weight=2.0),
  53. loss_centerness=dict(
  54. type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0)),
  55. # training and testing settings
  56. train_cfg=dict(
  57. assigner=dict(type='ATSSAssigner', topk=9),
  58. allowed_border=-1,
  59. pos_weight=-1,
  60. debug=False),
  61. test_cfg=dict(
  62. nms_pre=1000,
  63. min_bbox_size=0,
  64. score_thr=0.05,
  65. nms=dict(type='nms', iou_threshold=0.6),
  66. max_per_img=100))
  67. train_dataloader = dict(batch_size=8, num_workers=4)
  68. # Enable automatic-mixed-precision training with AmpOptimWrapper.
  69. optim_wrapper = dict(
  70. type='AmpOptimWrapper',
  71. optimizer=dict(
  72. type='SGD', lr=0.01 * 4, momentum=0.9, weight_decay=0.00004))
  73. # NOTE: `auto_scale_lr` is for automatically scaling LR,
  74. # USER SHOULD NOT CHANGE ITS VALUES.
  75. # base_batch_size = (8 GPUs) x (8 samples per GPU)
  76. auto_scale_lr = dict(base_batch_size=64)