You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mstrain_3x_coco.py 2.4 kB

2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. _base_ = '../_base_/default_runtime.py'
  2. # dataset settings
  3. dataset_type = 'CocoDataset'
  4. data_root = 'data/coco/'
  5. img_norm_cfg = dict(
  6. mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
  7. # In mstrain 3x config, img_scale=[(1333, 640), (1333, 800)],
  8. # multiscale_mode='range'
  9. train_pipeline = [
  10. dict(type='LoadImageFromFile'),
  11. dict(type='LoadAnnotations', with_bbox=True),
  12. dict(
  13. type='Resize',
  14. img_scale=[(1333, 640), (1333, 800)],
  15. multiscale_mode='range',
  16. keep_ratio=True),
  17. dict(type='RandomFlip', flip_ratio=0.5),
  18. dict(type='Normalize', **img_norm_cfg),
  19. dict(type='Pad', size_divisor=32),
  20. dict(type='DefaultFormatBundle'),
  21. dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
  22. ]
  23. test_pipeline = [
  24. dict(type='LoadImageFromFile'),
  25. dict(
  26. type='MultiScaleFlipAug',
  27. img_scale=(1333, 800),
  28. flip=False,
  29. transforms=[
  30. dict(type='Resize', keep_ratio=True),
  31. dict(type='RandomFlip'),
  32. dict(type='Normalize', **img_norm_cfg),
  33. dict(type='Pad', size_divisor=32),
  34. dict(type='ImageToTensor', keys=['img']),
  35. dict(type='Collect', keys=['img']),
  36. ])
  37. ]
  38. # Use RepeatDataset to speed up training
  39. data = dict(
  40. samples_per_gpu=2,
  41. workers_per_gpu=2,
  42. train=dict(
  43. type='RepeatDataset',
  44. times=3,
  45. dataset=dict(
  46. type=dataset_type,
  47. ann_file=data_root + 'annotations/instances_train2017.json',
  48. img_prefix=data_root + 'train2017/',
  49. pipeline=train_pipeline)),
  50. val=dict(
  51. type=dataset_type,
  52. ann_file=data_root + 'annotations/instances_val2017.json',
  53. img_prefix=data_root + 'val2017/',
  54. pipeline=test_pipeline),
  55. test=dict(
  56. type=dataset_type,
  57. ann_file=data_root + 'annotations/instances_val2017.json',
  58. img_prefix=data_root + 'val2017/',
  59. pipeline=test_pipeline))
  60. evaluation = dict(interval=1, metric='bbox')
  61. # optimizer
  62. optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
  63. optimizer_config = dict(grad_clip=None)
  64. # learning policy
  65. # Experiments show that using step=[9, 11] has higher performance
  66. lr_config = dict(
  67. policy='step',
  68. warmup='linear',
  69. warmup_iters=500,
  70. warmup_ratio=0.001,
  71. step=[9, 11])
  72. runner = dict(type='EpochBasedRunner', max_epochs=12)

No Description

Contributors (3)