dsdl.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. dataset_type = 'DSDLDetDataset'
  2. data_root = 'path to dataset folder'
  3. train_ann = 'path to train yaml file'
  4. val_ann = 'path to val yaml file'
  5. backend_args = None
  6. # backend_args = dict(
  7. # backend='petrel',
  8. # path_mapping=dict({
  9. # './data/': "s3://open_data/",
  10. # 'data/': "s3://open_data/"
  11. # }))
  12. train_pipeline = [
  13. dict(type='LoadImageFromFile', backend_args=backend_args),
  14. dict(type='LoadAnnotations', with_bbox=True),
  15. dict(type='Resize', scale=(1333, 800), keep_ratio=True),
  16. dict(type='RandomFlip', prob=0.5),
  17. dict(type='PackDetInputs')
  18. ]
  19. test_pipeline = [
  20. dict(type='LoadImageFromFile', backend_args=backend_args),
  21. dict(type='Resize', scale=(1333, 800), keep_ratio=True),
  22. # If you don't have a gt annotation, delete the pipeline
  23. dict(type='LoadAnnotations', with_bbox=True),
  24. dict(
  25. type='PackDetInputs',
  26. meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
  27. 'scale_factor', 'instances'))
  28. ]
  29. train_dataloader = dict(
  30. batch_size=2,
  31. num_workers=2,
  32. persistent_workers=True,
  33. sampler=dict(type='DefaultSampler', shuffle=True),
  34. batch_sampler=dict(type='AspectRatioBatchSampler'),
  35. dataset=dict(
  36. type=dataset_type,
  37. data_root=data_root,
  38. ann_file=train_ann,
  39. filter_cfg=dict(filter_empty_gt=True, min_size=32, bbox_min_size=32),
  40. pipeline=train_pipeline))
  41. val_dataloader = dict(
  42. batch_size=1,
  43. num_workers=2,
  44. persistent_workers=True,
  45. drop_last=False,
  46. sampler=dict(type='DefaultSampler', shuffle=False),
  47. dataset=dict(
  48. type=dataset_type,
  49. data_root=data_root,
  50. ann_file=val_ann,
  51. test_mode=True,
  52. pipeline=test_pipeline))
  53. test_dataloader = val_dataloader
  54. val_evaluator = dict(type='CocoMetric', metric='bbox')
  55. # val_evaluator = dict(type='VOCMetric', metric='mAP', eval_mode='11points')
  56. test_evaluator = val_evaluator