rtdetr_config.py 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. # Real-time Transformer-based Object Detector
  2. # ------------------- Det task --------------------
  3. rtdetr_cfg = {
  4. 'rtdetr_r18':{
  5. # ---------------- Model config ----------------
  6. ## Model scale
  7. 'width': 1.0,
  8. 'depth': 1.0,
  9. ## Image Encoder - Backbone
  10. 'backbone': 'resnet18',
  11. 'backbone_norm': 'FrozeBN',
  12. 'res5_dilation': False,
  13. 'pretrained': True,
  14. 'pretrained_weight': 'imagenet1k_v1',
  15. 'freeze_at': 0,
  16. 'freeze_stem_only': False,
  17. 'out_stride': [8, 16, 32],
  18. 'max_stride': 32,
  19. ## Image Encoder - FPN
  20. 'fpn': 'hybrid_encoder',
  21. 'fpn_act': 'silu',
  22. 'fpn_norm': 'BN',
  23. 'fpn_depthwise': False,
  24. 'hidden_dim': 256,
  25. 'en_num_heads': 8,
  26. 'en_num_layers': 1,
  27. 'en_mlp_ratio': 4.0,
  28. 'en_dropout': 0.0,
  29. 'pe_temperature': 10000.,
  30. 'en_act': 'gelu',
  31. # Transformer Decoder
  32. 'transformer': 'rtdetr_transformer',
  33. 'hidden_dim': 256,
  34. 'de_num_heads': 8,
  35. 'de_num_layers': 3,
  36. 'de_mlp_ratio': 4.0,
  37. 'de_dropout': 0.0,
  38. 'de_act': 'relu',
  39. 'de_num_points': 4,
  40. 'num_queries': 300,
  41. 'learnt_init_query': False,
  42. 'pe_temperature': 10000.,
  43. 'dn_num_denoising': 100,
  44. 'dn_label_noise_ratio': 0.5,
  45. 'dn_box_noise_scale': 1,
  46. # Head
  47. 'det_head': 'dino_head',
  48. # ---------------- Assignment config ----------------
  49. 'matcher_hpy': {'cost_class': 2.0,
  50. 'cost_bbox': 5.0,
  51. 'cost_giou': 2.0,},
  52. # ---------------- Loss config ----------------
  53. 'use_vfl': True,
  54. 'loss_coeff': {'class': 1,
  55. 'bbox': 5,
  56. 'giou': 2,},
  57. # ---------------- Train config ----------------
  58. ## input
  59. 'multi_scale': [0.5, 1.25], # 320 -> 800
  60. 'trans_type': 'rtdetr_base',
  61. # ---------------- Train config ----------------
  62. 'trainer_type': 'rtdetr',
  63. },
  64. 'rtdetr_r50':{
  65. # ---------------- Model config ----------------
  66. ## Model scale
  67. 'width': 1.0,
  68. 'depth': 1.0,
  69. ## Image Encoder - Backbone
  70. 'backbone': 'resnet50',
  71. 'backbone_norm': 'FrozeBN',
  72. 'res5_dilation': False,
  73. 'pretrained': True,
  74. 'pretrained_weight': 'imagenet1k_v1',
  75. 'freeze_at': 0,
  76. 'freeze_stem_only': False,
  77. 'out_stride': [8, 16, 32],
  78. 'max_stride': 32,
  79. ## Image Encoder - FPN
  80. 'fpn': 'hybrid_encoder',
  81. 'fpn_act': 'silu',
  82. 'fpn_norm': 'BN',
  83. 'fpn_depthwise': False,
  84. 'hidden_dim': 256,
  85. 'en_num_heads': 8,
  86. 'en_num_layers': 1,
  87. 'en_mlp_ratio': 4.0,
  88. 'en_dropout': 0.0,
  89. 'pe_temperature': 10000.,
  90. 'en_act': 'gelu',
  91. # Transformer Decoder
  92. 'transformer': 'rtdetr_transformer',
  93. 'hidden_dim': 256,
  94. 'de_num_heads': 8,
  95. 'de_num_layers': 6,
  96. 'de_mlp_ratio': 4.0,
  97. 'de_dropout': 0.0,
  98. 'de_act': 'relu',
  99. 'de_num_points': 4,
  100. 'num_queries': 300,
  101. 'learnt_init_query': False,
  102. 'pe_temperature': 10000.,
  103. 'dn_num_denoising': 100,
  104. 'dn_label_noise_ratio': 0.5,
  105. 'dn_box_noise_scale': 1,
  106. # Head
  107. 'det_head': 'dino_head',
  108. # ---------------- Assignment config ----------------
  109. 'matcher_hpy': {'cost_class': 2.0,
  110. 'cost_bbox': 5.0,
  111. 'cost_giou': 2.0,},
  112. # ---------------- Loss config ----------------
  113. 'use_vfl': True,
  114. 'loss_coeff': {'class': 1,
  115. 'bbox': 5,
  116. 'giou': 2,},
  117. # ---------------- Train config ----------------
  118. ## input
  119. 'multi_scale': [0.5, 1.25], # 320 -> 800
  120. 'trans_type': 'rtdetr_base',
  121. # ---------------- Train config ----------------
  122. 'trainer_type': 'rtdetr',
  123. },
  124. 'rtdetr_r101':{
  125. # ---------------- Model config ----------------
  126. ## Model scale
  127. 'width': 1.0,
  128. 'depth': 1.0,
  129. ## Image Encoder - Backbone
  130. 'backbone': 'resnet101',
  131. 'backbone_norm': 'FrozeBN',
  132. 'res5_dilation': False,
  133. 'pretrained': True,
  134. 'pretrained_weight': 'imagenet1k_v1',
  135. 'freeze_at': 0,
  136. 'freeze_stem_only': False,
  137. 'out_stride': [8, 16, 32],
  138. 'max_stride': 32,
  139. ## Image Encoder - FPN
  140. 'fpn': 'hybrid_encoder',
  141. 'fpn_act': 'silu',
  142. 'fpn_norm': 'BN',
  143. 'fpn_depthwise': False,
  144. 'hidden_dim': 256,
  145. 'en_num_heads': 8,
  146. 'en_num_layers': 1,
  147. 'en_mlp_ratio': 4.0,
  148. 'en_dropout': 0.0,
  149. 'pe_temperature': 10000.,
  150. 'en_act': 'gelu',
  151. # Transformer Decoder
  152. 'transformer': 'rtdetr_transformer',
  153. 'hidden_dim': 256,
  154. 'de_num_heads': 8,
  155. 'de_num_layers': 6,
  156. 'de_mlp_ratio': 4.0,
  157. 'de_dropout': 0.0,
  158. 'de_act': 'relu',
  159. 'de_num_points': 4,
  160. 'num_queries': 300,
  161. 'learnt_init_query': False,
  162. 'pe_temperature': 10000.,
  163. 'dn_num_denoising': 100,
  164. 'dn_label_noise_ratio': 0.5,
  165. 'dn_box_noise_scale': 1,
  166. # Head
  167. 'det_head': 'dino_head',
  168. # ---------------- Assignment config ----------------
  169. 'matcher_hpy': {'cost_class': 2.0,
  170. 'cost_bbox': 5.0,
  171. 'cost_giou': 2.0,},
  172. # ---------------- Loss config ----------------
  173. 'use_vfl': True,
  174. 'loss_coeff': {'class': 1,
  175. 'bbox': 5,
  176. 'giou': 2,},
  177. # ---------------- Train config ----------------
  178. ## input
  179. 'multi_scale': [0.5, 1.25], # 320 -> 800
  180. 'trans_type': 'rtdetr_base',
  181. # ---------------- Train config ----------------
  182. 'trainer_type': 'rtdetr',
  183. },
  184. # Below RT-DETR is not complete
  185. 'rtdetr_l':{
  186. # ---------------- Model config ----------------
  187. ## Model scale
  188. 'width': 1.0,
  189. 'depth': 1.0,
  190. ## Image Encoder - Backbone
  191. 'backbone': 'rtcnet_l',
  192. 'pretrained': True,
  193. 'freeze_at': 0,
  194. 'freeze_stem_only': False,
  195. 'out_stride': [8, 16, 32],
  196. 'max_stride': 32,
  197. ## Image Encoder - FPN
  198. 'fpn': 'hybrid_encoder',
  199. 'fpn_act': 'silu',
  200. 'fpn_norm': 'BN',
  201. 'fpn_depthwise': False,
  202. 'hidden_dim': 256,
  203. 'en_num_heads': 8,
  204. 'en_num_layers': 1,
  205. 'en_mlp_ratio': 4.0,
  206. 'en_dropout': 0.0,
  207. 'pe_temperature': 10000.,
  208. 'en_act': 'gelu',
  209. # Transformer Decoder
  210. 'transformer': 'rtdetr_transformer',
  211. 'hidden_dim': 256,
  212. 'de_num_heads': 8,
  213. 'de_num_layers': 6,
  214. 'de_mlp_ratio': 4.0,
  215. 'de_dropout': 0.0,
  216. 'de_act': 'relu',
  217. 'de_num_points': 4,
  218. 'num_queries': 300,
  219. 'learnt_init_query': False,
  220. 'pe_temperature': 10000.,
  221. 'dn_num_denoising': 100,
  222. 'dn_label_noise_ratio': 0.5,
  223. 'dn_box_noise_scale': 1,
  224. # Head
  225. 'det_head': 'dino_head',
  226. # ---------------- Assignment config ----------------
  227. 'matcher_hpy': {'cost_class': 2.0,
  228. 'cost_bbox': 5.0,
  229. 'cost_giou': 2.0,},
  230. # ---------------- Loss config ----------------
  231. 'use_vfl': True,
  232. 'loss_coeff': {'class': 1,
  233. 'bbox': 5,
  234. 'giou': 2,},
  235. # ---------------- Train config ----------------
  236. ## input
  237. 'multi_scale': [0.5, 1.25], # 320 -> 800
  238. 'trans_type': 'rtdetr_base',
  239. # ---------------- Train config ----------------
  240. 'trainer_type': 'rtdetr',
  241. },
  242. }