rpn_r50_fpn.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # model settings
  2. model = dict(
  3. type='RPN',
  4. data_preprocessor=dict(
  5. type='DetDataPreprocessor',
  6. mean=[123.675, 116.28, 103.53],
  7. std=[58.395, 57.12, 57.375],
  8. bgr_to_rgb=True,
  9. pad_size_divisor=32),
  10. backbone=dict(
  11. type='ResNet',
  12. depth=50,
  13. num_stages=4,
  14. out_indices=(0, 1, 2, 3),
  15. frozen_stages=1,
  16. norm_cfg=dict(type='BN', requires_grad=True),
  17. norm_eval=True,
  18. style='pytorch',
  19. init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
  20. neck=dict(
  21. type='FPN',
  22. in_channels=[256, 512, 1024, 2048],
  23. out_channels=256,
  24. num_outs=5),
  25. rpn_head=dict(
  26. type='RPNHead',
  27. in_channels=256,
  28. feat_channels=256,
  29. anchor_generator=dict(
  30. type='AnchorGenerator',
  31. scales=[8],
  32. ratios=[0.5, 1.0, 2.0],
  33. strides=[4, 8, 16, 32, 64]),
  34. bbox_coder=dict(
  35. type='DeltaXYWHBBoxCoder',
  36. target_means=[.0, .0, .0, .0],
  37. target_stds=[1.0, 1.0, 1.0, 1.0]),
  38. loss_cls=dict(
  39. type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
  40. loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
  41. # model training and testing settings
  42. train_cfg=dict(
  43. rpn=dict(
  44. assigner=dict(
  45. type='MaxIoUAssigner',
  46. pos_iou_thr=0.7,
  47. neg_iou_thr=0.3,
  48. min_pos_iou=0.3,
  49. ignore_iof_thr=-1),
  50. sampler=dict(
  51. type='RandomSampler',
  52. num=256,
  53. pos_fraction=0.5,
  54. neg_pos_ub=-1,
  55. add_gt_as_proposals=False),
  56. allowed_border=-1,
  57. pos_weight=-1,
  58. debug=False)),
  59. test_cfg=dict(
  60. rpn=dict(
  61. nms_pre=2000,
  62. max_per_img=1000,
  63. nms=dict(type='nms', iou_threshold=0.7),
  64. min_bbox_size=0)))