diff --git a/configs/_base_/datasets/ucsd_half-256x512.py b/configs/_base_/datasets/ucsd_half-256x512.py new file mode 100644 index 0000000000..ba80cb7fd3 --- /dev/null +++ b/configs/_base_/datasets/ucsd_half-256x512.py @@ -0,0 +1,68 @@ +# dataset settings +dataset_type = 'MapillaryDataset_v1' +data_root = '/lich-central-vol/dataset/campus_dataset' +crop_size = (256, 512) +train_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='LoadAnnotations'), + dict( + type='RandomResize', + scale=(1280, 720), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), + dict(type='RandomFlip', prob=0.5), + dict(type='PhotoMetricDistortion'), + dict(type='PackSegInputs') +] +test_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='Resize', scale=(1280, 720), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type='LoadAnnotations'), + dict(type='PackSegInputs') +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), + dict( + type='TestTimeAug', + transforms=[ + [ + dict(type='Resize', scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type='RandomFlip', prob=0., direction='horizontal'), + dict(type='RandomFlip', prob=1., direction='horizontal') + ], [dict(type='LoadAnnotations')], [dict(type='PackSegInputs')] + ]) +] +train_dataloader = dict( + batch_size=2, + num_workers=2, + persistent_workers=True, + sampler=dict(type='InfiniteSampler', shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='training/images', seg_map_path='training/labels'), + pipeline=train_pipeline)) +val_dataloader = dict( + batch_size=1, + num_workers=4, + persistent_workers=True, + sampler=dict(type='DefaultSampler', shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='validation/images', + seg_map_path='validation/labels'), + pipeline=test_pipeline)) +test_dataloader = val_dataloader + +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) +test_evaluator = val_evaluator diff --git a/configs/_base_/datasets/ucsd_half-360x640.py b/configs/_base_/datasets/ucsd_half-360x640.py new file mode 100644 index 0000000000..fa0c98e39d --- /dev/null +++ b/configs/_base_/datasets/ucsd_half-360x640.py @@ -0,0 +1,68 @@ +# dataset settings +dataset_type = 'MapillaryDataset_v1' +data_root = '/lich-central-vol/dataset/campus_dataset' +crop_size = (360, 640) +train_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='LoadAnnotations'), + dict( + type='RandomResize', + scale=(1280, 720), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), + dict(type='RandomFlip', prob=0.5), + dict(type='PhotoMetricDistortion'), + dict(type='PackSegInputs') +] +test_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='Resize', scale=(1280, 720), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type='LoadAnnotations'), + dict(type='PackSegInputs') +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), + dict( + type='TestTimeAug', + transforms=[ + [ + dict(type='Resize', scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type='RandomFlip', prob=0., direction='horizontal'), + dict(type='RandomFlip', prob=1., direction='horizontal') + ], [dict(type='LoadAnnotations')], [dict(type='PackSegInputs')] + ]) +] +train_dataloader = dict( + batch_size=2, + num_workers=4, + persistent_workers=True, + sampler=dict(type='InfiniteSampler', shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='training/images', seg_map_path='training/labels'), + pipeline=train_pipeline)) +val_dataloader = dict( + batch_size=1, + num_workers=4, + persistent_workers=True, + sampler=dict(type='DefaultSampler', shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='validation/images', + seg_map_path='validation/labels'), + pipeline=test_pipeline)) +test_dataloader = val_dataloader + +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) +test_evaluator = val_evaluator diff --git a/configs/_base_/datasets/ucsd_half-512x1024.py b/configs/_base_/datasets/ucsd_half-512x1024.py new file mode 100644 index 0000000000..4544efd70d --- /dev/null +++ b/configs/_base_/datasets/ucsd_half-512x1024.py @@ -0,0 +1,68 @@ +# dataset settings +dataset_type = 'MapillaryDataset_v1' +data_root = '/lich-central-vol/dataset/ucsd_half' +crop_size = (512, 1024) +train_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='LoadAnnotations'), + dict( + type='RandomResize', + scale=(1280, 720), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), + dict(type='RandomFlip', prob=0.5), + dict(type='PhotoMetricDistortion'), + dict(type='PackSegInputs') +] +test_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='Resize', scale=(1280, 720), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type='LoadAnnotations'), + dict(type='PackSegInputs') +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), + dict( + type='TestTimeAug', + transforms=[ + [ + dict(type='Resize', scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type='RandomFlip', prob=0., direction='horizontal'), + dict(type='RandomFlip', prob=1., direction='horizontal') + ], [dict(type='LoadAnnotations')], [dict(type='PackSegInputs')] + ]) +] +train_dataloader = dict( + batch_size=2, + num_workers=2, + persistent_workers=True, + sampler=dict(type='InfiniteSampler', shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='training/images', seg_map_path='training/labels'), + pipeline=train_pipeline)) +val_dataloader = dict( + batch_size=1, + num_workers=2, + persistent_workers=True, + sampler=dict(type='DefaultSampler', shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='validation/images', + seg_map_path='validation/labels'), + pipeline=test_pipeline)) +test_dataloader = val_dataloader + +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) +test_evaluator = val_evaluator diff --git a/configs/_base_/datasets/ucsd_half-540x960.py b/configs/_base_/datasets/ucsd_half-540x960.py new file mode 100644 index 0000000000..f3dedc96b1 --- /dev/null +++ b/configs/_base_/datasets/ucsd_half-540x960.py @@ -0,0 +1,68 @@ +# dataset settings +dataset_type = 'MapillaryDataset_v1' +data_root = '/lich-central-vol/dataset/campus_dataset' +crop_size = (540, 960) +train_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='LoadAnnotations'), + dict( + type='RandomResize', + scale=(1280, 720), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), + dict(type='RandomFlip', prob=0.5), + dict(type='PhotoMetricDistortion'), + dict(type='PackSegInputs') +] +test_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='Resize', scale=(1280, 720), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type='LoadAnnotations'), + dict(type='PackSegInputs') +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), + dict( + type='TestTimeAug', + transforms=[ + [ + dict(type='Resize', scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type='RandomFlip', prob=0., direction='horizontal'), + dict(type='RandomFlip', prob=1., direction='horizontal') + ], [dict(type='LoadAnnotations')], [dict(type='PackSegInputs')] + ]) +] +train_dataloader = dict( + batch_size=2, + num_workers=2, + persistent_workers=True, + sampler=dict(type='InfiniteSampler', shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='training/images', seg_map_path='training/labels'), + pipeline=train_pipeline)) +val_dataloader = dict( + batch_size=1, + num_workers=2, + persistent_workers=True, + sampler=dict(type='DefaultSampler', shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='validation/images', + seg_map_path='validation/labels'), + pipeline=test_pipeline)) +test_dataloader = val_dataloader + +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) +test_evaluator = val_evaluator diff --git a/configs/_base_/datasets/ucsd_half-720x1280.py b/configs/_base_/datasets/ucsd_half-720x1280.py new file mode 100644 index 0000000000..1eedbf2bb7 --- /dev/null +++ b/configs/_base_/datasets/ucsd_half-720x1280.py @@ -0,0 +1,68 @@ +# dataset settings +dataset_type = 'MapillaryDataset_v1' +data_root = '/lich-central-vol/dataset/campus_dataset' +crop_size = (720, 1280) +train_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='LoadAnnotations'), + dict( + type='RandomResize', + scale=(1280, 720), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), + dict(type='RandomFlip', prob=0.5), + dict(type='PhotoMetricDistortion'), + dict(type='PackSegInputs') +] +test_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='Resize', scale=(1280, 720), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type='LoadAnnotations'), + dict(type='PackSegInputs') +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), + dict( + type='TestTimeAug', + transforms=[ + [ + dict(type='Resize', scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type='RandomFlip', prob=0., direction='horizontal'), + dict(type='RandomFlip', prob=1., direction='horizontal') + ], [dict(type='LoadAnnotations')], [dict(type='PackSegInputs')] + ]) +] +train_dataloader = dict( + batch_size=2, + num_workers=4, + persistent_workers=True, + sampler=dict(type='InfiniteSampler', shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='training/images', seg_map_path='training/labels'), + pipeline=train_pipeline)) +val_dataloader = dict( + batch_size=1, + num_workers=4, + persistent_workers=True, + sampler=dict(type='DefaultSampler', shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='validation/images', + seg_map_path='validation/labels'), + pipeline=test_pipeline)) +test_dataloader = val_dataloader + +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) +test_evaluator = val_evaluator diff --git a/configs/_base_/datasets/ucsd_half-720x720.py b/configs/_base_/datasets/ucsd_half-720x720.py new file mode 100644 index 0000000000..4625d9158d --- /dev/null +++ b/configs/_base_/datasets/ucsd_half-720x720.py @@ -0,0 +1,68 @@ +# dataset settings +dataset_type = 'MapillaryDataset_v1' +data_root = '/lich-central-vol/dataset/ucsd_half' +crop_size = (720, 720) +train_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='LoadAnnotations'), + dict( + type='RandomResize', + scale=(1280, 720), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), + dict(type='RandomFlip', prob=0.5), + dict(type='PhotoMetricDistortion'), + dict(type='PackSegInputs') +] +test_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='Resize', scale=(1280, 720), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type='LoadAnnotations'), + dict(type='PackSegInputs') +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), + dict( + type='TestTimeAug', + transforms=[ + [ + dict(type='Resize', scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type='RandomFlip', prob=0., direction='horizontal'), + dict(type='RandomFlip', prob=1., direction='horizontal') + ], [dict(type='LoadAnnotations')], [dict(type='PackSegInputs')] + ]) +] +train_dataloader = dict( + batch_size=2, + num_workers=2, + persistent_workers=True, + sampler=dict(type='InfiniteSampler', shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='training/images', seg_map_path='training/labels'), + pipeline=train_pipeline)) +val_dataloader = dict( + batch_size=1, + num_workers=2, + persistent_workers=True, + sampler=dict(type='DefaultSampler', shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='validation/images', + seg_map_path='validation/labels'), + pipeline=test_pipeline)) +test_dataloader = val_dataloader + +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) +test_evaluator = val_evaluator diff --git a/configs/_base_/datasets/ucsd_half-832x832.py b/configs/_base_/datasets/ucsd_half-832x832.py new file mode 100644 index 0000000000..7ef848907f --- /dev/null +++ b/configs/_base_/datasets/ucsd_half-832x832.py @@ -0,0 +1,68 @@ +# dataset settings +dataset_type = 'MapillaryDataset_v1' +data_root = '/lich-central-vol/dataset/ucsd_half' +crop_size = (832, 832) +train_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='LoadAnnotations'), + dict( + type='RandomResize', + scale=(1280, 720), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), + dict(type='RandomFlip', prob=0.5), + dict(type='PhotoMetricDistortion'), + dict(type='PackSegInputs') +] +test_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='Resize', scale=(1280, 720), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type='LoadAnnotations'), + dict(type='PackSegInputs') +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), + dict( + type='TestTimeAug', + transforms=[ + [ + dict(type='Resize', scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type='RandomFlip', prob=0., direction='horizontal'), + dict(type='RandomFlip', prob=1., direction='horizontal') + ], [dict(type='LoadAnnotations')], [dict(type='PackSegInputs')] + ]) +] +train_dataloader = dict( + batch_size=2, + num_workers=2, + persistent_workers=True, + sampler=dict(type='InfiniteSampler', shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='training/images', seg_map_path='training/labels'), + pipeline=train_pipeline)) +val_dataloader = dict( + batch_size=1, + num_workers=2, + persistent_workers=True, + sampler=dict(type='DefaultSampler', shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='validation/images', + seg_map_path='validation/labels'), + pipeline=test_pipeline)) +test_dataloader = val_dataloader + +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) +test_evaluator = val_evaluator diff --git a/configs/_base_/datasets/ucsd_half.py b/configs/_base_/datasets/ucsd_half.py new file mode 100644 index 0000000000..1c918b98ab --- /dev/null +++ b/configs/_base_/datasets/ucsd_half.py @@ -0,0 +1,68 @@ +# dataset settings +dataset_type = 'MapillaryDataset_v1' +data_root = '/lich-central-vol/dataset/campus_dataset' +crop_size = (720, 1280) +train_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='LoadAnnotations'), + dict( + type='RandomResize', + scale=(1280, 720), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), + dict(type='RandomFlip', prob=0.5), + dict(type='PhotoMetricDistortion'), + dict(type='PackSegInputs') +] +test_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='Resize', scale=(1280, 720), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type='LoadAnnotations'), + dict(type='PackSegInputs') +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), + dict( + type='TestTimeAug', + transforms=[ + [ + dict(type='Resize', scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type='RandomFlip', prob=0., direction='horizontal'), + dict(type='RandomFlip', prob=1., direction='horizontal') + ], [dict(type='LoadAnnotations')], [dict(type='PackSegInputs')] + ]) +] +train_dataloader = dict( + batch_size=2, + num_workers=2, + persistent_workers=True, + sampler=dict(type='InfiniteSampler', shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='training/images', seg_map_path='training/labels'), + pipeline=train_pipeline)) +val_dataloader = dict( + batch_size=1, + num_workers=2, + persistent_workers=True, + sampler=dict(type='DefaultSampler', shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='validation/images', + seg_map_path='validation/labels'), + pipeline=test_pipeline)) +test_dataloader = val_dataloader + +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) +test_evaluator = val_evaluator diff --git a/configs/_base_/datasets/ucsd_half_4x4-512x1024.py b/configs/_base_/datasets/ucsd_half_4x4-512x1024.py new file mode 100644 index 0000000000..b1efc838e0 --- /dev/null +++ b/configs/_base_/datasets/ucsd_half_4x4-512x1024.py @@ -0,0 +1,68 @@ +# dataset settings +dataset_type = 'MapillaryDataset_v1' +data_root = '/lich-central-vol/dataset/ucsd_half' +crop_size = (512, 1024) +train_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='LoadAnnotations'), + dict( + type='RandomResize', + scale=(1280, 720), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), + dict(type='RandomFlip', prob=0.5), + dict(type='PhotoMetricDistortion'), + dict(type='PackSegInputs') +] +test_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='Resize', scale=(1280, 720), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type='LoadAnnotations'), + dict(type='PackSegInputs') +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), + dict( + type='TestTimeAug', + transforms=[ + [ + dict(type='Resize', scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type='RandomFlip', prob=0., direction='horizontal'), + dict(type='RandomFlip', prob=1., direction='horizontal') + ], [dict(type='LoadAnnotations')], [dict(type='PackSegInputs')] + ]) +] +train_dataloader = dict( + batch_size=2, + num_workers=4, + persistent_workers=True, + sampler=dict(type='InfiniteSampler', shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='training/images', seg_map_path='training/labels'), + pipeline=train_pipeline)) +val_dataloader = dict( + batch_size=1, + num_workers=2, + persistent_workers=True, + sampler=dict(type='DefaultSampler', shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='validation/images', + seg_map_path='validation/labels'), + pipeline=test_pipeline)) +test_dataloader = val_dataloader + +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) +test_evaluator = val_evaluator diff --git a/configs/_base_/datasets/ucsd_half_4x4-512x512.py b/configs/_base_/datasets/ucsd_half_4x4-512x512.py new file mode 100644 index 0000000000..c1000b005d --- /dev/null +++ b/configs/_base_/datasets/ucsd_half_4x4-512x512.py @@ -0,0 +1,68 @@ +# dataset settings +dataset_type = 'MapillaryDataset_v1' +data_root = '/lich-central-vol/dataset/ucsd_half' +crop_size = (512, 512) +train_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='LoadAnnotations'), + dict( + type='RandomResize', + scale=(1280, 720), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), + dict(type='RandomFlip', prob=0.5), + dict(type='PhotoMetricDistortion'), + dict(type='PackSegInputs') +] +test_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='Resize', scale=(1280, 720), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type='LoadAnnotations'), + dict(type='PackSegInputs') +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), + dict( + type='TestTimeAug', + transforms=[ + [ + dict(type='Resize', scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type='RandomFlip', prob=0., direction='horizontal'), + dict(type='RandomFlip', prob=1., direction='horizontal') + ], [dict(type='LoadAnnotations')], [dict(type='PackSegInputs')] + ]) +] +train_dataloader = dict( + batch_size=1, + num_workers=4, + persistent_workers=True, + sampler=dict(type='InfiniteSampler', shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='training/images', seg_map_path='training/labels'), + pipeline=train_pipeline)) +val_dataloader = dict( + batch_size=1, + num_workers=4, + persistent_workers=True, + sampler=dict(type='DefaultSampler', shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='validation/images', + seg_map_path='validation/labels'), + pipeline=test_pipeline)) +test_dataloader = val_dataloader + +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) +test_evaluator = val_evaluator diff --git a/configs/_base_/models/fast_scnn.py b/configs/_base_/models/fast_scnn.py index 11127b0115..f4c7d012ec 100644 --- a/configs/_base_/models/fast_scnn.py +++ b/configs/_base_/models/fast_scnn.py @@ -2,8 +2,12 @@ norm_cfg = dict(type='SyncBN', requires_grad=True, momentum=0.01) data_preprocessor = dict( type='SegDataPreProcessor', - mean=[123.675, 116.28, 103.53], - std=[58.395, 57.12, 57.375], + # mean=[123.675, 116.28, 103.53], + # std=[58.395, 57.12, 57.375], + # mean=[97.85609871, 96.75819166, 101.97295342], # ucsd_half + # std=[83.26665057, 80.24579992, 79.9720934], + mean=[100.37816636, 103.69571653, 104.02350565], # campus data + std=[74.34289061, 76.53997023, 83.26519555], bgr_to_rgb=True, pad_val=0, seg_pad_val=255) @@ -28,7 +32,7 @@ in_channels=128, channels=128, concat_input=False, - num_classes=19, + num_classes=66, in_index=-1, norm_cfg=norm_cfg, align_corners=False, @@ -40,7 +44,7 @@ in_channels=128, channels=32, num_convs=1, - num_classes=19, + num_classes=66, in_index=-2, norm_cfg=norm_cfg, concat_input=False, @@ -52,7 +56,7 @@ in_channels=64, channels=32, num_convs=1, - num_classes=19, + num_classes=66, in_index=-3, norm_cfg=norm_cfg, concat_input=False, diff --git a/configs/_base_/models/icnet_r50-d8.py b/configs/_base_/models/icnet_r50-d8.py index 4377053bda..e10a1bfca1 100644 --- a/configs/_base_/models/icnet_r50-d8.py +++ b/configs/_base_/models/icnet_r50-d8.py @@ -2,8 +2,10 @@ norm_cfg = dict(type='SyncBN', requires_grad=True) data_preprocessor = dict( type='SegDataPreProcessor', - mean=[123.675, 116.28, 103.53], - std=[58.395, 57.12, 57.375], + # mean=[123.675, 116.28, 103.53], + # std=[58.395, 57.12, 57.375], + mean=[97.85609871, 96.75819166, 101.97295342], + std=[83.26665057, 80.24579992, 79.9720934], bgr_to_rgb=True, pad_val=0, seg_pad_val=255) @@ -45,7 +47,7 @@ num_convs=1, in_index=2, dropout_ratio=0, - num_classes=19, + num_classes=66, norm_cfg=norm_cfg, concat_input=False, align_corners=False, @@ -57,7 +59,7 @@ in_channels=128, channels=128, num_convs=1, - num_classes=19, + num_classes=66, in_index=0, norm_cfg=norm_cfg, concat_input=False, @@ -69,7 +71,7 @@ in_channels=128, channels=128, num_convs=1, - num_classes=19, + num_classes=66, in_index=1, norm_cfg=norm_cfg, concat_input=False, diff --git a/configs/_base_/models/lraspp_m-v3-d8.py b/configs/_base_/models/lraspp_m-v3-d8.py index acf70e7107..cd2fbb681d 100644 --- a/configs/_base_/models/lraspp_m-v3-d8.py +++ b/configs/_base_/models/lraspp_m-v3-d8.py @@ -2,8 +2,10 @@ norm_cfg = dict(type='SyncBN', eps=0.001, requires_grad=True) data_preprocessor = dict( type='SegDataPreProcessor', - mean=[123.675, 116.28, 103.53], - std=[58.395, 57.12, 57.375], + # mean=[123.675, 116.28, 103.53], + # std=[58.395, 57.12, 57.375], + mean=[97.85609871, 96.75819166, 101.97295342], + std=[83.26665057, 80.24579992, 79.9720934], bgr_to_rgb=True, pad_val=0, seg_pad_val=255) @@ -22,7 +24,7 @@ channels=128, input_transform='multiple_select', dropout_ratio=0.1, - num_classes=19, + num_classes=66, norm_cfg=norm_cfg, act_cfg=dict(type='ReLU'), align_corners=False, diff --git a/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-256x512.py b/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-256x512.py new file mode 100644 index 0000000000..a578311509 --- /dev/null +++ b/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-256x512.py @@ -0,0 +1,15 @@ +_base_ = [ + '../_base_/models/fast_scnn.py', '../_base_/datasets/ucsd_half-256x512.py', + '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' +] +crop_size = (256, 512) +data_preprocessor = dict(size=crop_size) +model = dict(data_preprocessor=data_preprocessor) +# Re-config the data sampler. +train_dataloader = dict(batch_size=4, num_workers=4) +val_dataloader = dict(batch_size=1, num_workers=4) +test_dataloader = val_dataloader + +# Re-config the optimizer. +optimizer = dict(type='SGD', lr=0.12, momentum=0.9, weight_decay=4e-5) +optim_wrapper = dict(type='OptimWrapper', optimizer=optimizer) diff --git a/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-360x640.py b/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-360x640.py new file mode 100644 index 0000000000..b80a41f911 --- /dev/null +++ b/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-360x640.py @@ -0,0 +1,15 @@ +_base_ = [ + '../_base_/models/fast_scnn.py', '../_base_/datasets/ucsd_half-360x640.py', + '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' +] +crop_size = (360, 640) +data_preprocessor = dict(size=crop_size) +model = dict(data_preprocessor=data_preprocessor) +# Re-config the data sampler. +train_dataloader = dict(batch_size=4, num_workers=4) +val_dataloader = dict(batch_size=1, num_workers=4) +test_dataloader = val_dataloader + +# Re-config the optimizer. +optimizer = dict(type='SGD', lr=0.12, momentum=0.9, weight_decay=4e-5) +optim_wrapper = dict(type='OptimWrapper', optimizer=optimizer) diff --git a/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-540x960.py b/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-540x960.py new file mode 100644 index 0000000000..32229f69c4 --- /dev/null +++ b/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-540x960.py @@ -0,0 +1,15 @@ +_base_ = [ + '../_base_/models/fast_scnn.py', '../_base_/datasets/ucsd_half-540x960.py', + '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' +] +crop_size = (540, 960) +data_preprocessor = dict(size=crop_size) +model = dict(data_preprocessor=data_preprocessor) +# Re-config the data sampler. +train_dataloader = dict(batch_size=4, num_workers=4) +val_dataloader = dict(batch_size=1, num_workers=4) +test_dataloader = val_dataloader + +# Re-config the optimizer. +optimizer = dict(type='SGD', lr=0.12, momentum=0.9, weight_decay=4e-5) +optim_wrapper = dict(type='OptimWrapper', optimizer=optimizer) diff --git a/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-720x1280.py b/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-720x1280.py new file mode 100644 index 0000000000..361a8738d7 --- /dev/null +++ b/configs/fastscnn/fast_scnn_8xb4-160k_ucsd-720x1280.py @@ -0,0 +1,15 @@ +_base_ = [ + '../_base_/models/fast_scnn.py', '../_base_/datasets/ucsd_half.py', + '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' +] +crop_size = (720, 1280) +data_preprocessor = dict(size=crop_size) +model = dict(data_preprocessor=data_preprocessor) +# Re-config the data sampler. +train_dataloader = dict(batch_size=4, num_workers=4) +val_dataloader = dict(batch_size=1, num_workers=4) +test_dataloader = val_dataloader + +# Re-config the optimizer. +optimizer = dict(type='SGD', lr=0.12, momentum=0.9, weight_decay=4e-5) +optim_wrapper = dict(type='OptimWrapper', optimizer=optimizer) diff --git a/configs/icnet/icnet_r18-d8-in1k-pre_4xb2-160k_cityscapes-832x832_.py b/configs/icnet/icnet_r18-d8-in1k-pre_4xb2-160k_cityscapes-832x832_.py new file mode 100644 index 0000000000..d2bf268604 --- /dev/null +++ b/configs/icnet/icnet_r18-d8-in1k-pre_4xb2-160k_cityscapes-832x832_.py @@ -0,0 +1,8 @@ +_base_ = './icnet_r50-d8_4xb2-160k_cityscapes-832x832_.py' +model = dict( + backbone=dict( + layer_channels=(128, 512), + backbone_cfg=dict( + depth=18, + init_cfg=dict( + type='Pretrained', checkpoint='open-mmlab://resnet18_v1c')))) diff --git a/configs/icnet/icnet_r50-d8_4xb2-160k_cityscapes-832x832.py b/configs/icnet/icnet_r50-d8_4xb2-160k_cityscapes-832x832.py index 1b7b1884f7..c0282d1ced 100644 --- a/configs/icnet/icnet_r50-d8_4xb2-160k_cityscapes-832x832.py +++ b/configs/icnet/icnet_r50-d8_4xb2-160k_cityscapes-832x832.py @@ -1,8 +1,8 @@ _base_ = [ '../_base_/models/icnet_r50-d8.py', - '../_base_/datasets/cityscapes_832x832.py', '../_base_/default_runtime.py', + '../_base_/datasets/ucsd_half.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' ] -crop_size = (832, 832) +crop_size = (720, 1280) data_preprocessor = dict(size=crop_size) model = dict(data_preprocessor=data_preprocessor) diff --git a/configs/icnet/icnet_r50-d8_4xb2-160k_cityscapes-832x832_.py b/configs/icnet/icnet_r50-d8_4xb2-160k_cityscapes-832x832_.py new file mode 100644 index 0000000000..c0282d1ced --- /dev/null +++ b/configs/icnet/icnet_r50-d8_4xb2-160k_cityscapes-832x832_.py @@ -0,0 +1,8 @@ +_base_ = [ + '../_base_/models/icnet_r50-d8.py', + '../_base_/datasets/ucsd_half.py', '../_base_/default_runtime.py', + '../_base_/schedules/schedule_160k.py' +] +crop_size = (720, 1280) +data_preprocessor = dict(size=crop_size) +model = dict(data_preprocessor=data_preprocessor) diff --git a/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-256x512.py b/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-256x512.py new file mode 100644 index 0000000000..bb9eed6c2d --- /dev/null +++ b/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-256x512.py @@ -0,0 +1,22 @@ +_base_ = './mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-256x512.py' +norm_cfg = dict(type='SyncBN', eps=0.001, requires_grad=True) +model = dict( + type='EncoderDecoder', + backbone=dict( + type='MobileNetV3', + arch='small', + out_indices=(0, 1, 12), + norm_cfg=norm_cfg), + decode_head=dict( + type='LRASPPHead', + in_channels=(16, 16, 576), + in_index=(0, 1, 2), + channels=128, + input_transform='multiple_select', + dropout_ratio=0.1, + num_classes=19, + norm_cfg=norm_cfg, + act_cfg=dict(type='ReLU'), + align_corners=False, + loss_decode=dict( + type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0))) diff --git a/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-360x640.py b/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-360x640.py new file mode 100644 index 0000000000..4d4910611a --- /dev/null +++ b/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-360x640.py @@ -0,0 +1,22 @@ +_base_ = './mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-360x640.py' +norm_cfg = dict(type='SyncBN', eps=0.001, requires_grad=True) +model = dict( + type='EncoderDecoder', + backbone=dict( + type='MobileNetV3', + arch='small', + out_indices=(0, 1, 12), + norm_cfg=norm_cfg), + decode_head=dict( + type='LRASPPHead', + in_channels=(16, 16, 576), + in_index=(0, 1, 2), + channels=128, + input_transform='multiple_select', + dropout_ratio=0.1, + num_classes=19, + norm_cfg=norm_cfg, + act_cfg=dict(type='ReLU'), + align_corners=False, + loss_decode=dict( + type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0))) diff --git a/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-720x1280.py b/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-720x1280.py new file mode 100644 index 0000000000..8b5702a562 --- /dev/null +++ b/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-720x1280.py @@ -0,0 +1,22 @@ +_base_ = './mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-720x1280.py' +norm_cfg = dict(type='SyncBN', eps=0.001, requires_grad=True) +model = dict( + type='EncoderDecoder', + backbone=dict( + type='MobileNetV3', + arch='small', + out_indices=(0, 1, 12), + norm_cfg=norm_cfg), + decode_head=dict( + type='LRASPPHead', + in_channels=(16, 16, 576), + in_index=(0, 1, 2), + channels=128, + input_transform='multiple_select', + dropout_ratio=0.1, + num_classes=19, + norm_cfg=norm_cfg, + act_cfg=dict(type='ReLU'), + align_corners=False, + loss_decode=dict( + type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0))) diff --git a/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-720x720.py b/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-720x720.py new file mode 100644 index 0000000000..7d463a741b --- /dev/null +++ b/configs/mobilenet_v3/mobilenet-v3-d8-scratch-s_lraspp_4xb4-320k_ucsd-720x720.py @@ -0,0 +1,22 @@ +_base_ = './mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-720x720.py' +norm_cfg = dict(type='SyncBN', eps=0.001, requires_grad=True) +model = dict( + type='EncoderDecoder', + backbone=dict( + type='MobileNetV3', + arch='small', + out_indices=(0, 1, 12), + norm_cfg=norm_cfg), + decode_head=dict( + type='LRASPPHead', + in_channels=(16, 16, 576), + in_index=(0, 1, 2), + channels=128, + input_transform='multiple_select', + dropout_ratio=0.1, + num_classes=19, + norm_cfg=norm_cfg, + act_cfg=dict(type='ReLU'), + align_corners=False, + loss_decode=dict( + type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0))) diff --git a/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-256x512.py b/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-256x512.py new file mode 100644 index 0000000000..f18833defe --- /dev/null +++ b/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-256x512.py @@ -0,0 +1,13 @@ +_base_ = [ + '../_base_/models/lraspp_m-v3-d8.py', '../_base_/datasets/ucsd_half-256x512.py', + '../_base_/default_runtime.py', '../_base_/schedules/schedule_320k.py' +] +crop_size = (256, 512) +data_preprocessor = dict(size=crop_size) +# Re-config the data sampler. +model = dict(data_preprocessor=data_preprocessor) +train_dataloader = dict(batch_size=4, num_workers=4) +val_dataloader = dict(batch_size=1, num_workers=4) +test_dataloader = val_dataloader + +runner = dict(type='IterBasedRunner', max_iters=320000) diff --git a/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-360x640.py b/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-360x640.py new file mode 100644 index 0000000000..dab87c23eb --- /dev/null +++ b/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-360x640.py @@ -0,0 +1,13 @@ +_base_ = [ + '../_base_/models/lraspp_m-v3-d8.py', '../_base_/datasets/ucsd_half-360x640.py', + '../_base_/default_runtime.py', '../_base_/schedules/schedule_320k.py' +] +crop_size = (360, 640) +data_preprocessor = dict(size=crop_size) +# Re-config the data sampler. +model = dict(data_preprocessor=data_preprocessor) +train_dataloader = dict(batch_size=4, num_workers=4) +val_dataloader = dict(batch_size=1, num_workers=4) +test_dataloader = val_dataloader + +runner = dict(type='IterBasedRunner', max_iters=320000) diff --git a/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-720x1280.py b/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-720x1280.py new file mode 100644 index 0000000000..bf6952f3fb --- /dev/null +++ b/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-720x1280.py @@ -0,0 +1,13 @@ +_base_ = [ + '../_base_/models/lraspp_m-v3-d8.py', '../_base_/datasets/ucsd_half_4x4-512x1024.py', + '../_base_/default_runtime.py', '../_base_/schedules/schedule_320k.py' +] +crop_size = (512, 1024) +data_preprocessor = dict(size=crop_size) +# Re-config the data sampler. +model = dict(data_preprocessor=data_preprocessor) +train_dataloader = dict(batch_size=4, num_workers=4) +val_dataloader = dict(batch_size=1, num_workers=4) +test_dataloader = val_dataloader + +runner = dict(type='IterBasedRunner', max_iters=320000) diff --git a/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-720x720.py b/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-720x720.py new file mode 100644 index 0000000000..20b06ae7ea --- /dev/null +++ b/configs/mobilenet_v3/mobilenet-v3-d8-scratch_lraspp_4xb4-320k_ucsd-720x720.py @@ -0,0 +1,13 @@ +_base_ = [ + '../_base_/models/lraspp_m-v3-d8.py', '../_base_/datasets/ucsd_half_4x4-512x512.py', + '../_base_/default_runtime.py', '../_base_/schedules/schedule_320k.py' +] +crop_size = (512, 512) +data_preprocessor = dict(size=crop_size) +# Re-config the data sampler. +model = dict(data_preprocessor=data_preprocessor) +train_dataloader = dict(batch_size=2, num_workers=4) +val_dataloader = dict(batch_size=1, num_workers=4) +test_dataloader = val_dataloader + +runner = dict(type='IterBasedRunner', max_iters=320000) diff --git a/mmseg/datasets/mapillary.py b/mmseg/datasets/mapillary.py index 6c2947338e..3ec90c62cd 100644 --- a/mmseg/datasets/mapillary.py +++ b/mmseg/datasets/mapillary.py @@ -58,7 +58,7 @@ class MapillaryDataset_v1(BaseSegDataset): 10], [0, 0, 0]]) def __init__(self, - img_suffix='.jpg', + img_suffix='.png', seg_map_suffix='.png', **kwargs) -> None: super().__init__( @@ -169,7 +169,7 @@ class MapillaryDataset_v2(BaseSegDataset): [111, 111, 0], [0, 0, 0]]) def __init__(self, - img_suffix='.jpg', + img_suffix='.png', seg_map_suffix='.png', **kwargs) -> None: super().__init__(