rtcdet_config.py 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. # RTCDet-v2 Config
  2. rtcdet_cfg = {
  3. 'rtcdet_p':{
  4. # ---------------- Model config ----------------
  5. ## Backbone
  6. 'backbone': 'elannet',
  7. 'pretrained': True,
  8. 'bk_act': 'silu',
  9. 'bk_norm': 'BN',
  10. 'bk_depthwise': True,
  11. 'width': 0.25,
  12. 'depth': 0.34,
  13. 'stride': [8, 16, 32], # P3, P4, P5
  14. 'max_stride': 32,
  15. 'reg_max': 16,
  16. ## Neck: SPP
  17. 'neck': 'sppf',
  18. 'neck_expand_ratio': 0.5,
  19. 'pooling_size': 5,
  20. 'neck_act': 'silu',
  21. 'neck_norm': 'BN',
  22. 'neck_depthwise': True,
  23. ## Neck: PaFPN
  24. 'fpn': 'rtcdet_pafpn',
  25. 'fpn_reduce_layer': 'conv',
  26. 'fpn_downsample_layer': 'conv',
  27. 'fpn_core_block': 'elanblock',
  28. 'fpn_branch_depth': 3,
  29. 'fpn_expand_ratio': 0.5,
  30. 'fpn_act': 'silu',
  31. 'fpn_norm': 'BN',
  32. 'fpn_depthwise': True,
  33. ## Head
  34. 'head': 'decoupled_head',
  35. 'head_act': 'silu',
  36. 'head_norm': 'BN',
  37. 'num_cls_head': 2,
  38. 'num_reg_head': 2,
  39. 'head_depthwise': True,
  40. # ---------------- Train config ----------------
  41. ## Input
  42. 'multi_scale': [0.4, 1.0], # 256 -> 640
  43. 'trans_type': 'yolox_pico',
  44. # ---------------- Assignment config ----------------
  45. ## Matcher
  46. 'matcher': "simota",
  47. 'matcher_hpy': {"simota": {'center_sampling_radius': 2.5,
  48. 'topk_candidate': 10},
  49. "aligned_simota": {'soft_center_radius': 3.0,
  50. 'topk_candicate': 10,
  51. 'iou_weight': 3.0},
  52. },
  53. # ---------------- Loss config ----------------
  54. ## Loss weight
  55. 'ema_update': False,
  56. 'loss_box_aux': True,
  57. 'loss_weights': {"simota": {'loss_cls_weight': 1.0,
  58. 'loss_dfl_weight': 1.0,
  59. 'loss_box_weight': 5.0},
  60. "aligned_simota": {'loss_cls_weight': 1.0,
  61. 'loss_dfl_weight': 1.0,
  62. 'loss_box_weight': 2.0}
  63. },
  64. # ---------------- Train config ----------------
  65. 'trainer_type': 'rtcdet',
  66. },
  67. 'rtcdet_n':{
  68. # ---------------- Model config ----------------
  69. ## Backbone
  70. 'backbone': 'elannet',
  71. 'pretrained': True,
  72. 'bk_act': 'silu',
  73. 'bk_norm': 'BN',
  74. 'bk_depthwise': False,
  75. 'width': 0.25,
  76. 'depth': 0.34,
  77. 'stride': [8, 16, 32], # P3, P4, P5
  78. 'max_stride': 32,
  79. 'reg_max': 16,
  80. ## Neck: SPP
  81. 'neck': 'sppf',
  82. 'neck_expand_ratio': 0.5,
  83. 'pooling_size': 5,
  84. 'neck_act': 'silu',
  85. 'neck_norm': 'BN',
  86. 'neck_depthwise': False,
  87. ## Neck: PaFPN
  88. 'fpn': 'rtcdet_pafpn',
  89. 'fpn_reduce_layer': 'conv',
  90. 'fpn_downsample_layer': 'conv',
  91. 'fpn_core_block': 'elanblock',
  92. 'fpn_branch_depth': 3,
  93. 'fpn_expand_ratio': 0.5,
  94. 'fpn_act': 'silu',
  95. 'fpn_norm': 'BN',
  96. 'fpn_depthwise': False,
  97. ## Head
  98. 'head': 'decoupled_head',
  99. 'head_act': 'silu',
  100. 'head_norm': 'BN',
  101. 'num_cls_head': 2,
  102. 'num_reg_head': 2,
  103. 'head_depthwise': False,
  104. # ---------------- Train config ----------------
  105. ## Input
  106. 'multi_scale': [0.5, 1.5], # 320 -> 960
  107. 'trans_type': 'yolox_nano',
  108. # ---------------- Assignment config ----------------
  109. ## Matcher
  110. 'matcher': "simota",
  111. 'matcher_hpy': {"simota": {'center_sampling_radius': 2.5,
  112. 'topk_candidate': 10},
  113. "aligned_simota": {'soft_center_radius': 3.0,
  114. 'topk_candicate': 10,
  115. 'iou_weight': 3.0},
  116. },
  117. # ---------------- Loss config ----------------
  118. ## Loss weight
  119. 'ema_update': False,
  120. 'loss_box_aux': True,
  121. 'loss_weights': {"simota": {'loss_cls_weight': 1.0,
  122. 'loss_dfl_weight': 1.0,
  123. 'loss_box_weight': 5.0},
  124. "aligned_simota": {'loss_cls_weight': 1.0,
  125. 'loss_dfl_weight': 1.0,
  126. 'loss_box_weight': 2.0}
  127. },
  128. # ---------------- Train config ----------------
  129. 'trainer_type': 'rtcdet',
  130. },
  131. 'rtcdet_t':{
  132. # ---------------- Model config ----------------
  133. ## Backbone
  134. 'backbone': 'elannet',
  135. 'pretrained': True,
  136. 'bk_act': 'silu',
  137. 'bk_norm': 'BN',
  138. 'bk_depthwise': False,
  139. 'width': 0.375,
  140. 'depth': 0.34,
  141. 'stride': [8, 16, 32], # P3, P4, P5
  142. 'max_stride': 32,
  143. 'reg_max': 16,
  144. ## Neck: SPP
  145. 'neck': 'sppf',
  146. 'neck_expand_ratio': 0.5,
  147. 'pooling_size': 5,
  148. 'neck_act': 'silu',
  149. 'neck_norm': 'BN',
  150. 'neck_depthwise': False,
  151. ## Neck: PaFPN
  152. 'fpn': 'rtcdet_pafpn',
  153. 'fpn_reduce_layer': 'conv',
  154. 'fpn_downsample_layer': 'conv',
  155. 'fpn_core_block': 'elanblock',
  156. 'fpn_branch_depth': 3,
  157. 'fpn_expand_ratio': 0.5,
  158. 'fpn_act': 'silu',
  159. 'fpn_norm': 'BN',
  160. 'fpn_depthwise': False,
  161. ## Head
  162. 'head': 'decoupled_head',
  163. 'head_act': 'silu',
  164. 'head_norm': 'BN',
  165. 'num_cls_head': 2,
  166. 'num_reg_head': 2,
  167. 'head_depthwise': False,
  168. # ---------------- Train config ----------------
  169. ## Input
  170. 'multi_scale': [0.5, 1.5], # 320 -> 960
  171. 'trans_type': 'yolox_small',
  172. # ---------------- Assignment config ----------------
  173. ## Matcher
  174. 'matcher': "simota",
  175. 'matcher_hpy': {"simota": {'center_sampling_radius': 2.5,
  176. 'topk_candidate': 10},
  177. "aligned_simota": {'soft_center_radius': 3.0,
  178. 'topk_candicate': 10,
  179. 'iou_weight': 3.0},
  180. },
  181. # ---------------- Loss config ----------------
  182. ## Loss weight
  183. 'ema_update': False,
  184. 'loss_box_aux': True,
  185. 'loss_weights': {"simota": {'loss_cls_weight': 1.0,
  186. 'loss_dfl_weight': 1.0,
  187. 'loss_box_weight': 5.0},
  188. "aligned_simota": {'loss_cls_weight': 1.0,
  189. 'loss_dfl_weight': 1.0,
  190. 'loss_box_weight': 2.0}
  191. },
  192. # ---------------- Train config ----------------
  193. 'trainer_type': 'rtcdet',
  194. },
  195. 'rtcdet_s':{
  196. # ---------------- Model config ----------------
  197. ## Backbone
  198. 'backbone': 'elannet',
  199. 'pretrained': True,
  200. 'bk_act': 'silu',
  201. 'bk_norm': 'BN',
  202. 'bk_depthwise': False,
  203. 'width': 0.50,
  204. 'depth': 0.34,
  205. 'stride': [8, 16, 32], # P3, P4, P5
  206. 'max_stride': 32,
  207. 'reg_max': 16,
  208. ## Neck: SPP
  209. 'neck': 'sppf',
  210. 'neck_expand_ratio': 0.5,
  211. 'pooling_size': 5,
  212. 'neck_act': 'silu',
  213. 'neck_norm': 'BN',
  214. 'neck_depthwise': False,
  215. ## Neck: PaFPN
  216. 'fpn': 'rtcdet_pafpn',
  217. 'fpn_reduce_layer': 'conv',
  218. 'fpn_downsample_layer': 'conv',
  219. 'fpn_core_block': 'elanblock',
  220. 'fpn_branch_depth': 3,
  221. 'fpn_expand_ratio': 0.5,
  222. 'fpn_act': 'silu',
  223. 'fpn_norm': 'BN',
  224. 'fpn_depthwise': False,
  225. ## Head
  226. 'head': 'decoupled_head',
  227. 'head_act': 'silu',
  228. 'head_norm': 'BN',
  229. 'num_cls_head': 2,
  230. 'num_reg_head': 2,
  231. 'head_depthwise': False,
  232. # ---------------- Train config ----------------
  233. ## Input
  234. 'multi_scale': [0.5, 1.5], # 320 -> 960
  235. 'trans_type': 'yolox_small',
  236. # ---------------- Assignment config ----------------
  237. ## Matcher
  238. 'matcher': "simota",
  239. 'matcher_hpy': {"simota": {'center_sampling_radius': 2.5,
  240. 'topk_candidate': 10},
  241. "aligned_simota": {'soft_center_radius': 3.0,
  242. 'topk_candicate': 10,
  243. 'iou_weight': 3.0},
  244. },
  245. # ---------------- Loss config ----------------
  246. ## Loss weight
  247. 'ema_update': False,
  248. 'loss_box_aux': True,
  249. 'loss_weights': {"simota": {'loss_cls_weight': 1.0,
  250. 'loss_dfl_weight': 1.0,
  251. 'loss_box_weight': 5.0},
  252. "aligned_simota": {'loss_cls_weight': 1.0,
  253. 'loss_dfl_weight': 1.0,
  254. 'loss_box_weight': 2.0}
  255. },
  256. # ---------------- Train config ----------------
  257. 'trainer_type': 'rtcdet',
  258. },
  259. 'rtcdet_m':{
  260. # ---------------- Model config ----------------
  261. ## Backbone
  262. 'backbone': 'elannet',
  263. 'pretrained': False,
  264. 'bk_act': 'silu',
  265. 'bk_norm': 'BN',
  266. 'bk_depthwise': False,
  267. 'width': 0.75,
  268. 'depth': 0.67,
  269. 'stride': [8, 16, 32], # P3, P4, P5
  270. 'max_stride': 32,
  271. 'reg_max': 16,
  272. ## Neck: SPP
  273. 'neck': 'sppf',
  274. 'neck_expand_ratio': 0.5,
  275. 'pooling_size': 5,
  276. 'neck_act': 'silu',
  277. 'neck_norm': 'BN',
  278. 'neck_depthwise': False,
  279. ## Neck: PaFPN
  280. 'fpn': 'rtcdet_pafpn',
  281. 'fpn_reduce_layer': 'conv',
  282. 'fpn_downsample_layer': 'conv',
  283. 'fpn_core_block': 'elanblock',
  284. 'fpn_branch_depth': 3,
  285. 'fpn_expand_ratio': 0.5,
  286. 'fpn_act': 'silu',
  287. 'fpn_norm': 'BN',
  288. 'fpn_depthwise': False,
  289. ## Head
  290. 'head': 'decoupled_head',
  291. 'head_act': 'silu',
  292. 'head_norm': 'BN',
  293. 'num_cls_head': 2,
  294. 'num_reg_head': 2,
  295. 'head_depthwise': False,
  296. # ---------------- Train config ----------------
  297. ## Input
  298. 'multi_scale': [0.5, 1.5], # 320 -> 960
  299. 'trans_type': 'yolox_medium',
  300. # ---------------- Assignment config ----------------
  301. ## Matcher
  302. 'matcher': "simota",
  303. 'matcher_hpy': {"simota": {'center_sampling_radius': 2.5,
  304. 'topk_candidate': 10},
  305. "aligned_simota": {'soft_center_radius': 3.0,
  306. 'topk_candicate': 10,
  307. 'iou_weight': 3.0},
  308. },
  309. # ---------------- Loss config ----------------
  310. ## Loss weight
  311. 'ema_update': False,
  312. 'loss_box_aux': True,
  313. 'loss_weights': {"simota": {'loss_cls_weight': 1.0,
  314. 'loss_dfl_weight': 1.0,
  315. 'loss_box_weight': 5.0},
  316. "aligned_simota": {'loss_cls_weight': 1.0,
  317. 'loss_dfl_weight': 1.0,
  318. 'loss_box_weight': 2.0}
  319. },
  320. # ---------------- Train config ----------------
  321. 'trainer_type': 'rtcdet',
  322. },
  323. 'rtcdet_l':{
  324. # ---------------- Model config ----------------
  325. ## Backbone
  326. 'backbone': 'elannet',
  327. 'pretrained': False,
  328. 'bk_act': 'silu',
  329. 'bk_norm': 'BN',
  330. 'bk_depthwise': False,
  331. 'width': 1.0,
  332. 'depth': 1.0,
  333. 'stride': [8, 16, 32], # P3, P4, P5
  334. 'max_stride': 32,
  335. 'reg_max': 16,
  336. ## Neck: SPP
  337. 'neck': 'sppf',
  338. 'neck_expand_ratio': 0.5,
  339. 'pooling_size': 5,
  340. 'neck_act': 'silu',
  341. 'neck_norm': 'BN',
  342. 'neck_depthwise': False,
  343. ## Neck: PaFPN
  344. 'fpn': 'rtcdet_pafpn',
  345. 'fpn_reduce_layer': 'conv',
  346. 'fpn_downsample_layer': 'conv',
  347. 'fpn_core_block': 'elanblock',
  348. 'fpn_branch_depth': 3,
  349. 'fpn_expand_ratio': 0.5,
  350. 'fpn_act': 'silu',
  351. 'fpn_norm': 'BN',
  352. 'fpn_depthwise': False,
  353. ## Head
  354. 'head': 'decoupled_head',
  355. 'head_act': 'silu',
  356. 'head_norm': 'BN',
  357. 'num_cls_head': 2,
  358. 'num_reg_head': 2,
  359. 'head_depthwise': False,
  360. # ---------------- Train config ----------------
  361. ## Input
  362. 'multi_scale': [0.5, 1.5], # 320 -> 960
  363. 'trans_type': 'yolox_large',
  364. # ---------------- Assignment config ----------------
  365. ## Matcher
  366. 'matcher': "simota",
  367. 'matcher_hpy': {"simota": {'center_sampling_radius': 2.5,
  368. 'topk_candidate': 10},
  369. "aligned_simota": {'soft_center_radius': 3.0,
  370. 'topk_candicate': 10,
  371. 'iou_weight': 3.0},
  372. },
  373. # ---------------- Loss config ----------------
  374. ## Loss weight
  375. 'ema_update': False,
  376. 'loss_box_aux': True,
  377. 'loss_weights': {"simota": {'loss_cls_weight': 1.0,
  378. 'loss_dfl_weight': 1.0,
  379. 'loss_box_weight': 5.0},
  380. "aligned_simota": {'loss_cls_weight': 1.0,
  381. 'loss_dfl_weight': 1.0,
  382. 'loss_box_weight': 2.0}
  383. },
  384. # ---------------- Train config ----------------
  385. 'trainer_type': 'rtcdet',
  386. },
  387. 'rtcdet_x':{
  388. # ---------------- Model config ----------------
  389. ## Backbone
  390. 'backbone': 'elannet',
  391. 'pretrained': False,
  392. 'bk_act': 'silu',
  393. 'bk_norm': 'BN',
  394. 'bk_depthwise': False,
  395. 'width': 1.25,
  396. 'depth': 1.34,
  397. 'stride': [8, 16, 32], # P3, P4, P5
  398. 'max_stride': 32,
  399. 'reg_max': 16,
  400. ## Neck: SPP
  401. 'neck': 'sppf',
  402. 'neck_expand_ratio': 0.5,
  403. 'pooling_size': 5,
  404. 'neck_act': 'silu',
  405. 'neck_norm': 'BN',
  406. 'neck_depthwise': False,
  407. ## Neck: PaFPN
  408. 'fpn': 'rtcdet_pafpn',
  409. 'fpn_reduce_layer': 'conv',
  410. 'fpn_downsample_layer': 'conv',
  411. 'fpn_core_block': 'elanblock',
  412. 'fpn_branch_depth': 3,
  413. 'fpn_expand_ratio': 0.5,
  414. 'fpn_act': 'silu',
  415. 'fpn_norm': 'BN',
  416. 'fpn_depthwise': False,
  417. ## Head
  418. 'head': 'decoupled_head',
  419. 'head_act': 'silu',
  420. 'head_norm': 'BN',
  421. 'num_cls_head': 2,
  422. 'num_reg_head': 2,
  423. 'head_depthwise': False,
  424. # ---------------- Train config ----------------
  425. ## Input
  426. 'multi_scale': [0.5, 1.5], # 320 -> 960
  427. 'trans_type': 'yolox_huge',
  428. # ---------------- Assignment config ----------------
  429. ## Matcher
  430. 'matcher': "simota",
  431. 'matcher_hpy': {"simota": {'center_sampling_radius': 2.5,
  432. 'topk_candidate': 10},
  433. "aligned_simota": {'soft_center_radius': 3.0,
  434. 'topk_candicate': 10,
  435. 'iou_weight': 3.0},
  436. },
  437. # ---------------- Loss config ----------------
  438. ## Loss weight
  439. 'ema_update': False,
  440. 'loss_box_aux': True,
  441. 'loss_weights': {"simota": {'loss_cls_weight': 1.0,
  442. 'loss_dfl_weight': 1.0,
  443. 'loss_box_weight': 5.0},
  444. "aligned_simota": {'loss_cls_weight': 1.0,
  445. 'loss_dfl_weight': 1.0,
  446. 'loss_box_weight': 2.0}
  447. },
  448. # ---------------- Train config ----------------
  449. 'trainer_type': 'rtcdet',
  450. },
  451. }