deepfashion.py 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # dataset settings
  2. dataset_type = 'DeepFashionDataset'
  3. data_root = 'data/DeepFashion/In-shop/'
  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/coco/'
  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. train_pipeline = [
  17. dict(type='LoadImageFromFile', backend_args=backend_args),
  18. dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
  19. dict(type='Resize', scale=(750, 1101), keep_ratio=True),
  20. dict(type='RandomFlip', prob=0.5),
  21. dict(type='PackDetInputs')
  22. ]
  23. test_pipeline = [
  24. dict(type='LoadImageFromFile', backend_args=backend_args),
  25. dict(type='Resize', scale=(750, 1101), keep_ratio=True),
  26. dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
  27. dict(
  28. type='PackDetInputs',
  29. meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
  30. 'scale_factor'))
  31. ]
  32. train_dataloader = dict(
  33. batch_size=2,
  34. num_workers=2,
  35. persistent_workers=True,
  36. sampler=dict(type='DefaultSampler', shuffle=True),
  37. batch_sampler=dict(type='AspectRatioBatchSampler'),
  38. dataset=dict(
  39. type='RepeatDataset',
  40. times=2,
  41. dataset=dict(
  42. type=dataset_type,
  43. data_root=data_root,
  44. ann_file='Anno/segmentation/DeepFashion_segmentation_train.json',
  45. data_prefix=dict(img='Img/'),
  46. filter_cfg=dict(filter_empty_gt=True, min_size=32),
  47. pipeline=train_pipeline,
  48. backend_args=backend_args)))
  49. val_dataloader = dict(
  50. batch_size=1,
  51. num_workers=2,
  52. persistent_workers=True,
  53. drop_last=False,
  54. sampler=dict(type='DefaultSampler', shuffle=False),
  55. dataset=dict(
  56. type=dataset_type,
  57. data_root=data_root,
  58. ann_file='Anno/segmentation/DeepFashion_segmentation_query.json',
  59. data_prefix=dict(img='Img/'),
  60. test_mode=True,
  61. pipeline=test_pipeline,
  62. backend_args=backend_args))
  63. test_dataloader = dict(
  64. batch_size=1,
  65. num_workers=2,
  66. persistent_workers=True,
  67. drop_last=False,
  68. sampler=dict(type='DefaultSampler', shuffle=False),
  69. dataset=dict(
  70. type=dataset_type,
  71. data_root=data_root,
  72. ann_file='Anno/segmentation/DeepFashion_segmentation_gallery.json',
  73. data_prefix=dict(img='Img/'),
  74. test_mode=True,
  75. pipeline=test_pipeline,
  76. backend_args=backend_args))
  77. val_evaluator = dict(
  78. type='CocoMetric',
  79. ann_file=data_root +
  80. 'Anno/segmentation/DeepFashion_segmentation_query.json',
  81. metric=['bbox', 'segm'],
  82. format_only=False,
  83. backend_args=backend_args)
  84. test_evaluator = dict(
  85. type='CocoMetric',
  86. ann_file=data_root +
  87. 'Anno/segmentation/DeepFashion_segmentation_gallery.json',
  88. metric=['bbox', 'segm'],
  89. format_only=False,
  90. backend_args=backend_args)