ade20k_instance.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # dataset settings
  2. dataset_type = 'ADE20KInstanceDataset'
  3. data_root = 'data/ADEChallengeData2016/'
  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/ADEChallengeData2016/'
  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. test_pipeline = [
  17. dict(type='LoadImageFromFile', backend_args=backend_args),
  18. dict(type='Resize', scale=(2560, 640), keep_ratio=True),
  19. # If you don't have a gt annotation, delete the pipeline
  20. dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
  21. dict(
  22. type='PackDetInputs',
  23. meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
  24. 'scale_factor'))
  25. ]
  26. val_dataloader = dict(
  27. batch_size=1,
  28. num_workers=2,
  29. persistent_workers=True,
  30. drop_last=False,
  31. sampler=dict(type='DefaultSampler', shuffle=False),
  32. dataset=dict(
  33. type=dataset_type,
  34. data_root=data_root,
  35. ann_file='ade20k_instance_val.json',
  36. data_prefix=dict(img='images/validation'),
  37. test_mode=True,
  38. pipeline=test_pipeline,
  39. backend_args=backend_args))
  40. test_dataloader = val_dataloader
  41. val_evaluator = dict(
  42. type='CocoMetric',
  43. ann_file=data_root + 'ade20k_instance_val.json',
  44. metric=['bbox', 'segm'],
  45. format_only=False,
  46. backend_args=backend_args)
  47. test_evaluator = val_evaluator