|
1 |
| -_base_ = './pascal_voc12.py' |
2 | 1 | # dataset settings
|
| 2 | +dataset_type = 'PascalVOCDataset' |
| 3 | +data_root = 'data/VOCdevkit/VOC2012' |
| 4 | +crop_size = (512, 512) |
| 5 | +train_pipeline = [ |
| 6 | + dict(type='LoadImageFromFile'), |
| 7 | + dict(type='LoadAnnotations'), |
| 8 | + dict(type='RandomResize', scale=(2048, 512), ratio_range=(0.5, 2.0)), |
| 9 | + dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), |
| 10 | + dict(type='RandomFlip', prob=0.5), |
| 11 | + dict(type='PhotoMetricDistortion'), |
| 12 | + dict(type='Pad', size=crop_size), |
| 13 | + dict(type='PackSegInputs') |
| 14 | +] |
| 15 | + |
| 16 | +test_pipeline = [ |
| 17 | + dict(type='LoadImageFromFile'), |
| 18 | + dict(type='Resize', scale=(2048, 512), keep_ratio=True), |
| 19 | + # add loading annotation after ``Resize`` because ground truth |
| 20 | + # does not need to do resize data transform |
| 21 | + dict(type='LoadAnnotations'), |
| 22 | + dict(type='PackSegInputs') |
| 23 | +] |
| 24 | + |
| 25 | +dataset_train = dict( |
| 26 | + type=dataset_type, |
| 27 | + data_root=data_root, |
| 28 | + data_prefix=dict(img_path='JPEGImages', seg_map_path='SegmentationClass'), |
| 29 | + ann_file='ImageSets/Segmentation/train.txt', |
| 30 | + pipeline=train_pipeline) |
| 31 | + |
| 32 | +dataset_aug = dict( |
| 33 | + type=dataset_type, |
| 34 | + data_root=data_root, |
| 35 | + data_prefix=dict( |
| 36 | + img_path='JPEGImages', seg_map_path='SegmentationClassAug'), |
| 37 | + ann_file='ImageSets/Segmentation/aug.txt', |
| 38 | + pipeline=train_pipeline) |
| 39 | + |
3 | 40 | train_dataloader = dict(
|
| 41 | + batch_size=4, |
| 42 | + num_workers=4, |
| 43 | + persistent_workers=True, |
| 44 | + sampler=dict(type='InfiniteSampler', shuffle=True), |
| 45 | + dataset=dict(type='ConcatDataset', datasets=[dataset_train, dataset_aug])) |
| 46 | + |
| 47 | +val_dataloader = dict( |
| 48 | + batch_size=1, |
| 49 | + num_workers=4, |
| 50 | + persistent_workers=True, |
| 51 | + sampler=dict(type='DefaultSampler', shuffle=False), |
4 | 52 | dataset=dict(
|
5 |
| - ann_dir=['SegmentationClass', 'SegmentationClassAug'], |
6 |
| - ann_file=[ |
7 |
| - 'ImageSets/Segmentation/train.txt', |
8 |
| - 'ImageSets/Segmentation/aug.txt' |
9 |
| - ])) |
| 53 | + type=dataset_type, |
| 54 | + data_root=data_root, |
| 55 | + data_prefix=dict( |
| 56 | + img_path='JPEGImages', seg_map_path='SegmentationClass'), |
| 57 | + ann_file='ImageSets/Segmentation/val.txt', |
| 58 | + pipeline=test_pipeline)) |
| 59 | +test_dataloader = val_dataloader |
| 60 | + |
| 61 | +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) |
| 62 | +test_evaluator = val_evaluator |
0 commit comments