tood_r50_fpn_1x_coco.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. _base_ = [
  2. '../_base_/datasets/coco_detection.py',
  3. '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
  4. ]
  5. # model settings
  6. model = dict(
  7. type='TOOD',
  8. data_preprocessor=dict(
  9. type='DetDataPreprocessor',
  10. mean=[123.675, 116.28, 103.53],
  11. std=[58.395, 57.12, 57.375],
  12. bgr_to_rgb=True,
  13. pad_size_divisor=32),
  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',
  30. num_outs=5),
  31. bbox_head=dict(
  32. type='TOODHead',
  33. num_classes=80,
  34. in_channels=256,
  35. stacked_convs=6,
  36. feat_channels=256,
  37. anchor_type='anchor_free',
  38. anchor_generator=dict(
  39. type='AnchorGenerator',
  40. ratios=[1.0],
  41. octave_base_scale=8,
  42. scales_per_octave=1,
  43. strides=[8, 16, 32, 64, 128]),
  44. bbox_coder=dict(
  45. type='DeltaXYWHBBoxCoder',
  46. target_means=[.0, .0, .0, .0],
  47. target_stds=[0.1, 0.1, 0.2, 0.2]),
  48. initial_loss_cls=dict(
  49. type='FocalLoss',
  50. use_sigmoid=True,
  51. activated=True, # use probability instead of logit as input
  52. gamma=2.0,
  53. alpha=0.25,
  54. loss_weight=1.0),
  55. loss_cls=dict(
  56. type='QualityFocalLoss',
  57. use_sigmoid=True,
  58. activated=True, # use probability instead of logit as input
  59. beta=2.0,
  60. loss_weight=1.0),
  61. loss_bbox=dict(type='GIoULoss', loss_weight=2.0)),
  62. train_cfg=dict(
  63. initial_epoch=4,
  64. initial_assigner=dict(type='ATSSAssigner', topk=9),
  65. assigner=dict(type='TaskAlignedAssigner', topk=13),
  66. alpha=1,
  67. beta=6,
  68. allowed_border=-1,
  69. pos_weight=-1,
  70. debug=False),
  71. test_cfg=dict(
  72. nms_pre=1000,
  73. min_bbox_size=0,
  74. score_thr=0.05,
  75. nms=dict(type='nms', iou_threshold=0.6),
  76. max_per_img=100))
  77. # optimizer
  78. optim_wrapper = dict(
  79. optimizer=dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001))