ssd300_8xb32-24e_widerface.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. _base_ = [
  2. '../_base_/models/ssd300.py', '../_base_/datasets/wider_face.py',
  3. '../_base_/default_runtime.py', '../_base_/schedules/schedule_2x.py'
  4. ]
  5. model = dict(bbox_head=dict(num_classes=1))
  6. train_pipeline = [
  7. dict(type='LoadImageFromFile', backend_args=_base_.backend_args),
  8. dict(type='LoadAnnotations', with_bbox=True),
  9. dict(
  10. type='PhotoMetricDistortion',
  11. brightness_delta=32,
  12. contrast_range=(0.5, 1.5),
  13. saturation_range=(0.5, 1.5),
  14. hue_delta=18),
  15. dict(
  16. type='Expand',
  17. mean={{_base_.model.data_preprocessor.mean}},
  18. to_rgb={{_base_.model.data_preprocessor.bgr_to_rgb}},
  19. ratio_range=(1, 4)),
  20. dict(
  21. type='MinIoURandomCrop',
  22. min_ious=(0.1, 0.3, 0.5, 0.7, 0.9),
  23. min_crop_size=0.3),
  24. dict(type='Resize', scale=(300, 300), keep_ratio=False),
  25. dict(type='RandomFlip', prob=0.5),
  26. dict(type='PackDetInputs')
  27. ]
  28. test_pipeline = [
  29. dict(type='LoadImageFromFile', backend_args=_base_.backend_args),
  30. dict(type='Resize', scale=(300, 300), keep_ratio=False),
  31. dict(type='LoadAnnotations', with_bbox=True),
  32. dict(
  33. type='PackDetInputs',
  34. meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
  35. 'scale_factor'))
  36. ]
  37. dataset_type = 'WIDERFaceDataset'
  38. data_root = 'data/WIDERFace/'
  39. train_dataloader = dict(
  40. batch_size=32, num_workers=8, dataset=dict(pipeline=train_pipeline))
  41. val_dataloader = dict(dataset=dict(pipeline=test_pipeline))
  42. test_dataloader = val_dataloader
  43. # learning rate
  44. param_scheduler = [
  45. dict(
  46. type='LinearLR', start_factor=0.001, by_epoch=False, begin=0,
  47. end=1000),
  48. dict(type='MultiStepLR', by_epoch=True, milestones=[16, 20], gamma=0.1)
  49. ]
  50. # optimizer
  51. optim_wrapper = dict(
  52. optimizer=dict(lr=0.012, momentum=0.9, weight_decay=5e-4),
  53. clip_grad=dict(max_norm=35, norm_type=2))
  54. # NOTE: `auto_scale_lr` is for automatically scaling LR,
  55. # USER SHOULD NOT CHANGE ITS VALUES.
  56. # base_batch_size = (8 GPUs) x (32 samples per GPU)
  57. auto_scale_lr = dict(base_batch_size=256)