rtcdet_config.py 14 KB

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