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.

lsj_100e_coco_instance.py 3.1 kB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. image_size = (1024, 1024)
  8. file_client_args = dict(backend='disk')
  9. # comment out the code below to use different file client
  10. # file_client_args = dict(
  11. # backend='petrel',
  12. # path_mapping=dict({
  13. # './data/': 's3://openmmlab/datasets/detection/',
  14. # 'data/': 's3://openmmlab/datasets/detection/'
  15. # }))
  16. train_pipeline = [
  17. dict(type='LoadImageFromFile', file_client_args=file_client_args),
  18. dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
  19. dict(
  20. type='Resize',
  21. img_scale=image_size,
  22. ratio_range=(0.1, 2.0),
  23. multiscale_mode='range',
  24. keep_ratio=True),
  25. dict(
  26. type='RandomCrop',
  27. crop_type='absolute_range',
  28. crop_size=image_size,
  29. recompute_bbox=True,
  30. allow_negative_crop=True),
  31. dict(type='FilterAnnotations', min_gt_bbox_wh=(1e-2, 1e-2)),
  32. dict(type='RandomFlip', flip_ratio=0.5),
  33. dict(type='Normalize', **img_norm_cfg),
  34. dict(type='Pad', size=image_size), # padding to image_size leads 0.5+ mAP
  35. dict(type='DefaultFormatBundle'),
  36. dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']),
  37. ]
  38. test_pipeline = [
  39. dict(type='LoadImageFromFile', file_client_args=file_client_args),
  40. dict(
  41. type='MultiScaleFlipAug',
  42. img_scale=(1333, 800),
  43. flip=False,
  44. transforms=[
  45. dict(type='Resize', keep_ratio=True),
  46. dict(type='RandomFlip'),
  47. dict(type='Normalize', **img_norm_cfg),
  48. dict(type='Pad', size_divisor=32),
  49. dict(type='ImageToTensor', keys=['img']),
  50. dict(type='Collect', keys=['img']),
  51. ])
  52. ]
  53. # Use RepeatDataset to speed up training
  54. data = dict(
  55. samples_per_gpu=2,
  56. workers_per_gpu=2,
  57. train=dict(
  58. type='RepeatDataset',
  59. times=4, # simply change this from 2 to 16 for 50e - 400e training.
  60. dataset=dict(
  61. type=dataset_type,
  62. ann_file=data_root + 'annotations/instances_train2017.json',
  63. img_prefix=data_root + 'train2017/',
  64. pipeline=train_pipeline)),
  65. val=dict(
  66. type=dataset_type,
  67. ann_file=data_root + 'annotations/instances_val2017.json',
  68. img_prefix=data_root + 'val2017/',
  69. pipeline=test_pipeline),
  70. test=dict(
  71. type=dataset_type,
  72. ann_file=data_root + 'annotations/instances_val2017.json',
  73. img_prefix=data_root + 'val2017/',
  74. pipeline=test_pipeline))
  75. evaluation = dict(interval=5, metric=['bbox', 'segm'])
  76. # optimizer assumes bs=64
  77. optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.00004)
  78. optimizer_config = dict(grad_clip=None)
  79. lr_config = dict(
  80. policy='step',
  81. warmup='linear',
  82. warmup_iters=500,
  83. warmup_ratio=0.067,
  84. step=[22, 24])
  85. runner = dict(type='EpochBasedRunner', max_epochs=25)

No Description

Contributors (3)