wider_face.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # dataset settings
  2. dataset_type = 'WIDERFaceDataset'
  3. data_root = 'data/WIDERFace/'
  4. # Example to use different file client
  5. # Method 1: simply set the data root and let the file I/O module
  6. # automatically infer from prefix (not support LMDB and Memcache yet)
  7. # data_root = 's3://openmmlab/datasets/detection/cityscapes/'
  8. # Method 2: Use `backend_args`, `file_client_args` in versions before 3.0.0rc6
  9. # backend_args = dict(
  10. # backend='petrel',
  11. # path_mapping=dict({
  12. # './data/': 's3://openmmlab/datasets/detection/',
  13. # 'data/': 's3://openmmlab/datasets/detection/'
  14. # }))
  15. backend_args = None
  16. img_scale = (640, 640) # VGA resolution
  17. train_pipeline = [
  18. dict(type='LoadImageFromFile', backend_args=backend_args),
  19. dict(type='LoadAnnotations', with_bbox=True),
  20. dict(type='Resize', scale=img_scale, keep_ratio=True),
  21. dict(type='RandomFlip', prob=0.5),
  22. dict(type='PackDetInputs')
  23. ]
  24. test_pipeline = [
  25. dict(type='LoadImageFromFile', backend_args=backend_args),
  26. dict(type='Resize', scale=img_scale, keep_ratio=True),
  27. dict(type='LoadAnnotations', with_bbox=True),
  28. dict(
  29. type='PackDetInputs',
  30. meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
  31. 'scale_factor'))
  32. ]
  33. train_dataloader = dict(
  34. batch_size=2,
  35. num_workers=2,
  36. persistent_workers=True,
  37. drop_last=False,
  38. sampler=dict(type='DefaultSampler', shuffle=True),
  39. batch_sampler=dict(type='AspectRatioBatchSampler'),
  40. dataset=dict(
  41. type=dataset_type,
  42. data_root=data_root,
  43. ann_file='train.txt',
  44. data_prefix=dict(img='WIDER_train'),
  45. filter_cfg=dict(filter_empty_gt=True, bbox_min_size=17, min_size=32),
  46. pipeline=train_pipeline))
  47. val_dataloader = dict(
  48. batch_size=1,
  49. num_workers=2,
  50. persistent_workers=True,
  51. drop_last=False,
  52. sampler=dict(type='DefaultSampler', shuffle=False),
  53. dataset=dict(
  54. type=dataset_type,
  55. data_root=data_root,
  56. ann_file='val.txt',
  57. data_prefix=dict(img='WIDER_val'),
  58. test_mode=True,
  59. pipeline=test_pipeline))
  60. test_dataloader = val_dataloader
  61. val_evaluator = dict(
  62. # TODO: support WiderFace-Evaluation for easy, medium, hard cases
  63. type='VOCMetric',
  64. metric='mAP',
  65. eval_mode='11points')
  66. test_evaluator = val_evaluator