rtrdet_config.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Real-time Detection with Transformer
  2. rtrdet_cfg = {
  3. 'rtrdet_l':{
  4. # ---------------- Model config ----------------
  5. ## Backbone
  6. 'backbone': 'elannet',
  7. 'pretrained': True,
  8. 'bk_act': 'silu',
  9. 'bk_norm': 'BN',
  10. 'bk_depthwise': False,
  11. 'width': 1.0,
  12. 'depth': 1.0,
  13. 'max_stride': 32,
  14. 'out_stride': 16,
  15. 'd_model': 512,
  16. ## Transformer Encoder
  17. 'transformer': 'RTRDetTransformer',
  18. 'num_encoder': 1,
  19. 'encoder_num_head': 8,
  20. 'encoder_mlp_ratio': 4.0,
  21. 'encoder_dropout': 0.1,
  22. 'neck_depthwise': False,
  23. 'encoder_act': 'relu',
  24. ## Transformer Decoder
  25. 'num_decoder': 6,
  26. 'stop_layer_id': -1,
  27. 'decoder_num_head': 8,
  28. 'decoder_mlp_ratio': 4.0,
  29. 'decoder_dropout': 0.1,
  30. 'decoder_act': 'relu',
  31. 'decoder_num_queries': 100,
  32. 'decoder_num_pattern': 3,
  33. 'spatial_prior': 'learned', # 'learned', 'grid'
  34. 'num_topk': 100,
  35. # ---------------- Train config ----------------
  36. ## Input
  37. 'multi_scale': [0.5, 1.0], # 320 -> 640
  38. 'trans_type': 'rtrdet_large',
  39. # ---------------- Assignment config ----------------
  40. ## Matcher
  41. 'matcher': "hungarian_matcher",
  42. 'matcher_hpy': {"hungarian_matcher": {'cost_cls_weight': 2.0,
  43. 'cost_box_weight': 5.0,
  44. 'cost_giou_weight': 2.0,
  45. },
  46. },
  47. # ---------------- Loss config ----------------
  48. ## Loss weight
  49. 'ema_update': False,
  50. 'loss_weights': {"hungarian_matcher": {'loss_cls_weight': 1.0,
  51. 'loss_box_weight': 5.0,
  52. 'loss_giou_weight': 2.0},
  53. },
  54. # ---------------- Train config ----------------
  55. 'trainer_type': 'rtrdet',
  56. },
  57. }