config.py 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. auto_scale_lr = dict(base_batch_size=12, enable=False)
  2. backend_args = None
  3. base_lr = 0.002
  4. custom_hooks = [
  5. dict(
  6. ema_type='ExpMomentumEMA',
  7. momentum=0.0002,
  8. priority=49,
  9. type='EMAHook',
  10. update_buffers=True),
  11. dict(
  12. switch_epoch=80,
  13. switch_pipeline=[
  14. dict(backend_args=None, type='LoadImageFromFile'),
  15. dict(type='LoadAnnotations', with_bbox=True),
  16. dict(
  17. keep_ratio=True,
  18. ratio_range=(
  19. 0.5,
  20. 2.0,
  21. ),
  22. scale=(
  23. 640,
  24. 640,
  25. ),
  26. type='RandomResize'),
  27. dict(crop_size=(
  28. 640,
  29. 640,
  30. ), type='RandomCrop'),
  31. dict(type='YOLOXHSVRandomAug'),
  32. dict(prob=0.5, type='RandomFlip'),
  33. dict(
  34. pad_val=dict(img=(
  35. 114,
  36. 114,
  37. 114,
  38. )),
  39. size=(
  40. 640,
  41. 640,
  42. ),
  43. type='Pad'),
  44. dict(type='PackDetInputs'),
  45. ],
  46. type='PipelineSwitchHook'),
  47. ]
  48. data_root = '../../../media/tricolops/T7/Dataset/coco_format_bd/'
  49. dataset_type = 'CocoDataset'
  50. default_hooks = dict(
  51. checkpoint=dict(interval=5, save_best='auto', type='CheckpointHook'),
  52. logger=dict(interval=50, type='LoggerHook'),
  53. param_scheduler=dict(type='ParamSchedulerHook'),
  54. sampler_seed=dict(type='DistSamplerSeedHook'),
  55. timer=dict(type='IterTimerHook'),
  56. visualization=dict(
  57. draw=True, test_out_dir='res', type='DetVisualizationHook'))
  58. default_scope = 'mmdet'
  59. env_cfg = dict(
  60. cudnn_benchmark=False,
  61. dist_cfg=dict(backend='nccl'),
  62. mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0))
  63. img_scales = [
  64. (
  65. 640,
  66. 640,
  67. ),
  68. (
  69. 320,
  70. 320,
  71. ),
  72. (
  73. 960,
  74. 960,
  75. ),
  76. ]
  77. init_cfg = dict(
  78. checkpoint='best_coco_bbox_mAP_epoch_50.pth', type='Pretrained')
  79. interval = 5
  80. launcher = 'none'
  81. load_from = 'work_dirs/rtmdet_small_1xb16-300e_coco/epoch_100.pth'
  82. log_level = 'INFO'
  83. log_processor = dict(by_epoch=True, type='LogProcessor', window_size=50)
  84. max_epochs = 100
  85. metainfo = dict(
  86. classes=('barcode', ), palette=[
  87. (
  88. 220,
  89. 20,
  90. 60,
  91. ),
  92. ])
  93. model = dict(
  94. backbone=dict(
  95. act_cfg=dict(inplace=True, type='SiLU'),
  96. arch='P5',
  97. channel_attention=True,
  98. deepen_factor=0.33,
  99. expand_ratio=0.5,
  100. norm_cfg=dict(type='SyncBN'),
  101. type='CSPNeXt',
  102. widen_factor=0.5),
  103. bbox_head=dict(
  104. act_cfg=dict(inplace=True, type='SiLU'),
  105. anchor_generator=dict(
  106. offset=0, strides=[
  107. 8,
  108. 16,
  109. 32,
  110. ], type='MlvlPointGenerator'),
  111. bbox_coder=dict(type='DistancePointBBoxCoder'),
  112. exp_on_reg=False,
  113. feat_channels=128,
  114. in_channels=128,
  115. loss_bbox=dict(loss_weight=2.0, type='SIoULoss'),
  116. loss_cls=dict(
  117. beta=2.0,
  118. loss_weight=1.0,
  119. type='QualityFocalLoss',
  120. use_sigmoid=True),
  121. norm_cfg=dict(type='SyncBN'),
  122. num_classes=1,
  123. pred_kernel_size=1,
  124. share_conv=True,
  125. stacked_convs=2,
  126. type='RTMDetSepBNHead',
  127. with_objectness=False),
  128. data_preprocessor=dict(
  129. batch_augments=None,
  130. bgr_to_rgb=False,
  131. mean=[
  132. 103.53,
  133. 116.28,
  134. 123.675,
  135. ],
  136. std=[
  137. 57.375,
  138. 57.12,
  139. 58.395,
  140. ],
  141. type='DetDataPreprocessor'),
  142. neck=dict(
  143. act_cfg=dict(inplace=True, type='SiLU'),
  144. expand_ratio=0.5,
  145. in_channels=[
  146. 128,
  147. 256,
  148. 512,
  149. ],
  150. norm_cfg=dict(type='SyncBN'),
  151. num_csp_blocks=1,
  152. out_channels=128,
  153. type='CSPNeXtPAFPN'),
  154. test_cfg=dict(
  155. max_per_img=300,
  156. min_bbox_size=0,
  157. nms=dict(iou_threshold=0.65, type='nms'),
  158. nms_pre=30000,
  159. score_thr=0.001),
  160. train_cfg=dict(
  161. allowed_border=-1,
  162. assigner=dict(topk=13, type='DynamicSoftLabelAssigner'),
  163. debug=False,
  164. pos_weight=-1),
  165. type='RTMDet')
  166. optim_wrapper = dict(
  167. optimizer=dict(lr=0.002, type='AdamW', weight_decay=0.05),
  168. paramwise_cfg=dict(
  169. bias_decay_mult=0, bypass_duplicate=True, norm_decay_mult=0),
  170. type='OptimWrapper')
  171. optimizer_config = dict(grad_clip=dict(max_norm=2.0, norm_type=2))
  172. param_scheduler = [
  173. dict(
  174. begin=0, by_epoch=False, end=1000, start_factor=1e-05,
  175. type='LinearLR'),
  176. dict(
  177. T_max=50,
  178. begin=50,
  179. by_epoch=True,
  180. convert_to_iter_based=True,
  181. end=100,
  182. eta_min=0.0001,
  183. type='CosineAnnealingLR'),
  184. ]
  185. resume = False
  186. test_cfg = dict(type='TestLoop')
  187. test_dataloader = dict(
  188. batch_size=1,
  189. dataset=dict(
  190. ann_file='Val/Val.json',
  191. backend_args=None,
  192. data_prefix=dict(img='Val/'),
  193. data_root='../../../media/tricolops/T7/Dataset/coco_format_bd/',
  194. metainfo=dict(classes=('barcode', ), palette=[
  195. (
  196. 220,
  197. 20,
  198. 60,
  199. ),
  200. ]),
  201. pipeline=[
  202. dict(backend_args=None, type='LoadImageFromFile'),
  203. dict(keep_ratio=True, scale=(
  204. 640,
  205. 640,
  206. ), type='Resize'),
  207. dict(
  208. pad_val=dict(img=(
  209. 114,
  210. 114,
  211. 114,
  212. )),
  213. size=(
  214. 640,
  215. 640,
  216. ),
  217. type='Pad'),
  218. dict(type='LoadAnnotations', with_bbox=True),
  219. dict(
  220. meta_keys=(
  221. 'img_id',
  222. 'img_path',
  223. 'ori_shape',
  224. 'img_shape',
  225. 'scale_factor',
  226. ),
  227. type='PackDetInputs'),
  228. ],
  229. test_mode=True,
  230. type='CocoDataset'),
  231. drop_last=False,
  232. num_workers=10,
  233. persistent_workers=True,
  234. sampler=dict(shuffle=False, type='DefaultSampler'))
  235. test_evaluator = dict(
  236. ann_file='../../../media/tricolops/T7/Dataset/coco_format_bd/Val/Val.json',
  237. backend_args=None,
  238. format_only=False,
  239. metric='bbox',
  240. proposal_nums=(
  241. 100,
  242. 1,
  243. 10,
  244. ),
  245. type='CocoMetric')
  246. test_pipeline = [
  247. dict(backend_args=None, type='LoadImageFromFile'),
  248. dict(keep_ratio=True, scale=(
  249. 640,
  250. 640,
  251. ), type='Resize'),
  252. dict(pad_val=dict(img=(
  253. 114,
  254. 114,
  255. 114,
  256. )), size=(
  257. 640,
  258. 640,
  259. ), type='Pad'),
  260. dict(type='LoadAnnotations', with_bbox=True),
  261. dict(
  262. meta_keys=(
  263. 'img_id',
  264. 'img_path',
  265. 'ori_shape',
  266. 'img_shape',
  267. 'scale_factor',
  268. ),
  269. type='PackDetInputs'),
  270. ]
  271. train_cfg = dict(
  272. dynamic_intervals=[
  273. (
  274. 220,
  275. 1,
  276. ),
  277. ],
  278. max_epochs=100,
  279. type='EpochBasedTrainLoop',
  280. val_interval=5)
  281. train_dataloader = dict(
  282. batch_sampler=None,
  283. batch_size=12,
  284. dataset=dict(
  285. ann_file='Train/Train.json',
  286. backend_args=None,
  287. data_prefix=dict(img='Train/'),
  288. data_root='../../../media/tricolops/T7/Dataset/coco_format_bd/',
  289. filter_cfg=dict(filter_empty_gt=True, min_size=32),
  290. metainfo=dict(classes=('barcode', ), palette=[
  291. (
  292. 220,
  293. 20,
  294. 60,
  295. ),
  296. ]),
  297. pipeline=[
  298. dict(backend_args=None, type='LoadImageFromFile'),
  299. dict(type='LoadAnnotations', with_bbox=True),
  300. dict(
  301. img_scale=(
  302. 640,
  303. 640,
  304. ),
  305. max_cached_images=20,
  306. pad_val=114.0,
  307. random_pop=False,
  308. type='CachedMosaic'),
  309. dict(
  310. keep_ratio=True,
  311. ratio_range=(
  312. 0.5,
  313. 2.0,
  314. ),
  315. scale=(
  316. 640,
  317. 640,
  318. ),
  319. type='RandomResize'),
  320. dict(crop_size=(
  321. 640,
  322. 640,
  323. ), type='RandomCrop'),
  324. dict(type='YOLOXHSVRandomAug'),
  325. dict(prob=0.5, type='RandomFlip'),
  326. dict(
  327. pad_val=dict(img=(
  328. 114,
  329. 114,
  330. 114,
  331. )),
  332. size=(
  333. 640,
  334. 640,
  335. ),
  336. type='Pad'),
  337. dict(
  338. img_scale=(
  339. 640,
  340. 640,
  341. ),
  342. max_cached_images=10,
  343. pad_val=(
  344. 114,
  345. 114,
  346. 114,
  347. ),
  348. prob=0.5,
  349. random_pop=False,
  350. ratio_range=(
  351. 1.0,
  352. 1.0,
  353. ),
  354. type='CachedMixUp'),
  355. dict(type='PackDetInputs'),
  356. ],
  357. type='CocoDataset'),
  358. num_workers=10,
  359. persistent_workers=True,
  360. pin_memory=True,
  361. sampler=dict(shuffle=True, type='DefaultSampler'))
  362. tta_model = dict(
  363. tta_cfg=dict(max_per_img=100, nms=dict(iou_threshold=0.6, type='nms')),
  364. type='DetTTAModel')
  365. tta_pipeline = [
  366. dict(backend_args=None, type='LoadImageFromFile'),
  367. dict(
  368. transforms=[
  369. [
  370. dict(keep_ratio=True, scale=(
  371. 640,
  372. 640,
  373. ), type='Resize'),
  374. dict(keep_ratio=True, scale=(
  375. 320,
  376. 320,
  377. ), type='Resize'),
  378. dict(keep_ratio=True, scale=(
  379. 960,
  380. 960,
  381. ), type='Resize'),
  382. ],
  383. [
  384. dict(prob=1.0, type='RandomFlip'),
  385. dict(prob=0.0, type='RandomFlip'),
  386. ],
  387. [
  388. dict(
  389. pad_val=dict(img=(
  390. 114,
  391. 114,
  392. 114,
  393. )),
  394. size=(
  395. 960,
  396. 960,
  397. ),
  398. type='Pad'),
  399. ],
  400. [
  401. dict(type='LoadAnnotations', with_bbox=True),
  402. ],
  403. [
  404. dict(
  405. meta_keys=(
  406. 'img_id',
  407. 'img_path',
  408. 'ori_shape',
  409. 'img_shape',
  410. 'scale_factor',
  411. 'flip',
  412. 'flip_direction',
  413. ),
  414. type='PackDetInputs'),
  415. ],
  416. ],
  417. type='TestTimeAug'),
  418. ]
  419. val_cfg = dict(type='ValLoop')
  420. val_dataloader = dict(
  421. batch_size=1,
  422. dataset=dict(
  423. ann_file='Val/Val.json',
  424. backend_args=None,
  425. data_prefix=dict(img='Val/'),
  426. data_root='../../../media/tricolops/T7/Dataset/coco_format_bd/',
  427. metainfo=dict(classes=('barcode', ), palette=[
  428. (
  429. 220,
  430. 20,
  431. 60,
  432. ),
  433. ]),
  434. pipeline=[
  435. dict(backend_args=None, type='LoadImageFromFile'),
  436. dict(keep_ratio=True, scale=(
  437. 640,
  438. 640,
  439. ), type='Resize'),
  440. dict(
  441. pad_val=dict(img=(
  442. 114,
  443. 114,
  444. 114,
  445. )),
  446. size=(
  447. 640,
  448. 640,
  449. ),
  450. type='Pad'),
  451. dict(type='LoadAnnotations', with_bbox=True),
  452. dict(
  453. meta_keys=(
  454. 'img_id',
  455. 'img_path',
  456. 'ori_shape',
  457. 'img_shape',
  458. 'scale_factor',
  459. ),
  460. type='PackDetInputs'),
  461. ],
  462. test_mode=True,
  463. type='CocoDataset'),
  464. drop_last=False,
  465. num_workers=10,
  466. persistent_workers=True,
  467. sampler=dict(shuffle=False, type='DefaultSampler'))
  468. val_evaluator = dict(
  469. ann_file='../../../media/tricolops/T7/Dataset/coco_format_bd/Val/Val.json',
  470. backend_args=None,
  471. format_only=False,
  472. metric='bbox',
  473. proposal_nums=(
  474. 100,
  475. 1,
  476. 10,
  477. ),
  478. type='CocoMetric')
  479. vis_backends = [
  480. dict(type='LocalVisBackend'),
  481. ]
  482. visualizer = dict(
  483. name='visualizer',
  484. type='DetLocalVisualizer',
  485. vis_backends=[
  486. dict(type='LocalVisBackend'),
  487. ])
  488. work_dir = 'result'