refcoco.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # dataset settings
  2. dataset_type = 'RefCocoDataset'
  3. data_root = 'data/coco/'
  4. backend_args = None
  5. test_pipeline = [
  6. dict(type='LoadImageFromFile', backend_args=backend_args),
  7. dict(type='Resize', scale=(1333, 800), keep_ratio=True),
  8. dict(
  9. type='LoadAnnotations',
  10. with_mask=True,
  11. with_bbox=False,
  12. with_seg=False,
  13. with_label=False),
  14. dict(
  15. type='PackDetInputs',
  16. meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
  17. 'scale_factor', 'gt_masks', 'text'))
  18. ]
  19. val_dataloader = dict(
  20. batch_size=1,
  21. num_workers=2,
  22. persistent_workers=True,
  23. drop_last=False,
  24. sampler=dict(type='DefaultSampler', shuffle=False),
  25. dataset=dict(
  26. type=dataset_type,
  27. data_root=data_root,
  28. data_prefix=dict(img_path='train2014/'),
  29. ann_file='refcoco/instances.json',
  30. split_file='refcoco/refs(unc).p',
  31. split='val',
  32. text_mode='select_first',
  33. pipeline=test_pipeline))
  34. test_dataloader = dict(
  35. batch_size=1,
  36. num_workers=2,
  37. persistent_workers=True,
  38. drop_last=False,
  39. sampler=dict(type='DefaultSampler', shuffle=False),
  40. dataset=dict(
  41. type=dataset_type,
  42. data_root=data_root,
  43. data_prefix=dict(img_path='train2014/'),
  44. ann_file='refcoco/instances.json',
  45. split_file='refcoco/refs(unc).p',
  46. split='testA', # or 'testB'
  47. text_mode='select_first',
  48. pipeline=test_pipeline))
  49. val_evaluator = dict(type='RefSegMetric', metric=['cIoU', 'mIoU'])
  50. test_evaluator = val_evaluator