123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574 |
- auto_scale_lr = dict(base_batch_size=12, enable=False)
- backend_args = None
- base_lr = 0.001
- max_epochs = 350
- checkpoint = 'https://download.openmmlab.com/mmdetection/v3.0/rtmdet/cspnext_rsb_pretrain/cspnext-s_imagenet_600e.pth' # noqa
- custom_hooks = [
- dict(
- ema_type='ExpMomentumEMA',
- momentum=0.0002,
- priority=49,
- type='EMAHook',
- update_buffers=True),
- dict(
- switch_epoch=max_epochs-20,
- switch_pipeline=[
- dict(backend_args=None, type='LoadImageFromFile'),
- dict(type='LoadAnnotations', with_bbox=True),
- dict(
- keep_ratio=True,
- ratio_range=(
- 0.5,
- 2.0,
- ),
- scale=(
- 640,
- 640,
- ),
- type='RandomResize'),
- dict(crop_size=(
- 640,
- 640,
- ), type='RandomCrop'),
- dict(type='YOLOXHSVRandomAug'),
- dict(prob=0.5, type='RandomFlip'),
- dict(
- pad_val=dict(img=(
- 114,
- 114,
- 114,
- )),
- size=(
- 640,
- 640,
- ),
- type='Pad'),
- dict(type='PackDetInputs'),
- ],
- type='PipelineSwitchHook'),
- ]
- data_root = '../../../media/tricolops/T7/Dataset/coco_format_bd/'
- dataset_type = 'CocoDataset'
- default_hooks = dict(
- checkpoint=dict(interval=5, save_best='auto', type='CheckpointHook'),
- logger=dict(interval=50, type='LoggerHook'),
- param_scheduler=dict(type='ParamSchedulerHook'),
- sampler_seed=dict(type='DistSamplerSeedHook'),
- timer=dict(type='IterTimerHook'),
- visualization=dict(type='DetVisualizationHook'))
- default_scope = 'mmdet'
- env_cfg = dict(
- cudnn_benchmark=False,
- dist_cfg=dict(backend='nccl'),
- mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0))
- img_scales = [
- (
- 640,
- 640,
- ),
- (
- 320,
- 320,
- ),
- (
- 960,
- 960,
- ),
- ]
- interval = 5
- launcher = 'none'
- load_from = None
- log_level = 'INFO'
- log_processor = dict(by_epoch=True, type='LogProcessor', window_size=50)
- metainfo = dict(
- classes=('barcode', ), palette=[
- (
- 220,
- 20,
- 60,
- ),
- ])
- model = dict(
- backbone=dict(
- act_cfg=dict(inplace=True, type='SiLU'),
- arch='P5',
- channel_attention=True,
- deepen_factor=0.33,
- expand_ratio=0.5,
- norm_cfg=dict(type='SyncBN'),
- type='CSPNeXt',
- widen_factor=0.5,
- init_cfg=dict(type='Pretrained',prefix='backbone.',checkpoint=checkpoint)),
- bbox_head=dict(
- act_cfg=dict(inplace=True, type='SiLU'),
- anchor_generator=dict(
- offset=0, strides=[
- 8,
- 16,
- 32,
- ], type='MlvlPointGenerator'),
- bbox_coder=dict(type='DistancePointBBoxCoder'),
- exp_on_reg=False,
- feat_channels=128,
- in_channels=128,
- loss_bbox=dict(loss_weight=1.0, type='SIoULoss'),
- loss_cls=dict(
- beta=2.0,
- loss_weight=2.0,
- type='QualityFocalLoss',
- use_sigmoid=True),
- norm_cfg=dict(type='SyncBN'),
- num_classes=1,
- pred_kernel_size=1,
- share_conv=True,
- stacked_convs=2,
- type='RTMDetSepBNHead',
- with_objectness=False),
- data_preprocessor=dict(
- batch_augments=None,
- bgr_to_rgb=False,
- mean=[
- 103.53,
- 116.28,
- 123.675,
- ],
- std=[
- 57.375,
- 57.12,
- 58.395,
- ],
- type='DetDataPreprocessor'),
- neck=dict(
- act_cfg=dict(inplace=True, type='SiLU'),
- expand_ratio=0.5,
- in_channels=[
- 128,
- 256,
- 512,
- ],
- norm_cfg=dict(type='SyncBN'),
- num_csp_blocks=1,
- out_channels=128,
- type='CSPNeXtPAFPN'),
- test_cfg=dict(
- max_per_img=300,
- min_bbox_size=0,
- nms=dict(iou_threshold=0.65, type='nms'),
- nms_pre=30000,
- score_thr=0.001),
- train_cfg=dict(
- allowed_border=-1,
- assigner=dict(topk=13, type='DynamicSoftLabelAssigner'),
- debug=False,
- pos_weight=-1),
- type='RTMDet')
- optim_wrapper = dict(
- clip_grad=dict(max_norm=0.1, norm_type=2),
- optimizer=dict(lr=base_lr, type='AdamW', weight_decay=0.05),
- paramwise_cfg=dict(
- bias_decay_mult=0, bypass_duplicate=True, norm_decay_mult=0),
- type='OptimWrapper')
- param_scheduler = [
- dict(
- begin=0, by_epoch=False, end=1000, start_factor=1e-05,
- type='LinearLR'),
- dict(
- T_max=max_epochs // 2,
- begin=max_epochs // 2,
- by_epoch=True,
- convert_to_iter_based=True,
- end=max_epochs,
- eta_min=base_lr * 0.05,
- type='CosineAnnealingLR'),
- ]
- resume = False
- test_cfg = dict(type='TestLoop')
- test_dataloader = dict(
- batch_size=1,
- dataset=dict(
- ann_file='Val/Val.json',
- backend_args=None,
- data_prefix=dict(img='Val/'),
- data_root='../../../media/tricolops/T7/Dataset/coco_format_bd/',
- metainfo=dict(classes=('barcode', ), palette=[
- (
- 220,
- 20,
- 60,
- ),
- ]),
- pipeline=[
- dict(backend_args=None, type='LoadImageFromFile'),
- dict(keep_ratio=True, scale=(
- 640,
- 640,
- ), type='Resize'),
- dict(
- pad_val=dict(img=(
- 114,
- 114,
- 114,
- )),
- size=(
- 640,
- 640,
- ),
- type='Pad'),
- dict(type='LoadAnnotations', with_bbox=True),
- dict(
- meta_keys=(
- 'img_id',
- 'img_path',
- 'ori_shape',
- 'img_shape',
- 'scale_factor',
- ),
- type='PackDetInputs'),
- ],
- test_mode=True,
- type='CocoDataset'),
- drop_last=False,
- num_workers=10,
- persistent_workers=True,
- sampler=dict(shuffle=False, type='DefaultSampler'))
- test_evaluator = dict(
- ann_file='../../../media/tricolops/T7/Dataset/coco_format_bd/Val/Val.json',
- backend_args=None,
- format_only=False,
- metric='bbox',
- proposal_nums=(
- 100,
- 1,
- 10,
- ),
- type='CocoMetric')
- test_pipeline = [
- dict(backend_args=None, type='LoadImageFromFile'),
- dict(keep_ratio=True, scale=(
- 640,
- 640,
- ), type='Resize'),
- dict(pad_val=dict(img=(
- 114,
- 114,
- 114,
- )), size=(
- 640,
- 640,
- ), type='Pad'),
- dict(type='LoadAnnotations', with_bbox=True),
- dict(
- meta_keys=(
- 'img_id',
- 'img_path',
- 'ori_shape',
- 'img_shape',
- 'scale_factor',
- ),
- type='PackDetInputs'),
- ]
- train_cfg = dict(
- dynamic_intervals=[
- (
- 220,
- 1,
- ),
- ],
- max_epochs=max_epochs,
- type='EpochBasedTrainLoop',
- val_interval=1)
- train_dataloader = dict(
- batch_sampler=None,
- batch_size=12,
- dataset=dict(
- ann_file='Train/Train.json',
- backend_args=None,
- data_prefix=dict(img='Train/'),
- data_root='../../../media/tricolops/T7/Dataset/coco_format_bd/',
- filter_cfg=dict(filter_empty_gt=True, min_size=32),
- metainfo=dict(classes=('barcode', ), palette=[
- (
- 220,
- 20,
- 60,
- ),
- ]),
- pipeline=[
- dict(backend_args=None, type='LoadImageFromFile'),
- dict(type='LoadAnnotations', with_bbox=True),
- dict(
- img_scale=(
- 640,
- 640,
- ),
- max_cached_images=20,
- pad_val=114.0,
- random_pop=False,
- type='CachedMosaic'),
- dict(
- keep_ratio=True,
- ratio_range=(
- 0.5,
- 2.0,
- ),
- scale=(
- 640,
- 640,
- ),
- type='RandomResize'),
- dict(crop_size=(
- 640,
- 640,
- ), type='RandomCrop'),
- dict(type='YOLOXHSVRandomAug'),
- dict(prob=0.5, type='RandomFlip'),
- dict(
- pad_val=dict(img=(
- 114,
- 114,
- 114,
- )),
- size=(
- 640,
- 640,
- ),
- type='Pad'),
- dict(
- img_scale=(
- 640,
- 640,
- ),
- max_cached_images=10,
- pad_val=(
- 114,
- 114,
- 114,
- ),
- prob=0.5,
- random_pop=False,
- ratio_range=(
- 1.0,
- 1.0,
- ),
- type='CachedMixUp'),
- dict(type='PackDetInputs'),
- ],
- type='CocoDataset'),
- num_workers=10,
- persistent_workers=True,
- pin_memory=True,
- sampler=dict(shuffle=True, type='DefaultSampler'))
- # train_pipeline = [
- # dict(backend_args=None, type='LoadImageFromFile'),
- # dict(type='LoadAnnotations', with_bbox=True),
- # dict(
- # img_scale=(
- # 640,
- # 640,
- # ),
- # max_cached_images=20,
- # pad_val=114.0,
- # random_pop=False,
- # type='CachedMosaic'),
- # dict(
- # keep_ratio=True,
- # ratio_range=(
- # 0.5,
- # 2.0,
- # ),
- # scale=(
- # 1280,
- # 1280,
- # ),
- # type='RandomResize'),
- # dict(crop_size=(
- # 640,
- # 640,
- # ), type='RandomCrop'),
- # dict(type='YOLOXHSVRandomAug'),
- # dict(prob=0.5, type='RandomFlip'),
- # dict(pad_val=dict(img=(
- # 114,
- # 114,
- # 114,
- # )), size=(
- # 640,
- # 640,
- # ), type='Pad'),
- # dict(
- # img_scale=(
- # 640,
- # 640,
- # ),
- # max_cached_images=10,
- # pad_val=(
- # 114,
- # 114,
- # 114,
- # ),
- # prob=0.5,
- # random_pop=False,
- # ratio_range=(
- # 1.0,
- # 1.0,
- # ),
- # type='CachedMixUp'),
- # dict(type='PackDetInputs'),
- # ]
- # train_pipeline_stage2 = [
- # dict(backend_args=None, type='LoadImageFromFile'),
- # dict(type='LoadAnnotations', with_bbox=True),
- # dict(
- # keep_ratio=True,
- # ratio_range=(
- # 0.5,
- # 2.0,
- # ),
- # scale=(
- # 640,
- # 640,
- # ),
- # type='RandomResize'),
- # dict(crop_size=(
- # 640,
- # 640,
- # ), type='RandomCrop'),
- # dict(type='YOLOXHSVRandomAug'),
- # dict(prob=0.5, type='RandomFlip'),
- # dict(pad_val=dict(img=(
- # 114,
- # 114,
- # 114,
- # )), size=(
- # 640,
- # 640,
- # ), type='Pad'),
- # dict(type='PackDetInputs'),
- # ]
- tta_model = dict(
- tta_cfg=dict(max_per_img=100, nms=dict(iou_threshold=0.6, type='nms')),
- type='DetTTAModel')
- tta_pipeline = [
- dict(backend_args=None, type='LoadImageFromFile'),
- dict(
- transforms=[
- [
- dict(keep_ratio=True, scale=(
- 640,
- 640,
- ), type='Resize'),
- dict(keep_ratio=True, scale=(
- 320,
- 320,
- ), type='Resize'),
- dict(keep_ratio=True, scale=(
- 960,
- 960,
- ), type='Resize'),
- ],
- [
- dict(prob=1.0, type='RandomFlip'),
- dict(prob=0.0, type='RandomFlip'),
- ],
- [
- dict(
- pad_val=dict(img=(
- 114,
- 114,
- 114,
- )),
- size=(
- 960,
- 960,
- ),
- type='Pad'),
- ],
- [
- dict(type='LoadAnnotations', with_bbox=True),
- ],
- [
- dict(
- meta_keys=(
- 'img_id',
- 'img_path',
- 'ori_shape',
- 'img_shape',
- 'scale_factor',
- 'flip',
- 'flip_direction',
- ),
- type='PackDetInputs'),
- ],
- ],
- type='TestTimeAug'),
- ]
- val_cfg = dict(type='ValLoop')
- val_dataloader = dict(
- batch_size=1,
- dataset=dict(
- ann_file='Val/Val.json',
- backend_args=None,
- data_prefix=dict(img='Val/'),
- data_root='../../../media/tricolops/T7/Dataset/coco_format_bd/',
- metainfo=dict(classes=('barcode', ), palette=[
- (
- 220,
- 20,
- 60,
- ),
- ]),
- pipeline=[
- dict(backend_args=None, type='LoadImageFromFile'),
- dict(keep_ratio=True, scale=(
- 640,
- 640,
- ), type='Resize'),
- dict(
- pad_val=dict(img=(
- 114,
- 114,
- 114,
- )),
- size=(
- 640,
- 640,
- ),
- type='Pad'),
- dict(type='LoadAnnotations', with_bbox=True),
- dict(
- meta_keys=(
- 'img_id',
- 'img_path',
- 'ori_shape',
- 'img_shape',
- 'scale_factor',
- ),
- type='PackDetInputs'),
- ],
- test_mode=True,
- type='CocoDataset'),
- drop_last=False,
- num_workers=10,
- persistent_workers=True,
- sampler=dict(shuffle=False, type='DefaultSampler'))
- val_evaluator = dict(
- ann_file='../../../media/tricolops/T7/Dataset/coco_format_bd/Val/Val.json',
- backend_args=None,
- format_only=False,
- metric='bbox',
- proposal_nums=(
- 100,
- 1,
- 10,
- ),
- type='CocoMetric')
- vis_backends = [
- dict(type='LocalVisBackend'),
- ]
- visualizer = dict(
- name='visualizer',
- type='DetLocalVisualizer',
- vis_backends=[
- dict(type='LocalVisBackend'),
- ])
- work_dir = './work_dirs/rtmdet_small_1xb16-300e_coco'
|