diff --git a/README.md b/README.md index ee5f069..f69c438 100644 --- a/README.md +++ b/README.md @@ -130,41 +130,45 @@ python tools/test.py {config.py} {checkpoint.pth} --eval mIoU -### Pascal Context 59 +### Pascal Context 59 480*480 80k | Methods | FLOPs(G) | Parameters(M) | mIoU(%) | mAcc(%) | Config | ckpt | | ------------------ | -------- | ------------- | ------- | ------- | ------ | ---------- | -| T: PSPNet-R101 | 256\.89 | 68\.07 | 52\.47 | 63\.15 ||| -| S:PSPnet-R18 | 54\.53 | 12\.82 | 43\.79 | 54\.46 ||| -| SKDS | 54\.53 | 12\.82 | 45\.08 | 55\.56 ||| -| IFVD | 54\.53 | 12\.82 | 45\.97 | 56\.6 ||| -| CIRKD | 54\.53 | 12\.82 | 45\.62 | 56\.15 ||| -| CWD | 54\.53 | 12\.82 | 45\.99 | 55\.56 ||| -| **BPKD(Ours)** | 54\.53 | 12\.82 | **46\.82** | **56\.29** ||| +| T: PSPNet-R101 | 256\.89 | 68\.07 | 52\.47 | 63\.15 |[Config](https://github.com/open-mmlab/mmsegmentation/blob/main/configs/pspnet/pspnet_r101-d8_4xb4-80k_pascal-context-59-480x480.py)|[Model](https://download.openmmlab.com/mmsegmentation/v0.5/pspnet/pspnet_r101-d8_480x480_80k_pascal_context_59/pspnet_r101-d8_480x480_80k_pascal_context_59_20210416_114418-fa6caaa2.pth)| +| S:PSPnet-R18 | 54\.53 | 12\.82 | 43\.79 | 54\.46 |[Config](eval/configs/baseline/pspnet/pspnet_r18-d8_480x480_80k_pascal_context_59.py)|| +| SKDS | 54\.53 | 12\.82 | 45\.08 | 55\.56 |[Config](eval/configs/baseline/pspnet/pspnet_r18-d8_480x480_80k_pascal_context_59.py)|| +| IFVD | 54\.53 | 12\.82 | 45\.97 | 56\.6 |[Config](eval/configs/baseline/pspnet/pspnet_r18-d8_480x480_80k_pascal_context_59.py)|| +| CIRKD | 54\.53 | 12\.82 | 45\.62 | 56\.15 |[Config](eval/configs/baseline/pspnet/pspnet_r18-d8_480x480_80k_pascal_context_59.py)|| +| CWD | 54\.53 | 12\.82 | 45\.99 | 55\.56 |[Config](eval/configs/baseline/pspnet/pspnet_r18-d8_480x480_80k_pascal_context_59.py)|| +| **BPKD(Ours)** | 54\.53 | 12\.82 | **46\.82** | **56\.29** |[Config](eval/configs/baseline/pspnet/pspnet_r18-d8_480x480_80k_pascal_context_59.py)|| | | | | | ||| -| T: HRNetV2P-W48 | 95\.64 | 65\.95 | 51\.12 | 61\.39 ||| +| T: HRNetV2P-W48 | 95\.64 | 65\.95 | 51\.12 | 61\.39 |[Config](https://github.com/open-mmlab/mmsegmentation/blob/main/configs/hrnet/fcn_hr48_4xb4-80k_pascal-context-59-480x480.py)|[Model](https://download.openmmlab.com/mmsegmentation/v0.5/hrnet/fcn_hr48_480x480_80k_pascal_context_59/fcn_hr48_480x480_80k_pascal_context_59_20210411_003240-3ae7081e.pth)| | S:HRNetV2P-W18S | 10\.49 | 3\.97 | 40\.62 | 51\.43 ||| -| SKDS | 10\.49 | 3\.97 | 41\.54 | 52\.18 ||| -| IFVD | 10\.49 | 3\.97 | 41\.55 | 52\.24 ||| -| CIRKD | 10\.49 | 3\.97 | 42\.02 | 52\.88 ||| -| CWD | 10\.49 | 3\.97 | 42\.89 | 53\.37 ||| -| **BPKD(Ours)** | 10\.49 | 3\.97 | **43\.96** | **54\.51** ||| +| SKDS | 10\.49 | 3\.97 | 41\.54 | 52\.18 |[Config](eval/configs/baseline/hrnet/fcn_hr18s_480x480_80k_pascal_context_59.py)|| +| IFVD | 10\.49 | 3\.97 | 41\.55 | 52\.24 |[Config](eval/configs/baseline/hrnet/fcn_hr18s_480x480_80k_pascal_context_59.py)|| +| CIRKD | 10\.49 | 3\.97 | 42\.02 | 52\.88 |[Config](eval/configs/baseline/hrnet/fcn_hr18s_480x480_80k_pascal_context_59.py)|| +| CWD | 10\.49 | 3\.97 | 42\.89 | 53\.37 |[Config](eval/configs/baseline/hrnet/fcn_hr18s_480x480_80k_pascal_context_59.py)|| +| **BPKD(Ours)** | 10\.49 | 3\.97 | **43\.96** | **54\.51** |[Config](eval/configs/baseline/hrnet/fcn_hr18s_480x480_80k_pascal_context_59.py)|| | | | | | ||| -| T:DeeplabV3P-R101 | 255\.67 | 62\.68 | 53\.20 | 64\.04 ||| -| S:DeeplabV3P+MV2 | 69\.60 | 15\.35 | 41\.01 | 52\.92 ||| -| SKDS | 69\.60 | 15\.35 | 42\.07 | 55\.06 ||| -| IFVD | 69\.60 | 15\.35 | 41\.73 | 54\.34 ||| -| CIRKD | 69\.60 | 15\.35 | 42\.25 | 55\.12 ||| -| CWD | 69\.60 | 15\.35 | 43\.74 | 56\.37 ||| -| **BPKD(Ours)** | 69\.60 | 15\.35 | **46\.23** | **58\.12** ||| +| T:DeeplabV3P-R101 | 255\.67 | 62\.68 | 53\.20 | 64\.04 |[Config](https://github.com/open-mmlab/mmsegmentation/blob/main/configs/deeplabv3plus/deeplabv3plus_r101-d8_4xb4-80k_pascal-context-59-480x480.py)|[Model](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_480x480_80k_pascal_context_59/deeplabv3plus_r101-d8_480x480_80k_pascal_context_59_20210416_111127-7ca0331d.pth)| +| S:DeeplabV3P+MV2 | 69\.60 | 15\.35 | 41\.01 | 52\.92 |[Config](eval/configs/baseline/deeplabv3plus/deeplabv3plus_m-v2-d8_480x480_80k_pascal_context_59.py)|| +| SKDS | 69\.60 | 15\.35 | 42\.07 | 55\.06 |[Config](eval/configs/baseline/deeplabv3plus/deeplabv3plus_m-v2-d8_480x480_80k_pascal_context_59.py)|| +| IFVD | 69\.60 | 15\.35 | 41\.73 | 54\.34 |[Config](eval/configs/baseline/deeplabv3plus/deeplabv3plus_m-v2-d8_480x480_80k_pascal_context_59.py)|| +| CIRKD | 69\.60 | 15\.35 | 42\.25 | 55\.12 |[Config](eval/configs/baseline/deeplabv3plus/deeplabv3plus_m-v2-d8_480x480_80k_pascal_context_59.py)|| +| CWD | 69\.60 | 15\.35 | 43\.74 | 56\.37 |[Config](eval/configs/baseline/deeplabv3plus/deeplabv3plus_m-v2-d8_480x480_80k_pascal_context_59.py)|| +| **BPKD(Ours)** | 69\.60 | 15\.35 | **46\.23** | **58\.12** |[Config](eval/configs/baseline/deeplabv3plus/deeplabv3plus_m-v2-d8_480x480_80k_pascal_context_59.py)|| | | | | | ||| -| T:ISANet-R101 | 228\.21 | 56\.80 | 53\.41 | 64\.04 ||| -| S: ISANet-R18 | 54\.33 | 12\.46 | 44\.05 | 54\.67 ||| -| SKDS | 54\.33 | 12\.46 | 45\.69 | 56\.27 ||| -| IFVD | 54\.33 | 12\.46 | 46\.75 | 56\.4 ||| -| CIRKD | 54\.33 | 12\.46 | 45\.83 | 56\.11 ||| -| CWD | 54\.33 | 12\.46 | 46\.76 | 56\.48 ||| -| **BPKD(Ours)** | 54\.33 | 12\.46 | **47\.25** | **56\.81** ||| +| T:ISANet-R101 | 228\.21 | 56\.80 | 53\.41 | 64\.04 |[Config](eval/configs/baseline/isanet/isanet_r101-d8_512x512_80k_context.py)|| +| S: ISANet-R18 | 54\.33 | 12\.46 | 44\.05 | 54\.67 |[Config](eval/configs/baseline/isanet/isanet_r18-d8_480x480_80k_context.py)|| +| SKDS | 54\.33 | 12\.46 | 45\.69 | 56\.27 |[Config](eval/configs/baseline/isanet/isanet_r18-d8_480x480_80k_context.py)|| +| IFVD | 54\.33 | 12\.46 | 46\.75 | 56\.4 |[Config](eval/configs/baseline/isanet/isanet_r18-d8_480x480_80k_context.py)|| +| CIRKD | 54\.33 | 12\.46 | 45\.83 | 56\.11 |[Config](eval/configs/baseline/isanet/isanet_r18-d8_480x480_80k_context.py)|| +| CWD | 54\.33 | 12\.46 | 46\.76 | 56\.48 |[Config](eval/configs/baseline/isanet/isanet_r18-d8_480x480_80k_context.py)|| +| **BPKD(Ours)** | 54\.33 | 12\.46 | **47\.25** | **56\.81** |[Config](eval/configs/baseline/isanet/isanet_r18-d8_480x480_80k_context.py)|| + + + + ## License diff --git a/eval/configs/_base_/datasets/mmseg/pascal_context_59_512x512.py b/eval/configs/_base_/datasets/mmseg/pascal_context_59_512x512.py deleted file mode 100644 index d9a8b24..0000000 --- a/eval/configs/_base_/datasets/mmseg/pascal_context_59_512x512.py +++ /dev/null @@ -1,60 +0,0 @@ -# dataset settings -dataset_type = 'PascalContextDataset59' -data_root = 'data/VOCdevkit/VOC2010/' -img_norm_cfg = dict( - mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) - -img_scale = (520, 520) -crop_size = (512, 512) - -train_pipeline = [ - dict(type='LoadImageFromFile'), - dict(type='LoadAnnotations', reduce_zero_label=True), - dict(type='Resize', img_scale=img_scale, ratio_range=(0.5, 2.0)), - dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), - dict(type='RandomFlip', prob=0.5), - dict(type='PhotoMetricDistortion'), - dict(type='Normalize', **img_norm_cfg), - dict(type='Pad', size=crop_size, pad_val=0, seg_pad_val=255), - dict(type='DefaultFormatBundle'), - dict(type='Collect', keys=['img', 'gt_semantic_seg']), -] -test_pipeline = [ - dict(type='LoadImageFromFile'), - dict( - type='MultiScaleFlipAug', - img_scale=img_scale, - # img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75], - flip=False, - transforms=[ - dict(type='Resize', keep_ratio=True), - dict(type='RandomFlip'), - dict(type='Normalize', **img_norm_cfg), - dict(type='ImageToTensor', keys=['img']), - dict(type='Collect', keys=['img']), - ]) -] -data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type=dataset_type, - data_root=data_root, - img_dir='JPEGImages', - ann_dir='SegmentationClassContext', - split='ImageSets/SegmentationContext/train.txt', - pipeline=train_pipeline), - val=dict( - type=dataset_type, - data_root=data_root, - img_dir='JPEGImages', - ann_dir='SegmentationClassContext', - split='ImageSets/SegmentationContext/val.txt', - pipeline=test_pipeline), - test=dict( - type=dataset_type, - data_root=data_root, - img_dir='JPEGImages', - ann_dir='SegmentationClassContext', - split='ImageSets/SegmentationContext/val.txt', - pipeline=test_pipeline)) diff --git a/eval/configs/baseline/deeplabv3plus/deeplabv3plus_m-v2-d8_480x480_80k_pascal_context_59.py b/eval/configs/baseline/deeplabv3plus/deeplabv3plus_m-v2-d8_480x480_80k_pascal_context_59.py new file mode 100644 index 0000000..84e7b53 --- /dev/null +++ b/eval/configs/baseline/deeplabv3plus/deeplabv3plus_m-v2-d8_480x480_80k_pascal_context_59.py @@ -0,0 +1,22 @@ +_base_ = [ + '../../_base_/models/deeplabv3plus_r50-d8.py', + '../../_base_/datasets/mmseg/pascal_context_59.py', + '../../_base_/mmseg_runtime.py', + '../../_base_/schedules/mmseg/schedule_80k.py', +] + +model = dict( + pretrained='mmcls://mobilenet_v2', + backbone=dict( + _delete_=True, + type='MobileNetV2', + widen_factor=1., + strides=(1, 2, 2, 1, 1, 1, 1), + dilations=(1, 1, 1, 2, 2, 4, 4), + out_indices=(1, 2, 4, 6)), + decode_head=dict(in_channels=320, c1_in_channels=24,num_classes=59, channels=512), + auxiliary_head=dict(in_channels=96, num_classes=59,channels=256) +) + +optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=1e-4) +optimizer_config = dict() \ No newline at end of file diff --git a/eval/configs/baseline/hrnet/fcn_hr18s_480x480_80k_pascal_context_59.py b/eval/configs/baseline/hrnet/fcn_hr18s_480x480_80k_pascal_context_59.py new file mode 100644 index 0000000..abbaf08 --- /dev/null +++ b/eval/configs/baseline/hrnet/fcn_hr18s_480x480_80k_pascal_context_59.py @@ -0,0 +1,21 @@ +_base_ = [ + '../../_base_/models/fcn_hr18.py', + '../../_base_/datasets/mmseg/pascal_context_59.py', + '../../_base_/mmseg_runtime.py', + '../../_base_/schedules/mmseg/schedule_80k.py', +] + +model = dict( + pretrained='open-mmlab://msra/hrnetv2_w18_small', + decode_head=dict(num_classes=59), + backbone=dict( + extra=dict( + stage1=dict(num_blocks=(2,)), + stage2=dict(num_blocks=(2, 2)), + stage3=dict(num_modules=3, num_blocks=(2, 2, 2)), + stage4=dict(num_modules=2, num_blocks=(2, 2, 2, 2)))), + test_cfg=dict(mode='slide', crop_size=(512, 512), stride=(320, 320)) +) + +optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=1e-4) +optimizer_config = dict() diff --git a/eval/configs/baseline/isanet/isanet_r101-d8_512x512_80k_context.py b/eval/configs/baseline/isanet/isanet_r101-d8_512x512_80k_context.py new file mode 100644 index 0000000..8cd4e77 --- /dev/null +++ b/eval/configs/baseline/isanet/isanet_r101-d8_512x512_80k_context.py @@ -0,0 +1,19 @@ +_base_ = [ + '../../_base_/models/isanet_r50-d8.py', + '../../_base_/datasets/mmseg/pascal_context_59_512x512.py', + '../../_base_/mmseg_runtime.py', + '../../_base_/schedules/mmseg/schedule_80k.py', +] + +model = dict( + pretrained='open-mmlab://resnet101_v1c', + backbone=dict(depth=101), + decode_head=dict( + num_classes=59, + ), + auxiliary_head=dict( + num_classes=59, + ) +) + +optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=0.0001) \ No newline at end of file diff --git a/eval/configs/baseline/isanet/isanet_r18-d8_480x480_80k_context.py b/eval/configs/baseline/isanet/isanet_r18-d8_480x480_80k_context.py new file mode 100644 index 0000000..7c52f7e --- /dev/null +++ b/eval/configs/baseline/isanet/isanet_r18-d8_480x480_80k_context.py @@ -0,0 +1,14 @@ +_base_ = [ + '../../_base_/models/isanet_r50-d8.py', + '../../_base_/datasets/mmseg/pascal_context_59.py', + '../../_base_/mmseg_runtime.py', + '../../_base_/schedules/mmseg/schedule_40k.py', +] + +model = dict( + pretrained='open-mmlab://resnet18_v1c', + backbone=dict(depth=18), + decode_head=dict(in_channels=512, isa_channels=256, channels=128, num_classes=59), + auxiliary_head=dict(in_channels=256, channels=64, num_classes=59)) + +optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=0.0001) diff --git a/eval/configs/baseline/pspnet/pspnet_r18-d8_480x480_80k_pascal_context_59.py b/eval/configs/baseline/pspnet/pspnet_r18-d8_480x480_80k_pascal_context_59.py new file mode 100644 index 0000000..a725ba7 --- /dev/null +++ b/eval/configs/baseline/pspnet/pspnet_r18-d8_480x480_80k_pascal_context_59.py @@ -0,0 +1,19 @@ +_base_ = [ + '../../_base_/models/pspnet_r50-d8.py', + '../../_base_/datasets/mmseg/pascal_context_59.py', + '../../_base_/mmseg_runtime.py', + '../../_base_/schedules/mmseg/schedule_80k.py', +] +model = dict( + pretrained='open-mmlab://resnet18_v1c', + backbone=dict(depth=18), + decode_head=dict( + num_classes=59, + in_channels=512, + channels=128, + ), + auxiliary_head=dict(num_classes=59,in_channels=256, channels=64), + # change the test time crop size here + test_cfg=dict(mode='slide', crop_size=(480, 480), stride=(320, 320))) + +optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=0.0001) diff --git a/eval/process.bash b/eval/process.bash index 6abf59b..0093600 100644 --- a/eval/process.bash +++ b/eval/process.bash @@ -14,9 +14,9 @@ DIR=$(pwd) cd checkpoints aria2c -x8 $checkpoint_url -o $checkpoint_name cd $DIR -python tools/model_converters.py checkpoints/$checkpoint_name --out-path checkpoints/ade_student -PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512 python tools/test.py $config_name checkpoints/ade_student/$checkpoint_name_student --eval mIoU +python tools/model_converters.py checkpoints/$checkpoint_name --out-path checkpoints/pascal_student +PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512 python tools/test.py $config_name checkpoints/pascal_student/$checkpoint_name_student --eval mIoU echo $checkpoint_name -ls checkpoints/ade_student/ +ls checkpoints/pascal_student/