commit
039fe3f67b
161
.circleci/config.yml
Normal file
161
.circleci/config.yml
Normal file
@ -0,0 +1,161 @@
|
||||
version: 2.1
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
docker:
|
||||
- image: cimg/python:3.7.4
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install dependencies
|
||||
command: |
|
||||
sudo apt-add-repository ppa:brightbox/ruby-ng -y
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ruby2.7
|
||||
- run:
|
||||
name: Install pre-commit hook
|
||||
command: |
|
||||
pip install pre-commit
|
||||
pre-commit install
|
||||
- run:
|
||||
name: Linting
|
||||
command: pre-commit run --all-files
|
||||
- run:
|
||||
name: Check docstring coverage
|
||||
command: |
|
||||
pip install interrogate
|
||||
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 50 mmseg
|
||||
|
||||
build_cpu:
|
||||
parameters:
|
||||
# The python version must match available image tags in
|
||||
# https://circleci.com/developer/images/image/cimg/python
|
||||
python:
|
||||
type: string
|
||||
default: "3.7.4"
|
||||
torch:
|
||||
type: string
|
||||
torchvision:
|
||||
type: string
|
||||
docker:
|
||||
- image: cimg/python:<< parameters.python >>
|
||||
resource_class: large
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install Libraries
|
||||
command: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx libjpeg-dev zlib1g-dev libtinfo-dev libncurses5
|
||||
- run:
|
||||
name: Configure Python & pip
|
||||
command: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install wheel
|
||||
- run:
|
||||
name: Install PyTorch
|
||||
command: |
|
||||
python -V
|
||||
python -m pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
||||
- run:
|
||||
name: Install mmseg dependencies
|
||||
command: |
|
||||
python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch<< parameters.torch >>/index.html
|
||||
python -m pip install mmdet
|
||||
python -m pip install -r requirements.txt
|
||||
- run:
|
||||
name: Build and install
|
||||
command: |
|
||||
python -m pip install -e .
|
||||
- run:
|
||||
name: Run unittests
|
||||
command: |
|
||||
python -m pip install timm
|
||||
python -m coverage run --branch --source mmseg -m pytest tests/
|
||||
python -m coverage xml
|
||||
python -m coverage report -m
|
||||
|
||||
build_cu101:
|
||||
machine:
|
||||
image: ubuntu-1604-cuda-10.1:201909-23
|
||||
resource_class: gpu.nvidia.small
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install Libraries
|
||||
command: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx
|
||||
- run:
|
||||
name: Configure Python & pip
|
||||
command: |
|
||||
pyenv global 3.7.0
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install wheel
|
||||
- run:
|
||||
name: Install PyTorch
|
||||
command: |
|
||||
python -V
|
||||
python -m pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
|
||||
- run:
|
||||
name: Install mmseg dependencies
|
||||
# python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch${{matrix.torch_version}}/index.html
|
||||
command: |
|
||||
python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html
|
||||
python -m pip install mmdet
|
||||
python -m pip install -r requirements.txt
|
||||
- run:
|
||||
name: Build and install
|
||||
command: |
|
||||
python setup.py check -m -s
|
||||
TORCH_CUDA_ARCH_LIST=7.0 python -m pip install -e .
|
||||
- run:
|
||||
name: Run unittests
|
||||
command: |
|
||||
python -m pip install timm
|
||||
python -m pytest tests/
|
||||
|
||||
workflows:
|
||||
unit_tests:
|
||||
jobs:
|
||||
- lint
|
||||
- build_cpu:
|
||||
name: build_cpu_th1.6
|
||||
torch: 1.6.0
|
||||
torchvision: 0.7.0
|
||||
requires:
|
||||
- lint
|
||||
- build_cpu:
|
||||
name: build_cpu_th1.7
|
||||
torch: 1.7.0
|
||||
torchvision: 0.8.1
|
||||
requires:
|
||||
- lint
|
||||
- build_cpu:
|
||||
name: build_cpu_th1.8_py3.9
|
||||
torch: 1.8.0
|
||||
torchvision: 0.9.0
|
||||
python: "3.9.0"
|
||||
requires:
|
||||
- lint
|
||||
- build_cpu:
|
||||
name: build_cpu_th1.9_py3.8
|
||||
torch: 1.9.0
|
||||
torchvision: 0.10.0
|
||||
python: "3.8.0"
|
||||
requires:
|
||||
- lint
|
||||
- build_cpu:
|
||||
name: build_cpu_th1.9_py3.9
|
||||
torch: 1.9.0
|
||||
torchvision: 0.10.0
|
||||
python: "3.9.0"
|
||||
requires:
|
||||
- lint
|
||||
- build_cu101:
|
||||
requires:
|
||||
- build_cpu_th1.6
|
||||
- build_cpu_th1.7
|
||||
- build_cpu_th1.8_py3.9
|
||||
- build_cpu_th1.9_py3.8
|
||||
- build_cpu_th1.9_py3.9
|
||||
133
.dev/batch_test_list.py
Normal file
133
.dev/batch_test_list.py
Normal file
@ -0,0 +1,133 @@
|
||||
# yapf: disable
|
||||
# Inference Speed is tested on NVIDIA V100
|
||||
hrnet = [
|
||||
dict(
|
||||
config='configs/hrnet/fcn_hr18s_512x512_160k_ade20k.py',
|
||||
checkpoint='fcn_hr18s_512x512_160k_ade20k_20200614_214413-870f65ac.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=33.0),
|
||||
),
|
||||
dict(
|
||||
config='configs/hrnet/fcn_hr18s_512x1024_160k_cityscapes.py',
|
||||
checkpoint='fcn_hr18s_512x1024_160k_cityscapes_20200602_190901-4a0797ea.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=76.31),
|
||||
),
|
||||
dict(
|
||||
config='configs/hrnet/fcn_hr48_512x512_160k_ade20k.py',
|
||||
checkpoint='fcn_hr48_512x512_160k_ade20k_20200614_214407-a52fc02c.pth',
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=42.02),
|
||||
),
|
||||
dict(
|
||||
config='configs/hrnet/fcn_hr48_512x1024_160k_cityscapes.py',
|
||||
checkpoint='fcn_hr48_512x1024_160k_cityscapes_20200602_190946-59b7973e.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=80.65),
|
||||
),
|
||||
]
|
||||
pspnet = [
|
||||
dict(
|
||||
config='configs/pspnet/pspnet_r50-d8_512x1024_80k_cityscapes.py',
|
||||
checkpoint='pspnet_r50-d8_512x1024_80k_cityscapes_20200606_112131-2376f12b.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=78.55),
|
||||
),
|
||||
dict(
|
||||
config='configs/pspnet/pspnet_r101-d8_512x1024_80k_cityscapes.py',
|
||||
checkpoint='pspnet_r101-d8_512x1024_80k_cityscapes_20200606_112211-e1e1100f.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=79.76),
|
||||
),
|
||||
dict(
|
||||
config='configs/pspnet/pspnet_r101-d8_512x512_160k_ade20k.py',
|
||||
checkpoint='pspnet_r101-d8_512x512_160k_ade20k_20200615_100650-967c316f.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=44.39),
|
||||
),
|
||||
dict(
|
||||
config='configs/pspnet/pspnet_r50-d8_512x512_160k_ade20k.py',
|
||||
checkpoint='pspnet_r50-d8_512x512_160k_ade20k_20200615_184358-1890b0bd.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=42.48),
|
||||
),
|
||||
]
|
||||
resnest = [
|
||||
dict(
|
||||
config='configs/resnest/pspnet_s101-d8_512x512_160k_ade20k.py',
|
||||
checkpoint='pspnet_s101-d8_512x512_160k_ade20k_20200807_145416-a6daa92a.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=45.44),
|
||||
),
|
||||
dict(
|
||||
config='configs/resnest/pspnet_s101-d8_512x1024_80k_cityscapes.py',
|
||||
checkpoint='pspnet_s101-d8_512x1024_80k_cityscapes_20200807_140631-c75f3b99.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=78.57),
|
||||
),
|
||||
]
|
||||
fastscnn = [
|
||||
dict(
|
||||
config='configs/fastscnn/fast_scnn_lr0.12_8x4_160k_cityscapes.py',
|
||||
checkpoint='fast_scnn_8x4_160k_lr0.12_cityscapes-0cec9937.pth',
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=70.96),
|
||||
)
|
||||
]
|
||||
deeplabv3plus = [
|
||||
dict(
|
||||
config='configs/deeplabv3plus/deeplabv3plus_r101-d8_769x769_80k_cityscapes.py', # noqa
|
||||
checkpoint='deeplabv3plus_r101-d8_769x769_80k_cityscapes_20200607_000405-a7573d20.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=80.98),
|
||||
),
|
||||
dict(
|
||||
config='configs/deeplabv3plus/deeplabv3plus_r101-d8_512x1024_80k_cityscapes.py', # noqa
|
||||
checkpoint='deeplabv3plus_r101-d8_512x1024_80k_cityscapes_20200606_114143-068fcfe9.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=80.97),
|
||||
),
|
||||
dict(
|
||||
config='configs/deeplabv3plus/deeplabv3plus_r50-d8_512x1024_80k_cityscapes.py', # noqa
|
||||
checkpoint='deeplabv3plus_r50-d8_512x1024_80k_cityscapes_20200606_114049-f9fb496d.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=80.09),
|
||||
),
|
||||
dict(
|
||||
config='configs/deeplabv3plus/deeplabv3plus_r50-d8_769x769_80k_cityscapes.py', # noqa
|
||||
checkpoint='deeplabv3plus_r50-d8_769x769_80k_cityscapes_20200606_210233-0e9dfdc4.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=79.83),
|
||||
),
|
||||
]
|
||||
vit = [
|
||||
dict(
|
||||
config='configs/vit/upernet_vit-b16_ln_mln_512x512_160k_ade20k.py',
|
||||
checkpoint='upernet_vit-b16_ln_mln_512x512_160k_ade20k-f444c077.pth',
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=47.73),
|
||||
),
|
||||
dict(
|
||||
config='configs/vit/upernet_deit-s16_ln_mln_512x512_160k_ade20k.py',
|
||||
checkpoint='upernet_deit-s16_ln_mln_512x512_160k_ade20k-c0cd652f.pth',
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=43.52),
|
||||
),
|
||||
]
|
||||
fp16 = [
|
||||
dict(
|
||||
config='configs/deeplabv3plus/deeplabv3plus_r101-d8_fp16_512x1024_80k_cityscapes.py', # noqa
|
||||
checkpoint='deeplabv3plus_r101-d8_fp16_512x1024_80k_cityscapes_20200717_230920-f1104f4b.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=80.46),
|
||||
)
|
||||
]
|
||||
swin = [
|
||||
dict(
|
||||
config='configs/swin/upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K.py', # noqa
|
||||
checkpoint='upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K_20210531_112542-e380ad3e.pth', # noqa
|
||||
eval='mIoU',
|
||||
metric=dict(mIoU=44.41),
|
||||
)
|
||||
]
|
||||
# yapf: enable
|
||||
19
.dev/batch_train_list.txt
Normal file
19
.dev/batch_train_list.txt
Normal file
@ -0,0 +1,19 @@
|
||||
configs/hrnet/fcn_hr18s_512x512_160k_ade20k.py
|
||||
configs/hrnet/fcn_hr18s_512x1024_160k_cityscapes.py
|
||||
configs/hrnet/fcn_hr48_512x512_160k_ade20k.py
|
||||
configs/hrnet/fcn_hr48_512x1024_160k_cityscapes.py
|
||||
configs/pspnet/pspnet_r50-d8_512x1024_80k_cityscapes.py
|
||||
configs/pspnet/pspnet_r101-d8_512x1024_80k_cityscapes.py
|
||||
configs/pspnet/pspnet_r101-d8_512x512_160k_ade20k.py
|
||||
configs/pspnet/pspnet_r50-d8_512x512_160k_ade20k.py
|
||||
configs/resnest/pspnet_s101-d8_512x512_160k_ade20k.py
|
||||
configs/resnest/pspnet_s101-d8_512x1024_80k_cityscapes.py
|
||||
configs/fastscnn/fast_scnn_lr0.12_8x4_160k_cityscapes.py
|
||||
configs/deeplabv3plus/deeplabv3plus_r101-d8_769x769_80k_cityscapes.py
|
||||
configs/deeplabv3plus/deeplabv3plus_r101-d8_512x1024_80k_cityscapes.py
|
||||
configs/deeplabv3plus/deeplabv3plus_r50-d8_512x1024_80k_cityscapes.py
|
||||
configs/deeplabv3plus/deeplabv3plus_r50-d8_769x769_80k_cityscapes.py
|
||||
configs/vit/upernet_vit-b16_ln_mln_512x512_160k_ade20k.py
|
||||
configs/vit/upernet_deit-s16_ln_mln_512x512_160k_ade20k.py
|
||||
configs/deeplabv3plus/deeplabv3plus_r101-d8_fp16_512x1024_80k_cityscapes.py
|
||||
configs/swin/upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K.py
|
||||
41
.dev/benchmark_evaluation.sh
Executable file
41
.dev/benchmark_evaluation.sh
Executable file
@ -0,0 +1,41 @@
|
||||
PARTITION=$1
|
||||
CHECKPOINT_DIR=$2
|
||||
|
||||
echo 'configs/hrnet/fcn_hr18s_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION fcn_hr18s_512x512_160k_ade20k configs/hrnet/fcn_hr18s_512x512_160k_ade20k.py $CHECKPOINT_DIR/fcn_hr18s_512x512_160k_ade20k_20200614_214413-870f65ac.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/fcn_hr18s_512x512_160k_ade20k --cfg-options dist_params.port=28171 &
|
||||
echo 'configs/hrnet/fcn_hr18s_512x1024_160k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION fcn_hr18s_512x1024_160k_cityscapes configs/hrnet/fcn_hr18s_512x1024_160k_cityscapes.py $CHECKPOINT_DIR/fcn_hr18s_512x1024_160k_cityscapes_20200602_190901-4a0797ea.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/fcn_hr18s_512x1024_160k_cityscapes --cfg-options dist_params.port=28172 &
|
||||
echo 'configs/hrnet/fcn_hr48_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION fcn_hr48_512x512_160k_ade20k configs/hrnet/fcn_hr48_512x512_160k_ade20k.py $CHECKPOINT_DIR/fcn_hr48_512x512_160k_ade20k_20200614_214407-a52fc02c.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/fcn_hr48_512x512_160k_ade20k --cfg-options dist_params.port=28173 &
|
||||
echo 'configs/hrnet/fcn_hr48_512x1024_160k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION fcn_hr48_512x1024_160k_cityscapes configs/hrnet/fcn_hr48_512x1024_160k_cityscapes.py $CHECKPOINT_DIR/fcn_hr48_512x1024_160k_cityscapes_20200602_190946-59b7973e.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/fcn_hr48_512x1024_160k_cityscapes --cfg-options dist_params.port=28174 &
|
||||
echo 'configs/pspnet/pspnet_r50-d8_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION pspnet_r50-d8_512x1024_80k_cityscapes configs/pspnet/pspnet_r50-d8_512x1024_80k_cityscapes.py $CHECKPOINT_DIR/pspnet_r50-d8_512x1024_80k_cityscapes_20200606_112131-2376f12b.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/pspnet_r50-d8_512x1024_80k_cityscapes --cfg-options dist_params.port=28175 &
|
||||
echo 'configs/pspnet/pspnet_r101-d8_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION pspnet_r101-d8_512x1024_80k_cityscapes configs/pspnet/pspnet_r101-d8_512x1024_80k_cityscapes.py $CHECKPOINT_DIR/pspnet_r101-d8_512x1024_80k_cityscapes_20200606_112211-e1e1100f.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/pspnet_r101-d8_512x1024_80k_cityscapes --cfg-options dist_params.port=28176 &
|
||||
echo 'configs/pspnet/pspnet_r101-d8_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION pspnet_r101-d8_512x512_160k_ade20k configs/pspnet/pspnet_r101-d8_512x512_160k_ade20k.py $CHECKPOINT_DIR/pspnet_r101-d8_512x512_160k_ade20k_20200615_100650-967c316f.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/pspnet_r101-d8_512x512_160k_ade20k --cfg-options dist_params.port=28177 &
|
||||
echo 'configs/pspnet/pspnet_r50-d8_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION pspnet_r50-d8_512x512_160k_ade20k configs/pspnet/pspnet_r50-d8_512x512_160k_ade20k.py $CHECKPOINT_DIR/pspnet_r50-d8_512x512_160k_ade20k_20200615_184358-1890b0bd.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/pspnet_r50-d8_512x512_160k_ade20k --cfg-options dist_params.port=28178 &
|
||||
echo 'configs/resnest/pspnet_s101-d8_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION pspnet_s101-d8_512x512_160k_ade20k configs/resnest/pspnet_s101-d8_512x512_160k_ade20k.py $CHECKPOINT_DIR/pspnet_s101-d8_512x512_160k_ade20k_20200807_145416-a6daa92a.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/pspnet_s101-d8_512x512_160k_ade20k --cfg-options dist_params.port=28179 &
|
||||
echo 'configs/resnest/pspnet_s101-d8_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION pspnet_s101-d8_512x1024_80k_cityscapes configs/resnest/pspnet_s101-d8_512x1024_80k_cityscapes.py $CHECKPOINT_DIR/pspnet_s101-d8_512x1024_80k_cityscapes_20200807_140631-c75f3b99.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/pspnet_s101-d8_512x1024_80k_cityscapes --cfg-options dist_params.port=28180 &
|
||||
echo 'configs/fastscnn/fast_scnn_lr0.12_8x4_160k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION fast_scnn_lr0.12_8x4_160k_cityscapes configs/fastscnn/fast_scnn_lr0.12_8x4_160k_cityscapes.py $CHECKPOINT_DIR/fast_scnn_8x4_160k_lr0.12_cityscapes-0cec9937.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/fast_scnn_lr0.12_8x4_160k_cityscapes --cfg-options dist_params.port=28181 &
|
||||
echo 'configs/deeplabv3plus/deeplabv3plus_r101-d8_769x769_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION deeplabv3plus_r101-d8_769x769_80k_cityscapes configs/deeplabv3plus/deeplabv3plus_r101-d8_769x769_80k_cityscapes.py $CHECKPOINT_DIR/deeplabv3plus_r101-d8_769x769_80k_cityscapes_20200607_000405-a7573d20.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/deeplabv3plus_r101-d8_769x769_80k_cityscapes --cfg-options dist_params.port=28182 &
|
||||
echo 'configs/deeplabv3plus/deeplabv3plus_r101-d8_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION deeplabv3plus_r101-d8_512x1024_80k_cityscapes configs/deeplabv3plus/deeplabv3plus_r101-d8_512x1024_80k_cityscapes.py $CHECKPOINT_DIR/deeplabv3plus_r101-d8_512x1024_80k_cityscapes_20200606_114143-068fcfe9.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/deeplabv3plus_r101-d8_512x1024_80k_cityscapes --cfg-options dist_params.port=28183 &
|
||||
echo 'configs/deeplabv3plus/deeplabv3plus_r50-d8_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION deeplabv3plus_r50-d8_512x1024_80k_cityscapes configs/deeplabv3plus/deeplabv3plus_r50-d8_512x1024_80k_cityscapes.py $CHECKPOINT_DIR/deeplabv3plus_r50-d8_512x1024_80k_cityscapes_20200606_114049-f9fb496d.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/deeplabv3plus_r50-d8_512x1024_80k_cityscapes --cfg-options dist_params.port=28184 &
|
||||
echo 'configs/deeplabv3plus/deeplabv3plus_r50-d8_769x769_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION deeplabv3plus_r50-d8_769x769_80k_cityscapes configs/deeplabv3plus/deeplabv3plus_r50-d8_769x769_80k_cityscapes.py $CHECKPOINT_DIR/deeplabv3plus_r50-d8_769x769_80k_cityscapes_20200606_210233-0e9dfdc4.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/deeplabv3plus_r50-d8_769x769_80k_cityscapes --cfg-options dist_params.port=28185 &
|
||||
echo 'configs/vit/upernet_vit-b16_ln_mln_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION upernet_vit-b16_ln_mln_512x512_160k_ade20k configs/vit/upernet_vit-b16_ln_mln_512x512_160k_ade20k.py $CHECKPOINT_DIR/upernet_vit-b16_ln_mln_512x512_160k_ade20k-f444c077.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/upernet_vit-b16_ln_mln_512x512_160k_ade20k --cfg-options dist_params.port=28186 &
|
||||
echo 'configs/vit/upernet_deit-s16_ln_mln_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION upernet_deit-s16_ln_mln_512x512_160k_ade20k configs/vit/upernet_deit-s16_ln_mln_512x512_160k_ade20k.py $CHECKPOINT_DIR/upernet_deit-s16_ln_mln_512x512_160k_ade20k-c0cd652f.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/upernet_deit-s16_ln_mln_512x512_160k_ade20k --cfg-options dist_params.port=28187 &
|
||||
echo 'configs/deeplabv3plus/deeplabv3plus_r101-d8_fp16_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION deeplabv3plus_r101-d8_fp16_512x1024_80k_cityscapes configs/deeplabv3plus/deeplabv3plus_r101-d8_fp16_512x1024_80k_cityscapes.py $CHECKPOINT_DIR/deeplabv3plus_r101-d8_512x1024_80k_fp16_cityscapes-cc58bc8d.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/deeplabv3plus_r101-d8_512x1024_80k_fp16_cityscapes --cfg-options dist_params.port=28188 &
|
||||
echo 'configs/swin/upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 tools/slurm_test.sh $PARTITION upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K configs/swin/upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K.py $CHECKPOINT_DIR/upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K_20210531_112542-e380ad3e.pth --eval mIoU --work-dir work_dirs/benchmark_evaluation/upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K --cfg-options dist_params.port=28189 &
|
||||
149
.dev/benchmark_inference.py
Normal file
149
.dev/benchmark_inference.py
Normal file
@ -0,0 +1,149 @@
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
import hashlib
|
||||
import logging
|
||||
import os
|
||||
import os.path as osp
|
||||
import warnings
|
||||
from argparse import ArgumentParser
|
||||
|
||||
import requests
|
||||
from mmcv import Config
|
||||
|
||||
from mmseg.apis import inference_segmentor, init_segmentor, show_result_pyplot
|
||||
from mmseg.utils import get_root_logger
|
||||
|
||||
# ignore warnings when segmentors inference
|
||||
warnings.filterwarnings('ignore')
|
||||
|
||||
|
||||
def download_checkpoint(checkpoint_name, model_name, config_name, collect_dir):
|
||||
"""Download checkpoint and check if hash code is true."""
|
||||
url = f'https://download.openmmlab.com/mmsegmentation/v0.5/{model_name}/{config_name}/{checkpoint_name}' # noqa
|
||||
|
||||
r = requests.get(url)
|
||||
assert r.status_code != 403, f'{url} Access denied.'
|
||||
|
||||
with open(osp.join(collect_dir, checkpoint_name), 'wb') as code:
|
||||
code.write(r.content)
|
||||
|
||||
true_hash_code = osp.splitext(checkpoint_name)[0].split('-')[1]
|
||||
|
||||
# check hash code
|
||||
with open(osp.join(collect_dir, checkpoint_name), 'rb') as fp:
|
||||
sha256_cal = hashlib.sha256()
|
||||
sha256_cal.update(fp.read())
|
||||
cur_hash_code = sha256_cal.hexdigest()[:8]
|
||||
|
||||
assert true_hash_code == cur_hash_code, f'{url} download failed, '
|
||||
'incomplete downloaded file or url invalid.'
|
||||
|
||||
if cur_hash_code != true_hash_code:
|
||||
os.remove(osp.join(collect_dir, checkpoint_name))
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('config', help='test config file path')
|
||||
parser.add_argument('checkpoint_root', help='Checkpoint file root path')
|
||||
parser.add_argument(
|
||||
'-i', '--img', default='demo/demo.png', help='Image file')
|
||||
parser.add_argument('-a', '--aug', action='store_true', help='aug test')
|
||||
parser.add_argument('-m', '--model-name', help='model name to inference')
|
||||
parser.add_argument(
|
||||
'-s', '--show', action='store_true', help='show results')
|
||||
parser.add_argument(
|
||||
'-d', '--device', default='cuda:0', help='Device used for inference')
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
def inference_model(config_name, checkpoint, args, logger=None):
|
||||
cfg = Config.fromfile(config_name)
|
||||
if args.aug:
|
||||
if 'flip' in cfg.data.test.pipeline[
|
||||
1] and 'img_scale' in cfg.data.test.pipeline[1]:
|
||||
cfg.data.test.pipeline[1].img_ratios = [
|
||||
0.5, 0.75, 1.0, 1.25, 1.5, 1.75
|
||||
]
|
||||
cfg.data.test.pipeline[1].flip = True
|
||||
else:
|
||||
if logger is not None:
|
||||
logger.error(f'{config_name}: unable to start aug test')
|
||||
else:
|
||||
print(f'{config_name}: unable to start aug test', flush=True)
|
||||
|
||||
model = init_segmentor(cfg, checkpoint, device=args.device)
|
||||
# test a single image
|
||||
result = inference_segmentor(model, args.img)
|
||||
|
||||
# show the results
|
||||
if args.show:
|
||||
show_result_pyplot(model, args.img, result)
|
||||
return result
|
||||
|
||||
|
||||
# Sample test whether the inference code is correct
|
||||
def main(args):
|
||||
config = Config.fromfile(args.config)
|
||||
|
||||
if not os.path.exists(args.checkpoint_root):
|
||||
os.makedirs(args.checkpoint_root, 0o775)
|
||||
|
||||
# test single model
|
||||
if args.model_name:
|
||||
if args.model_name in config:
|
||||
model_infos = config[args.model_name]
|
||||
if not isinstance(model_infos, list):
|
||||
model_infos = [model_infos]
|
||||
for model_info in model_infos:
|
||||
config_name = model_info['config'].strip()
|
||||
print(f'processing: {config_name}', flush=True)
|
||||
checkpoint = osp.join(args.checkpoint_root,
|
||||
model_info['checkpoint'].strip())
|
||||
try:
|
||||
# build the model from a config file and a checkpoint file
|
||||
inference_model(config_name, checkpoint, args)
|
||||
except Exception:
|
||||
print(f'{config_name} test failed!')
|
||||
continue
|
||||
return
|
||||
else:
|
||||
raise RuntimeError('model name input error.')
|
||||
|
||||
# test all model
|
||||
logger = get_root_logger(
|
||||
log_file='benchmark_inference_image.log', log_level=logging.ERROR)
|
||||
|
||||
for model_name in config:
|
||||
model_infos = config[model_name]
|
||||
|
||||
if not isinstance(model_infos, list):
|
||||
model_infos = [model_infos]
|
||||
for model_info in model_infos:
|
||||
print('processing: ', model_info['config'], flush=True)
|
||||
config_path = model_info['config'].strip()
|
||||
config_name = osp.splitext(osp.basename(config_path))[0]
|
||||
checkpoint_name = model_info['checkpoint'].strip()
|
||||
checkpoint = osp.join(args.checkpoint_root, checkpoint_name)
|
||||
|
||||
# ensure checkpoint exists
|
||||
try:
|
||||
if not osp.exists(checkpoint):
|
||||
download_checkpoint(checkpoint_name, model_name,
|
||||
config_name.rstrip('.py'),
|
||||
args.checkpoint_root)
|
||||
except Exception:
|
||||
logger.error(f'{checkpoint_name} download error')
|
||||
continue
|
||||
|
||||
# test model inference with checkpoint
|
||||
try:
|
||||
# build the model from a config file and a checkpoint file
|
||||
inference_model(config_path, checkpoint, args, logger)
|
||||
except Exception as e:
|
||||
logger.error(f'{config_path} " : {repr(e)}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = parse_args()
|
||||
main(args)
|
||||
40
.dev/benchmark_train.sh
Executable file
40
.dev/benchmark_train.sh
Executable file
@ -0,0 +1,40 @@
|
||||
PARTITION=$1
|
||||
|
||||
echo 'configs/hrnet/fcn_hr18s_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION fcn_hr18s_512x512_160k_ade20k configs/hrnet/fcn_hr18s_512x512_160k_ade20k.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24727 --work-dir work_dirs/hrnet/fcn_hr18s_512x512_160k_ade20k >/dev/null &
|
||||
echo 'configs/hrnet/fcn_hr18s_512x1024_160k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION fcn_hr18s_512x1024_160k_cityscapes configs/hrnet/fcn_hr18s_512x1024_160k_cityscapes.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24728 --work-dir work_dirs/hrnet/fcn_hr18s_512x1024_160k_cityscapes >/dev/null &
|
||||
echo 'configs/hrnet/fcn_hr48_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION fcn_hr48_512x512_160k_ade20k configs/hrnet/fcn_hr48_512x512_160k_ade20k.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24729 --work-dir work_dirs/hrnet/fcn_hr48_512x512_160k_ade20k >/dev/null &
|
||||
echo 'configs/hrnet/fcn_hr48_512x1024_160k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION fcn_hr48_512x1024_160k_cityscapes configs/hrnet/fcn_hr48_512x1024_160k_cityscapes.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24730 --work-dir work_dirs/hrnet/fcn_hr48_512x1024_160k_cityscapes >/dev/null &
|
||||
echo 'configs/pspnet/pspnet_r50-d8_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION pspnet_r50-d8_512x1024_80k_cityscapes configs/pspnet/pspnet_r50-d8_512x1024_80k_cityscapes.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24731 --work-dir work_dirs/pspnet/pspnet_r50-d8_512x1024_80k_cityscapes >/dev/null &
|
||||
echo 'configs/pspnet/pspnet_r101-d8_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION pspnet_r101-d8_512x1024_80k_cityscapes configs/pspnet/pspnet_r101-d8_512x1024_80k_cityscapes.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24732 --work-dir work_dirs/pspnet/pspnet_r101-d8_512x1024_80k_cityscapes >/dev/null &
|
||||
echo 'configs/pspnet/pspnet_r101-d8_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION pspnet_r101-d8_512x512_160k_ade20k configs/pspnet/pspnet_r101-d8_512x512_160k_ade20k.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24733 --work-dir work_dirs/pspnet/pspnet_r101-d8_512x512_160k_ade20k >/dev/null &
|
||||
echo 'configs/pspnet/pspnet_r50-d8_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION pspnet_r50-d8_512x512_160k_ade20k configs/pspnet/pspnet_r50-d8_512x512_160k_ade20k.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24734 --work-dir work_dirs/pspnet/pspnet_r50-d8_512x512_160k_ade20k >/dev/null &
|
||||
echo 'configs/resnest/pspnet_s101-d8_512x512_160k_ade20k.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION pspnet_s101-d8_512x512_160k_ade20k configs/resnest/pspnet_s101-d8_512x512_160k_ade20k.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24735 --work-dir work_dirs/resnest/pspnet_s101-d8_512x512_160k_ade20k >/dev/null &
|
||||
echo 'configs/resnest/pspnet_s101-d8_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION pspnet_s101-d8_512x1024_80k_cityscapes configs/resnest/pspnet_s101-d8_512x1024_80k_cityscapes.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24736 --work-dir work_dirs/resnest/pspnet_s101-d8_512x1024_80k_cityscapes >/dev/null &
|
||||
echo 'configs/fastscnn/fast_scnn_lr0.12_8x4_160k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION fast_scnn_lr0.12_8x4_160k_cityscapes configs/fastscnn/fast_scnn_lr0.12_8x4_160k_cityscapes.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24737 --work-dir work_dirs/fastscnn/fast_scnn_lr0.12_8x4_160k_cityscapes >/dev/null &
|
||||
echo 'configs/deeplabv3plus/deeplabv3plus_r101-d8_769x769_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION deeplabv3plus_r101-d8_769x769_80k_cityscapes configs/deeplabv3plus/deeplabv3plus_r101-d8_769x769_80k_cityscapes.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24738 --work-dir work_dirs/deeplabv3plus/deeplabv3plus_r101-d8_769x769_80k_cityscapes >/dev/null &
|
||||
echo 'configs/deeplabv3plus/deeplabv3plus_r101-d8_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION deeplabv3plus_r101-d8_512x1024_80k_cityscapes configs/deeplabv3plus/deeplabv3plus_r101-d8_512x1024_80k_cityscapes.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24739 --work-dir work_dirs/deeplabv3plus/deeplabv3plus_r101-d8_512x1024_80k_cityscapes >/dev/null &
|
||||
echo 'configs/deeplabv3plus/deeplabv3plus_r50-d8_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION deeplabv3plus_r50-d8_512x1024_80k_cityscapes configs/deeplabv3plus/deeplabv3plus_r50-d8_512x1024_80k_cityscapes.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24740 --work-dir work_dirs/deeplabv3plus/deeplabv3plus_r50-d8_512x1024_80k_cityscapes >/dev/null &
|
||||
echo 'configs/deeplabv3plus/deeplabv3plus_r50-d8_769x769_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION deeplabv3plus_r50-d8_769x769_80k_cityscapes configs/deeplabv3plus/deeplabv3plus_r50-d8_769x769_80k_cityscapes.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24741 --work-dir work_dirs/deeplabv3plus/deeplabv3plus_r50-d8_769x769_80k_cityscapes >/dev/null &
|
||||
echo 'configs/vit/upernet_vit-b16_ln_mln_512x512_160k_ade20k.py' &
|
||||
GPUS=8 GPUS_PER_NODE=8 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION upernet_vit-b16_ln_mln_512x512_160k_ade20k configs/vit/upernet_vit-b16_ln_mln_512x512_160k_ade20k.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24742 --work-dir work_dirs/vit/upernet_vit-b16_ln_mln_512x512_160k_ade20k >/dev/null &
|
||||
echo 'configs/vit/upernet_deit-s16_ln_mln_512x512_160k_ade20k.py' &
|
||||
GPUS=8 GPUS_PER_NODE=8 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION upernet_deit-s16_ln_mln_512x512_160k_ade20k configs/vit/upernet_deit-s16_ln_mln_512x512_160k_ade20k.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24743 --work-dir work_dirs/vit/upernet_deit-s16_ln_mln_512x512_160k_ade20k >/dev/null &
|
||||
echo 'configs/deeplabv3plus/deeplabv3plus_r101-d8_fp16_512x1024_80k_cityscapes.py' &
|
||||
GPUS=4 GPUS_PER_NODE=4 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION deeplabv3plus_r101-d8_512x1024_80k_fp16_cityscapes configs/deeplabv3plus/deeplabv3plus_r101-d8_fp16_512x1024_80k_cityscapes.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24744 --work-dir work_dirs/deeplabv3plus/deeplabv3plus_r101-d8_512x1024_80k_fp16_cityscapes >/dev/null &
|
||||
echo 'configs/swin/upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K.py' &
|
||||
GPUS=8 GPUS_PER_NODE=8 CPUS_PER_TASK=2 ./tools/slurm_train.sh $PARTITION upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K configs/swin/upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K.py --cfg-options checkpoint_config.max_keep_ckpts=1 dist_params.port=24745 --work-dir work_dirs/swin/upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K >/dev/null &
|
||||
101
.dev/check_urls.py
Normal file
101
.dev/check_urls.py
Normal file
@ -0,0 +1,101 @@
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
import logging
|
||||
import os
|
||||
from argparse import ArgumentParser
|
||||
|
||||
import requests
|
||||
import yaml as yml
|
||||
|
||||
from mmseg.utils import get_root_logger
|
||||
|
||||
|
||||
def check_url(url):
|
||||
"""Check url response status.
|
||||
|
||||
Args:
|
||||
url (str): url needed to check.
|
||||
|
||||
Returns:
|
||||
int, bool: status code and check flag.
|
||||
"""
|
||||
flag = True
|
||||
r = requests.head(url)
|
||||
status_code = r.status_code
|
||||
if status_code == 403 or status_code == 404:
|
||||
flag = False
|
||||
|
||||
return status_code, flag
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = ArgumentParser('url valid check.')
|
||||
parser.add_argument(
|
||||
'-m',
|
||||
'--model-name',
|
||||
type=str,
|
||||
help='Select the model needed to check')
|
||||
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
model_name = args.model_name
|
||||
|
||||
# yml path generate.
|
||||
# If model_name is not set, script will check all of the models.
|
||||
if model_name is not None:
|
||||
yml_list = [(model_name, f'configs/{model_name}/{model_name}.yml')]
|
||||
else:
|
||||
# check all
|
||||
yml_list = [(x, f'configs/{x}/{x}.yml') for x in os.listdir('configs/')
|
||||
if x != '_base_']
|
||||
|
||||
logger = get_root_logger(log_file='url_check.log', log_level=logging.ERROR)
|
||||
|
||||
for model_name, yml_path in yml_list:
|
||||
# Default yaml loader unsafe.
|
||||
model_infos = yml.load(
|
||||
open(yml_path, 'r'), Loader=yml.CLoader)['Models']
|
||||
for model_info in model_infos:
|
||||
config_name = model_info['Name']
|
||||
checkpoint_url = model_info['Weights']
|
||||
# checkpoint url check
|
||||
status_code, flag = check_url(checkpoint_url)
|
||||
if flag:
|
||||
logger.info(f'checkpoint | {config_name} | {checkpoint_url} | '
|
||||
f'{status_code} valid')
|
||||
else:
|
||||
logger.error(
|
||||
f'checkpoint | {config_name} | {checkpoint_url} | '
|
||||
f'{status_code} | error')
|
||||
# log_json check
|
||||
checkpoint_name = checkpoint_url.split('/')[-1]
|
||||
model_time = '-'.join(checkpoint_name.split('-')[:-1]).replace(
|
||||
f'{config_name}_', '')
|
||||
# two style of log_json name
|
||||
# use '_' to link model_time (will be deprecated)
|
||||
log_json_url_1 = f'https://download.openmmlab.com/mmsegmentation/v0.5/{model_name}/{config_name}/{config_name}_{model_time}.log.json' # noqa
|
||||
status_code_1, flag_1 = check_url(log_json_url_1)
|
||||
# use '-' to link model_time
|
||||
log_json_url_2 = f'https://download.openmmlab.com/mmsegmentation/v0.5/{model_name}/{config_name}/{config_name}-{model_time}.log.json' # noqa
|
||||
status_code_2, flag_2 = check_url(log_json_url_2)
|
||||
if flag_1 or flag_2:
|
||||
if flag_1:
|
||||
logger.info(
|
||||
f'log.json | {config_name} | {log_json_url_1} | '
|
||||
f'{status_code_1} | valid')
|
||||
else:
|
||||
logger.info(
|
||||
f'log.json | {config_name} | {log_json_url_2} | '
|
||||
f'{status_code_2} | valid')
|
||||
else:
|
||||
logger.error(
|
||||
f'log.json | {config_name} | {log_json_url_1} & '
|
||||
f'{log_json_url_2} | {status_code_1} & {status_code_2} | '
|
||||
'error')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
91
.dev/gather_benchmark_evaluation_results.py
Normal file
91
.dev/gather_benchmark_evaluation_results.py
Normal file
@ -0,0 +1,91 @@
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
import argparse
|
||||
import glob
|
||||
import os.path as osp
|
||||
|
||||
import mmcv
|
||||
from mmcv import Config
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Gather benchmarked model evaluation results')
|
||||
parser.add_argument('config', help='test config file path')
|
||||
parser.add_argument(
|
||||
'root',
|
||||
type=str,
|
||||
help='root path of benchmarked models to be gathered')
|
||||
parser.add_argument(
|
||||
'--out',
|
||||
type=str,
|
||||
default='benchmark_evaluation_info.json',
|
||||
help='output path of gathered metrics and compared '
|
||||
'results to be stored')
|
||||
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = parse_args()
|
||||
|
||||
root_path = args.root
|
||||
metrics_out = args.out
|
||||
result_dict = {}
|
||||
|
||||
cfg = Config.fromfile(args.config)
|
||||
|
||||
for model_key in cfg:
|
||||
model_infos = cfg[model_key]
|
||||
if not isinstance(model_infos, list):
|
||||
model_infos = [model_infos]
|
||||
for model_info in model_infos:
|
||||
previous_metrics = model_info['metric']
|
||||
config = model_info['config'].strip()
|
||||
fname, _ = osp.splitext(osp.basename(config))
|
||||
|
||||
# Load benchmark evaluation json
|
||||
metric_json_dir = osp.join(root_path, fname)
|
||||
if not osp.exists(metric_json_dir):
|
||||
print(f'{metric_json_dir} not existed.')
|
||||
continue
|
||||
|
||||
json_list = glob.glob(osp.join(metric_json_dir, '*.json'))
|
||||
if len(json_list) == 0:
|
||||
print(f'There is no eval json in {metric_json_dir}.')
|
||||
continue
|
||||
|
||||
log_json_path = list(sorted(json_list))[-1]
|
||||
metric = mmcv.load(log_json_path)
|
||||
if config not in metric.get('config', {}):
|
||||
print(f'{config} not included in {log_json_path}')
|
||||
continue
|
||||
|
||||
# Compare between new benchmark results and previous metrics
|
||||
differential_results = dict()
|
||||
new_metrics = dict()
|
||||
for record_metric_key in previous_metrics:
|
||||
if record_metric_key not in metric['metric']:
|
||||
raise KeyError('record_metric_key not exist, please '
|
||||
'check your config')
|
||||
old_metric = previous_metrics[record_metric_key]
|
||||
new_metric = round(metric['metric'][record_metric_key] * 100,
|
||||
2)
|
||||
|
||||
differential = new_metric - old_metric
|
||||
flag = '+' if differential > 0 else '-'
|
||||
differential_results[
|
||||
record_metric_key] = f'{flag}{abs(differential):.2f}'
|
||||
new_metrics[record_metric_key] = new_metric
|
||||
|
||||
result_dict[config] = dict(
|
||||
differential=differential_results,
|
||||
previous=previous_metrics,
|
||||
new=new_metrics)
|
||||
|
||||
if metrics_out:
|
||||
mmcv.dump(result_dict, metrics_out, indent=4)
|
||||
print('===================================')
|
||||
for config_name, metrics in result_dict.items():
|
||||
print(config_name, metrics)
|
||||
print('===================================')
|
||||
100
.dev/gather_benchmark_train_results.py
Normal file
100
.dev/gather_benchmark_train_results.py
Normal file
@ -0,0 +1,100 @@
|
||||
import argparse
|
||||
import glob
|
||||
import os.path as osp
|
||||
|
||||
import mmcv
|
||||
from gather_models import get_final_results
|
||||
from mmcv import Config
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Gather benchmarked models train results')
|
||||
parser.add_argument('config', help='test config file path')
|
||||
parser.add_argument(
|
||||
'root',
|
||||
type=str,
|
||||
help='root path of benchmarked models to be gathered')
|
||||
parser.add_argument(
|
||||
'--out',
|
||||
type=str,
|
||||
default='benchmark_train_info.json',
|
||||
help='output path of gathered metrics to be stored')
|
||||
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = parse_args()
|
||||
|
||||
root_path = args.root
|
||||
metrics_out = args.out
|
||||
|
||||
evaluation_cfg = Config.fromfile(args.config)
|
||||
|
||||
result_dict = {}
|
||||
for model_key in evaluation_cfg:
|
||||
model_infos = evaluation_cfg[model_key]
|
||||
if not isinstance(model_infos, list):
|
||||
model_infos = [model_infos]
|
||||
for model_info in model_infos:
|
||||
config = model_info['config']
|
||||
|
||||
# benchmark train dir
|
||||
model_name = osp.split(osp.dirname(config))[1]
|
||||
config_name = osp.splitext(osp.basename(config))[0]
|
||||
exp_dir = osp.join(root_path, model_name, config_name)
|
||||
if not osp.exists(exp_dir):
|
||||
print(f'{config} hasn\'t {exp_dir}')
|
||||
continue
|
||||
|
||||
# parse config
|
||||
cfg = mmcv.Config.fromfile(config)
|
||||
total_iters = cfg.runner.max_iters
|
||||
exp_metric = cfg.evaluation.metric
|
||||
if not isinstance(exp_metric, list):
|
||||
exp_metrics = [exp_metric]
|
||||
|
||||
# determine whether total_iters ckpt exists
|
||||
ckpt_path = f'iter_{total_iters}.pth'
|
||||
if not osp.exists(osp.join(exp_dir, ckpt_path)):
|
||||
print(f'{config} hasn\'t {ckpt_path}')
|
||||
continue
|
||||
|
||||
# only the last log json counts
|
||||
log_json_path = list(
|
||||
sorted(glob.glob(osp.join(exp_dir, '*.log.json'))))[-1]
|
||||
|
||||
# extract metric value
|
||||
model_performance = get_final_results(log_json_path, total_iters)
|
||||
if model_performance is None:
|
||||
print(f'log file error: {log_json_path}')
|
||||
continue
|
||||
|
||||
differential_results = dict()
|
||||
old_results = dict()
|
||||
new_results = dict()
|
||||
for metric_key in model_performance:
|
||||
if metric_key in ['mIoU']:
|
||||
metric = round(model_performance[metric_key] * 100, 2)
|
||||
old_metric = model_info['metric'][metric_key]
|
||||
old_results[metric_key] = old_metric
|
||||
new_results[metric_key] = metric
|
||||
differential = metric - old_metric
|
||||
flag = '+' if differential > 0 else '-'
|
||||
differential_results[
|
||||
metric_key] = f'{flag}{abs(differential):.2f}'
|
||||
result_dict[config] = dict(
|
||||
differential_results=differential_results,
|
||||
old_results=old_results,
|
||||
new_results=new_results,
|
||||
)
|
||||
|
||||
# 4 save or print results
|
||||
if metrics_out:
|
||||
mmcv.dump(result_dict, metrics_out, indent=4)
|
||||
print('===================================')
|
||||
for config_name, metrics in result_dict.items():
|
||||
print(config_name, metrics)
|
||||
print('===================================')
|
||||
211
.dev/gather_models.py
Normal file
211
.dev/gather_models.py
Normal file
@ -0,0 +1,211 @@
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
import argparse
|
||||
import glob
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import os.path as osp
|
||||
import shutil
|
||||
|
||||
import mmcv
|
||||
import torch
|
||||
|
||||
# build schedule look-up table to automatically find the final model
|
||||
RESULTS_LUT = ['mIoU', 'mAcc', 'aAcc']
|
||||
|
||||
|
||||
def calculate_file_sha256(file_path):
|
||||
"""calculate file sha256 hash code."""
|
||||
with open(file_path, 'rb') as fp:
|
||||
sha256_cal = hashlib.sha256()
|
||||
sha256_cal.update(fp.read())
|
||||
return sha256_cal.hexdigest()
|
||||
|
||||
|
||||
def process_checkpoint(in_file, out_file):
|
||||
checkpoint = torch.load(in_file, map_location='cpu')
|
||||
# remove optimizer for smaller file size
|
||||
if 'optimizer' in checkpoint:
|
||||
del checkpoint['optimizer']
|
||||
# if it is necessary to remove some sensitive data in checkpoint['meta'],
|
||||
# add the code here.
|
||||
torch.save(checkpoint, out_file)
|
||||
# The hash code calculation and rename command differ on different system
|
||||
# platform.
|
||||
sha = calculate_file_sha256(out_file)
|
||||
final_file = out_file.rstrip('.pth') + '-{}.pth'.format(sha[:8])
|
||||
os.rename(out_file, final_file)
|
||||
|
||||
# Remove prefix and suffix
|
||||
final_file_name = osp.split(final_file)[1]
|
||||
final_file_name = osp.splitext(final_file_name)[0]
|
||||
|
||||
return final_file_name
|
||||
|
||||
|
||||
def get_final_iter(config):
|
||||
iter_num = config.split('_')[-2]
|
||||
assert iter_num.endswith('k')
|
||||
return int(iter_num[:-1]) * 1000
|
||||
|
||||
|
||||
def get_final_results(log_json_path, iter_num):
|
||||
result_dict = dict()
|
||||
last_iter = 0
|
||||
with open(log_json_path, 'r') as f:
|
||||
for line in f.readlines():
|
||||
log_line = json.loads(line)
|
||||
if 'mode' not in log_line.keys():
|
||||
continue
|
||||
|
||||
# When evaluation, the 'iter' of new log json is the evaluation
|
||||
# steps on single gpu.
|
||||
flag1 = ('aAcc' in log_line) or (log_line['mode'] == 'val')
|
||||
flag2 = (last_iter == iter_num - 50) or (last_iter == iter_num)
|
||||
if flag1 and flag2:
|
||||
result_dict.update({
|
||||
key: log_line[key]
|
||||
for key in RESULTS_LUT if key in log_line
|
||||
})
|
||||
return result_dict
|
||||
|
||||
last_iter = log_line['iter']
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Gather benchmarked models')
|
||||
parser.add_argument(
|
||||
'-f', '--config-name', type=str, help='Process the selected config.')
|
||||
parser.add_argument(
|
||||
'-w',
|
||||
'--work-dir',
|
||||
default='work_dirs/',
|
||||
type=str,
|
||||
help='Ckpt storage root folder of benchmarked models to be gathered.')
|
||||
parser.add_argument(
|
||||
'-c',
|
||||
'--collect-dir',
|
||||
default='work_dirs/gather',
|
||||
type=str,
|
||||
help='Ckpt collect root folder of gathered models.')
|
||||
parser.add_argument(
|
||||
'--all', action='store_true', help='whether include .py and .log')
|
||||
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
work_dir = args.work_dir
|
||||
collect_dir = args.collect_dir
|
||||
selected_config_name = args.config_name
|
||||
mmcv.mkdir_or_exist(collect_dir)
|
||||
|
||||
# find all models in the root directory to be gathered
|
||||
raw_configs = list(mmcv.scandir('./configs', '.py', recursive=True))
|
||||
|
||||
# filter configs that is not trained in the experiments dir
|
||||
used_configs = []
|
||||
for raw_config in raw_configs:
|
||||
config_name = osp.splitext(osp.basename(raw_config))[0]
|
||||
if osp.exists(osp.join(work_dir, config_name)):
|
||||
if (selected_config_name is None
|
||||
or selected_config_name == config_name):
|
||||
used_configs.append(raw_config)
|
||||
print(f'Find {len(used_configs)} models to be gathered')
|
||||
|
||||
# find final_ckpt and log file for trained each config
|
||||
# and parse the best performance
|
||||
model_infos = []
|
||||
for used_config in used_configs:
|
||||
config_name = osp.splitext(osp.basename(used_config))[0]
|
||||
exp_dir = osp.join(work_dir, config_name)
|
||||
# check whether the exps is finished
|
||||
final_iter = get_final_iter(used_config)
|
||||
final_model = 'iter_{}.pth'.format(final_iter)
|
||||
model_path = osp.join(exp_dir, final_model)
|
||||
|
||||
# skip if the model is still training
|
||||
if not osp.exists(model_path):
|
||||
print(f'{used_config} train not finished yet')
|
||||
continue
|
||||
|
||||
# get logs
|
||||
log_json_paths = glob.glob(osp.join(exp_dir, '*.log.json'))
|
||||
log_json_path = log_json_paths[0]
|
||||
model_performance = None
|
||||
for idx, _log_json_path in enumerate(log_json_paths):
|
||||
model_performance = get_final_results(_log_json_path, final_iter)
|
||||
if model_performance is not None:
|
||||
log_json_path = _log_json_path
|
||||
break
|
||||
|
||||
if model_performance is None:
|
||||
print(f'{used_config} model_performance is None')
|
||||
continue
|
||||
|
||||
model_time = osp.split(log_json_path)[-1].split('.')[0]
|
||||
model_infos.append(
|
||||
dict(
|
||||
config_name=config_name,
|
||||
results=model_performance,
|
||||
iters=final_iter,
|
||||
model_time=model_time,
|
||||
log_json_path=osp.split(log_json_path)[-1]))
|
||||
|
||||
# publish model for each checkpoint
|
||||
publish_model_infos = []
|
||||
for model in model_infos:
|
||||
config_name = model['config_name']
|
||||
model_publish_dir = osp.join(collect_dir, config_name)
|
||||
|
||||
publish_model_path = osp.join(model_publish_dir,
|
||||
config_name + '_' + model['model_time'])
|
||||
trained_model_path = osp.join(work_dir, config_name,
|
||||
'iter_{}.pth'.format(model['iters']))
|
||||
if osp.exists(model_publish_dir):
|
||||
for file in os.listdir(model_publish_dir):
|
||||
if file.endswith('.pth'):
|
||||
print(f'model {file} found')
|
||||
model['model_path'] = osp.abspath(
|
||||
osp.join(model_publish_dir, file))
|
||||
break
|
||||
if 'model_path' not in model:
|
||||
print(f'dir {model_publish_dir} exists, no model found')
|
||||
|
||||
else:
|
||||
mmcv.mkdir_or_exist(model_publish_dir)
|
||||
|
||||
# convert model
|
||||
final_model_path = process_checkpoint(trained_model_path,
|
||||
publish_model_path)
|
||||
model['model_path'] = final_model_path
|
||||
|
||||
new_json_path = f'{config_name}_{model["log_json_path"]}'
|
||||
# copy log
|
||||
shutil.copy(
|
||||
osp.join(work_dir, config_name, model['log_json_path']),
|
||||
osp.join(model_publish_dir, new_json_path))
|
||||
|
||||
if args.all:
|
||||
new_txt_path = new_json_path.rstrip('.json')
|
||||
shutil.copy(
|
||||
osp.join(work_dir, config_name,
|
||||
model['log_json_path'].rstrip('.json')),
|
||||
osp.join(model_publish_dir, new_txt_path))
|
||||
|
||||
if args.all:
|
||||
# copy config to guarantee reproducibility
|
||||
raw_config = osp.join('./configs', f'{config_name}.py')
|
||||
mmcv.Config.fromfile(raw_config).dump(
|
||||
osp.join(model_publish_dir, osp.basename(raw_config)))
|
||||
|
||||
publish_model_infos.append(model)
|
||||
|
||||
models = dict(models=publish_model_infos)
|
||||
mmcv.dump(models, osp.join(collect_dir, 'model_infos.json'), indent=4)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
114
.dev/generate_benchmark_evaluation_script.py
Normal file
114
.dev/generate_benchmark_evaluation_script.py
Normal file
@ -0,0 +1,114 @@
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
import argparse
|
||||
import os.path as osp
|
||||
|
||||
from mmcv import Config
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Convert benchmark test model list to script')
|
||||
parser.add_argument('config', help='test config file path')
|
||||
parser.add_argument('--port', type=int, default=28171, help='dist port')
|
||||
parser.add_argument(
|
||||
'--work-dir',
|
||||
default='work_dirs/benchmark_evaluation',
|
||||
help='the dir to save metric')
|
||||
parser.add_argument(
|
||||
'--out',
|
||||
type=str,
|
||||
default='.dev/benchmark_evaluation.sh',
|
||||
help='path to save model benchmark script')
|
||||
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
def process_model_info(model_info, work_dir):
|
||||
config = model_info['config'].strip()
|
||||
fname, _ = osp.splitext(osp.basename(config))
|
||||
job_name = fname
|
||||
checkpoint = model_info['checkpoint'].strip()
|
||||
work_dir = osp.join(work_dir, fname)
|
||||
if not isinstance(model_info['eval'], list):
|
||||
evals = [model_info['eval']]
|
||||
else:
|
||||
evals = model_info['eval']
|
||||
eval = ' '.join(evals)
|
||||
return dict(
|
||||
config=config,
|
||||
job_name=job_name,
|
||||
checkpoint=checkpoint,
|
||||
work_dir=work_dir,
|
||||
eval=eval)
|
||||
|
||||
|
||||
def create_test_bash_info(commands, model_test_dict, port, script_name,
|
||||
partition):
|
||||
config = model_test_dict['config']
|
||||
job_name = model_test_dict['job_name']
|
||||
checkpoint = model_test_dict['checkpoint']
|
||||
work_dir = model_test_dict['work_dir']
|
||||
eval = model_test_dict['eval']
|
||||
|
||||
echo_info = f'\necho \'{config}\' &'
|
||||
commands.append(echo_info)
|
||||
commands.append('\n')
|
||||
|
||||
command_info = f'GPUS=4 GPUS_PER_NODE=4 ' \
|
||||
f'CPUS_PER_TASK=2 {script_name} '
|
||||
|
||||
command_info += f'{partition} '
|
||||
command_info += f'{job_name} '
|
||||
command_info += f'{config} '
|
||||
command_info += f'$CHECKPOINT_DIR/{checkpoint} '
|
||||
|
||||
command_info += f'--eval {eval} '
|
||||
command_info += f'--work-dir {work_dir} '
|
||||
command_info += f'--cfg-options dist_params.port={port} '
|
||||
command_info += '&'
|
||||
|
||||
commands.append(command_info)
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
if args.out:
|
||||
out_suffix = args.out.split('.')[-1]
|
||||
assert args.out.endswith('.sh'), \
|
||||
f'Expected out file path suffix is .sh, but get .{out_suffix}'
|
||||
|
||||
commands = []
|
||||
partition_name = 'PARTITION=$1'
|
||||
commands.append(partition_name)
|
||||
commands.append('\n')
|
||||
|
||||
checkpoint_root = 'CHECKPOINT_DIR=$2'
|
||||
commands.append(checkpoint_root)
|
||||
commands.append('\n')
|
||||
|
||||
script_name = osp.join('tools', 'slurm_test.sh')
|
||||
port = args.port
|
||||
work_dir = args.work_dir
|
||||
|
||||
cfg = Config.fromfile(args.config)
|
||||
|
||||
for model_key in cfg:
|
||||
model_infos = cfg[model_key]
|
||||
if not isinstance(model_infos, list):
|
||||
model_infos = [model_infos]
|
||||
for model_info in model_infos:
|
||||
print('processing: ', model_info['config'])
|
||||
model_test_dict = process_model_info(model_info, work_dir)
|
||||
create_test_bash_info(commands, model_test_dict, port, script_name,
|
||||
'$PARTITION')
|
||||
port += 1
|
||||
|
||||
command_str = ''.join(commands)
|
||||
if args.out:
|
||||
with open(args.out, 'w') as f:
|
||||
f.write(command_str + '\n')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
91
.dev/generate_benchmark_train_script.py
Normal file
91
.dev/generate_benchmark_train_script.py
Normal file
@ -0,0 +1,91 @@
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
import argparse
|
||||
import os.path as osp
|
||||
|
||||
# Default using 4 gpu when training
|
||||
config_8gpu_list = [
|
||||
'configs/swin/upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K.py', # noqa
|
||||
'configs/vit/upernet_vit-b16_ln_mln_512x512_160k_ade20k.py',
|
||||
'configs/vit/upernet_deit-s16_ln_mln_512x512_160k_ade20k.py',
|
||||
]
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Convert benchmark model json to script')
|
||||
parser.add_argument(
|
||||
'txt_path', type=str, help='txt path output by benchmark_filter')
|
||||
parser.add_argument('--port', type=int, default=24727, help='dist port')
|
||||
parser.add_argument(
|
||||
'--out',
|
||||
type=str,
|
||||
default='.dev/benchmark_train.sh',
|
||||
help='path to save model benchmark script')
|
||||
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
def create_train_bash_info(commands, config, script_name, partition, port):
|
||||
cfg = config.strip()
|
||||
|
||||
# print cfg name
|
||||
echo_info = f'echo \'{cfg}\' &'
|
||||
commands.append(echo_info)
|
||||
commands.append('\n')
|
||||
|
||||
_, model_name = osp.split(osp.dirname(cfg))
|
||||
config_name, _ = osp.splitext(osp.basename(cfg))
|
||||
# default setting
|
||||
if cfg in config_8gpu_list:
|
||||
command_info = f'GPUS=8 GPUS_PER_NODE=8 ' \
|
||||
f'CPUS_PER_TASK=2 {script_name} '
|
||||
else:
|
||||
command_info = f'GPUS=4 GPUS_PER_NODE=4 ' \
|
||||
f'CPUS_PER_TASK=2 {script_name} '
|
||||
command_info += f'{partition} '
|
||||
command_info += f'{config_name} '
|
||||
command_info += f'{cfg} '
|
||||
command_info += f'--cfg-options ' \
|
||||
f'checkpoint_config.max_keep_ckpts=1 ' \
|
||||
f'dist_params.port={port} '
|
||||
command_info += f'--work-dir work_dirs/{model_name}/{config_name} '
|
||||
# Let the script shut up
|
||||
command_info += '>/dev/null &'
|
||||
|
||||
commands.append(command_info)
|
||||
commands.append('\n')
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
if args.out:
|
||||
out_suffix = args.out.split('.')[-1]
|
||||
assert args.out.endswith('.sh'), \
|
||||
f'Expected out file path suffix is .sh, but get .{out_suffix}'
|
||||
|
||||
root_name = './tools'
|
||||
script_name = osp.join(root_name, 'slurm_train.sh')
|
||||
port = args.port
|
||||
partition_name = 'PARTITION=$1'
|
||||
|
||||
commands = []
|
||||
commands.append(partition_name)
|
||||
commands.append('\n')
|
||||
commands.append('\n')
|
||||
|
||||
with open(args.txt_path, 'r') as f:
|
||||
model_cfgs = f.readlines()
|
||||
for i, cfg in enumerate(model_cfgs):
|
||||
create_train_bash_info(commands, cfg, script_name, '$PARTITION',
|
||||
port)
|
||||
port += 1
|
||||
|
||||
command_str = ''.join(commands)
|
||||
if args.out:
|
||||
with open(args.out, 'w') as f:
|
||||
f.write(command_str)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
18
.dev/log_collector/example_config.py
Normal file
18
.dev/log_collector/example_config.py
Normal file
@ -0,0 +1,18 @@
|
||||
work_dir = '../../work_dirs'
|
||||
metric = 'mIoU'
|
||||
|
||||
# specify the log files we would like to collect in `log_items`
|
||||
log_items = [
|
||||
'segformer_mit-b5_512x512_160k_ade20k_cnn_lr_with_warmup',
|
||||
'segformer_mit-b5_512x512_160k_ade20k_cnn_no_warmup_lr',
|
||||
'segformer_mit-b5_512x512_160k_ade20k_mit_trans_lr',
|
||||
'segformer_mit-b5_512x512_160k_ade20k_swin_trans_lr'
|
||||
]
|
||||
# or specify ignore_keywords, then the folders whose name contain
|
||||
# `'segformer'` won't be collected
|
||||
# ignore_keywords = ['segformer']
|
||||
|
||||
# should not include metric
|
||||
other_info_keys = ['mAcc']
|
||||
markdown_file = 'markdowns/lr_in_trans.json.md'
|
||||
json_file = 'jsons/trans_in_cnn.json'
|
||||
143
.dev/log_collector/log_collector.py
Normal file
143
.dev/log_collector/log_collector.py
Normal file
@ -0,0 +1,143 @@
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
import argparse
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import os.path as osp
|
||||
from collections import OrderedDict
|
||||
|
||||
from utils import load_config
|
||||
|
||||
# automatically collect all the results
|
||||
|
||||
# The structure of the directory:
|
||||
# ├── work-dir
|
||||
# │ ├── config_1
|
||||
# │ │ ├── time1.log.json
|
||||
# │ │ ├── time2.log.json
|
||||
# │ │ ├── time3.log.json
|
||||
# │ │ ├── time4.log.json
|
||||
# │ ├── config_2
|
||||
# │ │ ├── time5.log.json
|
||||
# │ │ ├── time6.log.json
|
||||
# │ │ ├── time7.log.json
|
||||
# │ │ ├── time8.log.json
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='extract info from log.json')
|
||||
parser.add_argument('config_dir')
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
def has_keyword(name: str, keywords: list):
|
||||
for a_keyword in keywords:
|
||||
if a_keyword in name:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
cfg = load_config(args.config_dir)
|
||||
work_dir = cfg['work_dir']
|
||||
metric = cfg['metric']
|
||||
log_items = cfg.get('log_items', [])
|
||||
ignore_keywords = cfg.get('ignore_keywords', [])
|
||||
other_info_keys = cfg.get('other_info_keys', [])
|
||||
markdown_file = cfg.get('markdown_file', None)
|
||||
json_file = cfg.get('json_file', None)
|
||||
|
||||
if json_file and osp.split(json_file)[0] != '':
|
||||
os.makedirs(osp.split(json_file)[0], exist_ok=True)
|
||||
if markdown_file and osp.split(markdown_file)[0] != '':
|
||||
os.makedirs(osp.split(markdown_file)[0], exist_ok=True)
|
||||
|
||||
assert not (log_items and ignore_keywords), \
|
||||
'log_items and ignore_keywords cannot be specified at the same time'
|
||||
assert metric not in other_info_keys, \
|
||||
'other_info_keys should not contain metric'
|
||||
|
||||
if ignore_keywords and isinstance(ignore_keywords, str):
|
||||
ignore_keywords = [ignore_keywords]
|
||||
if other_info_keys and isinstance(other_info_keys, str):
|
||||
other_info_keys = [other_info_keys]
|
||||
if log_items and isinstance(log_items, str):
|
||||
log_items = [log_items]
|
||||
|
||||
if not log_items:
|
||||
log_items = [
|
||||
item for item in sorted(os.listdir(work_dir))
|
||||
if not has_keyword(item, ignore_keywords)
|
||||
]
|
||||
|
||||
experiment_info_list = []
|
||||
for config_dir in log_items:
|
||||
preceding_path = os.path.join(work_dir, config_dir)
|
||||
log_list = [
|
||||
item for item in os.listdir(preceding_path)
|
||||
if item.endswith('.log.json')
|
||||
]
|
||||
log_list = sorted(
|
||||
log_list,
|
||||
key=lambda time_str: datetime.datetime.strptime(
|
||||
time_str, '%Y%m%d_%H%M%S.log.json'))
|
||||
val_list = []
|
||||
last_iter = 0
|
||||
for log_name in log_list:
|
||||
with open(os.path.join(preceding_path, log_name), 'r') as f:
|
||||
# ignore the info line
|
||||
f.readline()
|
||||
all_lines = f.readlines()
|
||||
val_list.extend([
|
||||
json.loads(line) for line in all_lines
|
||||
if json.loads(line)['mode'] == 'val'
|
||||
])
|
||||
for index in range(len(all_lines) - 1, -1, -1):
|
||||
line_dict = json.loads(all_lines[index])
|
||||
if line_dict['mode'] == 'train':
|
||||
last_iter = max(last_iter, line_dict['iter'])
|
||||
break
|
||||
|
||||
new_log_dict = dict(
|
||||
method=config_dir, metric_used=metric, last_iter=last_iter)
|
||||
for index, log in enumerate(val_list, 1):
|
||||
new_ordered_dict = OrderedDict()
|
||||
new_ordered_dict['eval_index'] = index
|
||||
new_ordered_dict[metric] = log[metric]
|
||||
for key in other_info_keys:
|
||||
if key in log:
|
||||
new_ordered_dict[key] = log[key]
|
||||
val_list[index - 1] = new_ordered_dict
|
||||
|
||||
assert len(val_list) >= 1, \
|
||||
f"work dir {config_dir} doesn't contain any evaluation."
|
||||
new_log_dict['last eval'] = val_list[-1]
|
||||
new_log_dict['best eval'] = max(val_list, key=lambda x: x[metric])
|
||||
experiment_info_list.append(new_log_dict)
|
||||
print(f'{config_dir} is processed')
|
||||
|
||||
if json_file:
|
||||
with open(json_file, 'w') as f:
|
||||
json.dump(experiment_info_list, f, indent=4)
|
||||
|
||||
if markdown_file:
|
||||
lines_to_write = []
|
||||
for index, log in enumerate(experiment_info_list, 1):
|
||||
lines_to_write.append(
|
||||
f"|{index}|{log['method']}|{log['best eval'][metric]}"
|
||||
f"|{log['best eval']['eval_index']}|"
|
||||
f"{log['last eval'][metric]}|"
|
||||
f"{log['last eval']['eval_index']}|{log['last_iter']}|\n")
|
||||
with open(markdown_file, 'w') as f:
|
||||
f.write(f'|exp_num|method|{metric} best|best index|'
|
||||
f'{metric} last|last index|last iter num|\n')
|
||||
f.write('|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n')
|
||||
f.writelines(lines_to_write)
|
||||
|
||||
print('processed successfully')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
143
.dev/log_collector/readme.md
Normal file
143
.dev/log_collector/readme.md
Normal file
@ -0,0 +1,143 @@
|
||||
# Log Collector
|
||||
|
||||
## Function
|
||||
|
||||
Automatically collect logs and write the result in a json file or markdown file.
|
||||
|
||||
If there are several `.log.json` files in one folder, Log Collector assumes that the `.log.json` files other than the first one are resume from the preceding `.log.json` file. Log Collector returns the result considering all `.log.json` files.
|
||||
|
||||
## Usage:
|
||||
|
||||
To use log collector, you need to write a config file to configure the log collector first.
|
||||
|
||||
For example:
|
||||
|
||||
example_config.py:
|
||||
|
||||
```python
|
||||
# The work directory that contains folders that contains .log.json files.
|
||||
work_dir = '../../work_dirs'
|
||||
# The metric used to find the best evaluation.
|
||||
metric = 'mIoU'
|
||||
|
||||
# **Don't specify the log_items and ignore_keywords at the same time.**
|
||||
# Specify the log files we would like to collect in `log_items`.
|
||||
# The folders specified should be the subdirectories of `work_dir`.
|
||||
log_items = [
|
||||
'segformer_mit-b5_512x512_160k_ade20k_cnn_lr_with_warmup',
|
||||
'segformer_mit-b5_512x512_160k_ade20k_cnn_no_warmup_lr',
|
||||
'segformer_mit-b5_512x512_160k_ade20k_mit_trans_lr',
|
||||
'segformer_mit-b5_512x512_160k_ade20k_swin_trans_lr'
|
||||
]
|
||||
# Or specify `ignore_keywords`. The folders whose name contain one
|
||||
# of the keywords in the `ignore_keywords` list(e.g., `'segformer'`)
|
||||
# won't be collected.
|
||||
# ignore_keywords = ['segformer']
|
||||
|
||||
# Other log items in .log.json that you want to collect.
|
||||
# should not include metric.
|
||||
other_info_keys = ["mAcc"]
|
||||
# The output markdown file's name.
|
||||
markdown_file ='markdowns/lr_in_trans.json.md'
|
||||
# The output json file's name. (optional)
|
||||
json_file = 'jsons/trans_in_cnn.json'
|
||||
```
|
||||
|
||||
The structure of the work-dir directory should be like:
|
||||
|
||||
```text
|
||||
├── work-dir
|
||||
│ ├── folder1
|
||||
│ │ ├── time1.log.json
|
||||
│ │ ├── time2.log.json
|
||||
│ │ ├── time3.log.json
|
||||
│ │ ├── time4.log.json
|
||||
│ ├── folder2
|
||||
│ │ ├── time5.log.json
|
||||
│ │ ├── time6.log.json
|
||||
│ │ ├── time7.log.json
|
||||
│ │ ├── time8.log.json
|
||||
```
|
||||
|
||||
Then , cd to the log collector folder.
|
||||
|
||||
Now you can run log_collector.py by using command:
|
||||
|
||||
```bash
|
||||
python log_collector.py ./example_config.py
|
||||
```
|
||||
|
||||
The output markdown file is like:
|
||||
|
||||
|exp_num|method|mIoU best|best index|mIoU last|last index|last iter num|
|
||||
|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
||||
|1|segformer_mit-b5_512x512_160k_ade20k_cnn_lr_with_warmup|0.2776|10|0.2776|10|160000|
|
||||
|2|segformer_mit-b5_512x512_160k_ade20k_cnn_no_warmup_lr|0.2802|10|0.2802|10|160000|
|
||||
|3|segformer_mit-b5_512x512_160k_ade20k_mit_trans_lr|0.4943|11|0.4943|11|160000|
|
||||
|4|segformer_mit-b5_512x512_160k_ade20k_swin_trans_lr|0.4883|11|0.4883|11|160000|
|
||||
|
||||
The output json file is like:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"method": "segformer_mit-b5_512x512_160k_ade20k_cnn_lr_with_warmup",
|
||||
"metric_used": "mIoU",
|
||||
"last_iter": 160000,
|
||||
"last eval": {
|
||||
"eval_index": 10,
|
||||
"mIoU": 0.2776,
|
||||
"mAcc": 0.3779
|
||||
},
|
||||
"best eval": {
|
||||
"eval_index": 10,
|
||||
"mIoU": 0.2776,
|
||||
"mAcc": 0.3779
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "segformer_mit-b5_512x512_160k_ade20k_cnn_no_warmup_lr",
|
||||
"metric_used": "mIoU",
|
||||
"last_iter": 160000,
|
||||
"last eval": {
|
||||
"eval_index": 10,
|
||||
"mIoU": 0.2802,
|
||||
"mAcc": 0.3764
|
||||
},
|
||||
"best eval": {
|
||||
"eval_index": 10,
|
||||
"mIoU": 0.2802,
|
||||
"mAcc": 0.3764
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "segformer_mit-b5_512x512_160k_ade20k_mit_trans_lr",
|
||||
"metric_used": "mIoU",
|
||||
"last_iter": 160000,
|
||||
"last eval": {
|
||||
"eval_index": 11,
|
||||
"mIoU": 0.4943,
|
||||
"mAcc": 0.6097
|
||||
},
|
||||
"best eval": {
|
||||
"eval_index": 11,
|
||||
"mIoU": 0.4943,
|
||||
"mAcc": 0.6097
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "segformer_mit-b5_512x512_160k_ade20k_swin_trans_lr",
|
||||
"metric_used": "mIoU",
|
||||
"last_iter": 160000,
|
||||
"last eval": {
|
||||
"eval_index": 11,
|
||||
"mIoU": 0.4883,
|
||||
"mAcc": 0.6061
|
||||
},
|
||||
"best eval": {
|
||||
"eval_index": 11,
|
||||
"mIoU": 0.4883,
|
||||
"mAcc": 0.6061
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
20
.dev/log_collector/utils.py
Normal file
20
.dev/log_collector/utils.py
Normal file
@ -0,0 +1,20 @@
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
# modified from https://github.dev/open-mmlab/mmcv
|
||||
import os.path as osp
|
||||
import sys
|
||||
from importlib import import_module
|
||||
|
||||
|
||||
def load_config(cfg_dir: str) -> dict:
|
||||
assert cfg_dir.endswith('.py')
|
||||
root_path, file_name = osp.split(cfg_dir)
|
||||
temp_module = osp.splitext(file_name)[0]
|
||||
sys.path.insert(0, root_path)
|
||||
mod = import_module(temp_module)
|
||||
sys.path.pop(0)
|
||||
cfg_dict = {
|
||||
k: v
|
||||
for k, v in mod.__dict__.items() if not k.startswith('__')
|
||||
}
|
||||
del sys.modules[temp_module]
|
||||
return cfg_dict
|
||||
272
.dev/md2yml.py
Executable file
272
.dev/md2yml.py
Executable file
@ -0,0 +1,272 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
# This tool is used to update model-index.yml which is required by MIM, and
|
||||
# will be automatically called as a pre-commit hook. The updating will be
|
||||
# triggered if any change of model information (.md files in configs/) has been
|
||||
# detected before a commit.
|
||||
|
||||
import glob
|
||||
import os
|
||||
import os.path as osp
|
||||
import re
|
||||
import sys
|
||||
|
||||
import mmcv
|
||||
from lxml import etree
|
||||
|
||||
MMSEG_ROOT = osp.dirname(osp.dirname((osp.dirname(__file__))))
|
||||
|
||||
|
||||
def dump_yaml_and_check_difference(obj, filename, sort_keys=False):
|
||||
"""Dump object to a yaml file, and check if the file content is different
|
||||
from the original.
|
||||
|
||||
Args:
|
||||
obj (any): The python object to be dumped.
|
||||
filename (str): YAML filename to dump the object to.
|
||||
sort_keys (str); Sort key by dictionary order.
|
||||
Returns:
|
||||
Bool: If the target YAML file is different from the original.
|
||||
"""
|
||||
|
||||
str_dump = mmcv.dump(obj, None, file_format='yaml', sort_keys=sort_keys)
|
||||
if osp.isfile(filename):
|
||||
file_exists = True
|
||||
with open(filename, 'r', encoding='utf-8') as f:
|
||||
str_orig = f.read()
|
||||
else:
|
||||
file_exists = False
|
||||
str_orig = None
|
||||
|
||||
if file_exists and str_orig == str_dump:
|
||||
is_different = False
|
||||
else:
|
||||
is_different = True
|
||||
with open(filename, 'w', encoding='utf-8') as f:
|
||||
f.write(str_dump)
|
||||
|
||||
return is_different
|
||||
|
||||
|
||||
def parse_md(md_file):
|
||||
"""Parse .md file and convert it to a .yml file which can be used for MIM.
|
||||
|
||||
Args:
|
||||
md_file (str): Path to .md file.
|
||||
Returns:
|
||||
Bool: If the target YAML file is different from the original.
|
||||
"""
|
||||
collection_name = osp.split(osp.dirname(md_file))[1]
|
||||
configs = os.listdir(osp.dirname(md_file))
|
||||
|
||||
collection = dict(
|
||||
Name=collection_name,
|
||||
Metadata={'Training Data': []},
|
||||
Paper={
|
||||
'URL': '',
|
||||
'Title': ''
|
||||
},
|
||||
README=md_file,
|
||||
Code={
|
||||
'URL': '',
|
||||
'Version': ''
|
||||
})
|
||||
collection.update({'Converted From': {'Weights': '', 'Code': ''}})
|
||||
models = []
|
||||
datasets = []
|
||||
paper_url = None
|
||||
paper_title = None
|
||||
code_url = None
|
||||
code_version = None
|
||||
repo_url = None
|
||||
|
||||
with open(md_file, 'r') as md:
|
||||
lines = md.readlines()
|
||||
i = 0
|
||||
current_dataset = ''
|
||||
while i < len(lines):
|
||||
line = lines[i].strip()
|
||||
# In latest README.md the title and url are in the third line.
|
||||
if i == 2:
|
||||
paper_url = lines[i].split('](')[1].split(')')[0]
|
||||
paper_title = lines[i].split('](')[0].split('[')[1]
|
||||
if len(line) == 0:
|
||||
i += 1
|
||||
continue
|
||||
elif line[:3] == '<a ':
|
||||
content = etree.HTML(line)
|
||||
node = content.xpath('//a')[0]
|
||||
if node.text == 'Code Snippet':
|
||||
code_url = node.get('href', None)
|
||||
assert code_url is not None, (
|
||||
f'{collection_name} hasn\'t code snippet url.')
|
||||
# version extraction
|
||||
filter_str = r'blob/(.*)/mm'
|
||||
pattern = re.compile(filter_str)
|
||||
code_version = pattern.findall(code_url)
|
||||
assert len(code_version) == 1, (
|
||||
f'false regular expression ({filter_str}) use.')
|
||||
code_version = code_version[0]
|
||||
elif node.text == 'Official Repo':
|
||||
repo_url = node.get('href', None)
|
||||
assert repo_url is not None, (
|
||||
f'{collection_name} hasn\'t official repo url.')
|
||||
i += 1
|
||||
elif line[:4] == '### ':
|
||||
datasets.append(line[4:])
|
||||
current_dataset = line[4:]
|
||||
i += 2
|
||||
elif line[0] == '|' and (
|
||||
i + 1) < len(lines) and lines[i + 1][:3] == '| -':
|
||||
cols = [col.strip() for col in line.split('|')]
|
||||
backbone_id = cols.index('Backbone')
|
||||
crop_size_id = cols.index('Crop Size')
|
||||
lr_schd_id = cols.index('Lr schd')
|
||||
mem_id = cols.index('Mem (GB)')
|
||||
fps_id = cols.index('Inf time (fps)')
|
||||
try:
|
||||
ss_id = cols.index('mIoU')
|
||||
except ValueError:
|
||||
ss_id = cols.index('Dice')
|
||||
try:
|
||||
ms_id = cols.index('mIoU(ms+flip)')
|
||||
except ValueError:
|
||||
ms_id = False
|
||||
config_id = cols.index('config')
|
||||
download_id = cols.index('download')
|
||||
j = i + 2
|
||||
while j < len(lines) and lines[j][0] == '|':
|
||||
els = [el.strip() for el in lines[j].split('|')]
|
||||
config = ''
|
||||
model_name = ''
|
||||
weight = ''
|
||||
for fn in configs:
|
||||
if fn in els[config_id]:
|
||||
left = els[download_id].index(
|
||||
'https://download.openmmlab.com')
|
||||
right = els[download_id].index('.pth') + 4
|
||||
weight = els[download_id][left:right]
|
||||
config = f'configs/{collection_name}/{fn}'
|
||||
model_name = fn[:-3]
|
||||
fps = els[fps_id] if els[fps_id] != '-' and els[
|
||||
fps_id] != '' else -1
|
||||
mem = els[mem_id] if els[mem_id] != '-' and els[
|
||||
mem_id] != '' else -1
|
||||
crop_size = els[crop_size_id].split('x')
|
||||
assert len(crop_size) == 2
|
||||
model = {
|
||||
'Name':
|
||||
model_name,
|
||||
'In Collection':
|
||||
collection_name,
|
||||
'Metadata': {
|
||||
'backbone': els[backbone_id],
|
||||
'crop size': f'({crop_size[0]},{crop_size[1]})',
|
||||
'lr schd': int(els[lr_schd_id]),
|
||||
},
|
||||
'Results': [
|
||||
{
|
||||
'Task': 'Semantic Segmentation',
|
||||
'Dataset': current_dataset,
|
||||
'Metrics': {
|
||||
cols[ss_id]: float(els[ss_id]),
|
||||
},
|
||||
},
|
||||
],
|
||||
'Config':
|
||||
config,
|
||||
'Weights':
|
||||
weight,
|
||||
}
|
||||
if fps != -1:
|
||||
try:
|
||||
fps = float(fps)
|
||||
except Exception:
|
||||
j += 1
|
||||
continue
|
||||
model['Metadata']['inference time (ms/im)'] = [{
|
||||
'value':
|
||||
round(1000 / float(fps), 2),
|
||||
'hardware':
|
||||
'V100',
|
||||
'backend':
|
||||
'PyTorch',
|
||||
'batch size':
|
||||
1,
|
||||
'mode':
|
||||
'FP32' if 'fp16' not in config else 'FP16',
|
||||
'resolution':
|
||||
f'({crop_size[0]},{crop_size[1]})'
|
||||
}]
|
||||
if mem != -1:
|
||||
model['Metadata']['Training Memory (GB)'] = float(mem)
|
||||
# Only have semantic segmentation now
|
||||
if ms_id and els[ms_id] != '-' and els[ms_id] != '':
|
||||
model['Results'][0]['Metrics'][
|
||||
'mIoU(ms+flip)'] = float(els[ms_id])
|
||||
models.append(model)
|
||||
j += 1
|
||||
i = j
|
||||
else:
|
||||
i += 1
|
||||
flag = (code_url is not None) and (paper_url is not None) and (repo_url
|
||||
is not None)
|
||||
assert flag, f'{collection_name} readme error'
|
||||
collection['Metadata']['Training Data'] = datasets
|
||||
collection['Code']['URL'] = code_url
|
||||
collection['Code']['Version'] = code_version
|
||||
collection['Paper']['URL'] = paper_url
|
||||
collection['Paper']['Title'] = paper_title
|
||||
collection['Converted From']['Code'] = repo_url
|
||||
# ['Converted From']['Weights] miss
|
||||
# remove empty attribute
|
||||
check_key_list = ['Code', 'Paper', 'Converted From']
|
||||
for check_key in check_key_list:
|
||||
key_list = list(collection[check_key].keys())
|
||||
for key in key_list:
|
||||
if check_key not in collection:
|
||||
break
|
||||
if collection[check_key][key] == '':
|
||||
if len(collection[check_key].keys()) == 1:
|
||||
collection.pop(check_key)
|
||||
else:
|
||||
collection[check_key].pop(key)
|
||||
|
||||
result = {'Collections': [collection], 'Models': models}
|
||||
yml_file = f'{md_file[:-9]}{collection_name}.yml'
|
||||
return dump_yaml_and_check_difference(result, yml_file)
|
||||
|
||||
|
||||
def update_model_index():
|
||||
"""Update model-index.yml according to model .md files.
|
||||
|
||||
Returns:
|
||||
Bool: If the updated model-index.yml is different from the original.
|
||||
"""
|
||||
configs_dir = osp.join(MMSEG_ROOT, 'configs')
|
||||
yml_files = glob.glob(osp.join(configs_dir, '**', '*.yml'), recursive=True)
|
||||
yml_files.sort()
|
||||
|
||||
model_index = {
|
||||
'Import':
|
||||
[osp.relpath(yml_file, MMSEG_ROOT) for yml_file in yml_files]
|
||||
}
|
||||
model_index_file = osp.join(MMSEG_ROOT, 'model-index.yml')
|
||||
is_different = dump_yaml_and_check_difference(model_index,
|
||||
model_index_file)
|
||||
|
||||
return is_different
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
file_list = [fn for fn in sys.argv[1:] if osp.basename(fn) == 'README.md']
|
||||
if not file_list:
|
||||
sys.exit(0)
|
||||
file_modified = False
|
||||
for fn in file_list:
|
||||
file_modified |= parse_md(fn)
|
||||
|
||||
file_modified |= update_model_index()
|
||||
|
||||
sys.exit(1 if file_modified else 0)
|
||||
45
.dev/upload_modelzoo.py
Normal file
45
.dev/upload_modelzoo.py
Normal file
@ -0,0 +1,45 @@
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
import argparse
|
||||
import os
|
||||
import os.path as osp
|
||||
|
||||
import oss2
|
||||
|
||||
ACCESS_KEY_ID = os.getenv('OSS_ACCESS_KEY_ID', None)
|
||||
ACCESS_KEY_SECRET = os.getenv('OSS_ACCESS_KEY_SECRET', None)
|
||||
BUCKET_NAME = 'openmmlab'
|
||||
ENDPOINT = 'https://oss-accelerate.aliyuncs.com'
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Upload models to OSS')
|
||||
parser.add_argument('model_zoo', type=str, help='model_zoo input')
|
||||
parser.add_argument(
|
||||
'--dst-folder',
|
||||
type=str,
|
||||
default='mmsegmentation/v0.5',
|
||||
help='destination folder')
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
model_zoo = args.model_zoo
|
||||
dst_folder = args.dst_folder
|
||||
bucket = oss2.Bucket(
|
||||
oss2.Auth(ACCESS_KEY_ID, ACCESS_KEY_SECRET), ENDPOINT, BUCKET_NAME)
|
||||
|
||||
for root, dirs, files in os.walk(model_zoo):
|
||||
for file in files:
|
||||
file_path = osp.relpath(osp.join(root, file), model_zoo)
|
||||
print(f'Uploading {file_path}')
|
||||
|
||||
oss2.resumable_upload(bucket, osp.join(dst_folder, file_path),
|
||||
osp.join(model_zoo, file_path))
|
||||
bucket.put_object_acl(
|
||||
osp.join(dst_folder, file_path), oss2.OBJECT_ACL_PUBLIC_READ)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
76
.github/CODE_OF_CONDUCT.md
vendored
Normal file
76
.github/CODE_OF_CONDUCT.md
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at chenkaidev@gmail.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
58
.github/CONTRIBUTING.md
vendored
Normal file
58
.github/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
# Contributing to mmsegmentation
|
||||
|
||||
All kinds of contributions are welcome, including but not limited to the following.
|
||||
|
||||
- Fixes (typo, bugs)
|
||||
- New features and components
|
||||
|
||||
## Workflow
|
||||
|
||||
1. fork and pull the latest mmsegmentation
|
||||
2. checkout a new branch (do not use master branch for PRs)
|
||||
3. commit your changes
|
||||
4. create a PR
|
||||
|
||||
:::{note}
|
||||
|
||||
- If you plan to add some new features that involve large changes, it is encouraged to open an issue for discussion first.
|
||||
- If you are the author of some papers and would like to include your method to mmsegmentation,
|
||||
please contact Kai Chen (chenkaidev[at]gmail[dot]com). We will much appreciate your contribution.
|
||||
:::
|
||||
|
||||
## Code style
|
||||
|
||||
### Python
|
||||
|
||||
We adopt [PEP8](https://www.python.org/dev/peps/pep-0008/) as the preferred code style.
|
||||
|
||||
We use the following tools for linting and formatting:
|
||||
|
||||
- [flake8](http://flake8.pycqa.org/en/latest/): linter
|
||||
- [yapf](https://github.com/google/yapf): formatter
|
||||
- [isort](https://github.com/timothycrosley/isort): sort imports
|
||||
|
||||
Style configurations of yapf and isort can be found in [setup.cfg](../setup.cfg) and [.isort.cfg](../.isort.cfg).
|
||||
|
||||
We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `isort`, `trailing whitespaces`,
|
||||
fixes `end-of-files`, sorts `requirments.txt` automatically on every commit.
|
||||
The config for a pre-commit hook is stored in [.pre-commit-config](../.pre-commit-config.yaml).
|
||||
|
||||
After you clone the repository, you will need to install initialize pre-commit hook.
|
||||
|
||||
```shell
|
||||
pip install -U pre-commit
|
||||
```
|
||||
|
||||
From the repository folder
|
||||
|
||||
```shell
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
After this on every commit check code linters and formatter will be enforced.
|
||||
|
||||
>Before you create a PR, make sure that your code lints and is formatted by yapf.
|
||||
|
||||
### C++ and CUDA
|
||||
|
||||
We follow the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
|
||||
6
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
6
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
blank_issues_enabled: false
|
||||
|
||||
contact_links:
|
||||
- name: MMSegmentation Documentation
|
||||
url: https://mmsegmentation.readthedocs.io
|
||||
about: Check the docs and FAQ to see if you question is already answered.
|
||||
48
.github/ISSUE_TEMPLATE/error-report.md
vendored
Normal file
48
.github/ISSUE_TEMPLATE/error-report.md
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
---
|
||||
name: Error report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Thanks for your error report and we appreciate it a lot.
|
||||
|
||||
**Checklist**
|
||||
|
||||
1. I have searched related issues but cannot get the expected help.
|
||||
2. The bug has not been fixed in the latest version.
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**Reproduction**
|
||||
|
||||
1. What command or script did you run?
|
||||
|
||||
```none
|
||||
A placeholder for the command.
|
||||
```
|
||||
|
||||
2. Did you make any modifications on the code or config? Did you understand what you have modified?
|
||||
3. What dataset did you use?
|
||||
|
||||
**Environment**
|
||||
|
||||
1. Please run `python mmseg/utils/collect_env.py` to collect necessary environment information and paste it here.
|
||||
2. You may add addition that may be helpful for locating the problem, such as
|
||||
- How you installed PyTorch [e.g., pip, conda, source]
|
||||
- Other environment variables that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.)
|
||||
|
||||
**Error traceback**
|
||||
|
||||
If applicable, paste the error trackback here.
|
||||
|
||||
```none
|
||||
A placeholder for trackback.
|
||||
```
|
||||
|
||||
**Bug fix**
|
||||
|
||||
If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!
|
||||
22
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Describe the feature
|
||||
|
||||
**Motivation**
|
||||
A clear and concise description of the motivation of the feature.
|
||||
Ex1. It is inconvenient when [....].
|
||||
Ex2. There is a recent paper [....], which is very helpful for [....].
|
||||
|
||||
**Related resources**
|
||||
If there is an official code release or third-party implementations, please also provide the information here, which would be very helpful.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
If you would like to implement the feature and create a PR, please leave a comment here and that would be much appreciated.
|
||||
8
.github/ISSUE_TEMPLATE/general_questions.md
vendored
Normal file
8
.github/ISSUE_TEMPLATE/general_questions.md
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
name: General questions
|
||||
about: Ask general questions to get help
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
70
.github/ISSUE_TEMPLATE/reimplementation_questions.md
vendored
Normal file
70
.github/ISSUE_TEMPLATE/reimplementation_questions.md
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
---
|
||||
name: Reimplementation Questions
|
||||
about: Ask about questions during model reimplementation
|
||||
title: ''
|
||||
labels: 'reimplementation'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
If you feel we have helped you, give us a STAR! :satisfied:
|
||||
|
||||
**Notice**
|
||||
|
||||
There are several common situations in the reimplementation issues as below
|
||||
|
||||
1. Reimplement a model in the model zoo using the provided configs
|
||||
2. Reimplement a model in the model zoo on other datasets (e.g., custom datasets)
|
||||
3. Reimplement a custom model but all the components are implemented in MMSegmentation
|
||||
4. Reimplement a custom model with new modules implemented by yourself
|
||||
|
||||
There are several things to do for different cases as below.
|
||||
|
||||
- For cases 1 & 3, please follow the steps in the following sections thus we could help to quickly identify the issue.
|
||||
- For cases 2 & 4, please understand that we are not able to do much help here because we usually do not know the full code, and the users should be responsible for the code they write.
|
||||
- One suggestion for cases 2 & 4 is that the users should first check whether the bug lies in the self-implemented code or the original code. For example, users can first make sure that the same model runs well on supported datasets. If you still need help, please describe what you have done and what you obtain in the issue, and follow the steps in the following sections, and try as clear as possible so that we can better help you.
|
||||
|
||||
**Checklist**
|
||||
|
||||
1. I have searched related issues but cannot get the expected help.
|
||||
2. The issue has not been fixed in the latest version.
|
||||
|
||||
**Describe the issue**
|
||||
|
||||
A clear and concise description of the problem you meet and what you have done.
|
||||
|
||||
**Reproduction**
|
||||
|
||||
1. What command or script did you run?
|
||||
|
||||
```
|
||||
A placeholder for the command.
|
||||
```
|
||||
|
||||
2. What config dir you run?
|
||||
|
||||
```
|
||||
A placeholder for the config.
|
||||
```
|
||||
|
||||
3. Did you make any modifications to the code or config? Did you understand what you have modified?
|
||||
4. What dataset did you use?
|
||||
|
||||
**Environment**
|
||||
|
||||
1. Please run `PYTHONPATH=${PWD}:$PYTHONPATH python mmseg/utils/collect_env.py` to collect the necessary environment information and paste it here.
|
||||
2. You may add an addition that may be helpful for locating the problem, such as
|
||||
1. How you installed PyTorch [e.g., pip, conda, source]
|
||||
2. Other environment variables that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.)
|
||||
|
||||
**Results**
|
||||
|
||||
If applicable, paste the related results here, e.g., what you expect and what you get.
|
||||
|
||||
```
|
||||
A placeholder for results comparison
|
||||
```
|
||||
|
||||
**Issue fix**
|
||||
|
||||
If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!
|
||||
25
.github/pull_request_template.md
vendored
Normal file
25
.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
|
||||
|
||||
## Motivation
|
||||
|
||||
Please describe the motivation of this PR and the goal you want to achieve through this PR.
|
||||
|
||||
## Modification
|
||||
|
||||
Please briefly describe what modification is made in this PR.
|
||||
|
||||
## BC-breaking (Optional)
|
||||
|
||||
Does the modification introduce changes that break the backward-compatibility of the downstream repos?
|
||||
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
|
||||
|
||||
## Use cases (Optional)
|
||||
|
||||
If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.
|
||||
|
||||
## Checklist
|
||||
|
||||
1. Pre-commit or other linting tools are used to fix the potential lint issues.
|
||||
2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
|
||||
3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMDet3D.
|
||||
4. The documentation has been modified accordingly, like docstring or example tutorials.
|
||||
221
.github/workflows/build.yml
vendored
Normal file
221
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,221 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'demo/**'
|
||||
- '.dev/**'
|
||||
- 'docker/**'
|
||||
- 'tools/**'
|
||||
- '**.md'
|
||||
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'demo/**'
|
||||
- '.dev/**'
|
||||
- 'docker/**'
|
||||
- 'tools/**'
|
||||
- 'docs/**'
|
||||
- '**.md'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_cpu:
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.7]
|
||||
torch: [1.5.1, 1.6.0, 1.7.0, 1.8.0, 1.9.0]
|
||||
include:
|
||||
- torch: 1.5.1
|
||||
torchvision: 0.6.1
|
||||
mmcv: 1.5.0
|
||||
- torch: 1.6.0
|
||||
torchvision: 0.7.0
|
||||
mmcv: 1.6.0
|
||||
- torch: 1.7.0
|
||||
torchvision: 0.8.1
|
||||
mmcv: 1.7.0
|
||||
- torch: 1.8.0
|
||||
torchvision: 0.9.0
|
||||
mmcv: 1.8.0
|
||||
- torch: 1.9.0
|
||||
torchvision: 0.10.0
|
||||
mmcv: 1.9.0
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Upgrade pip
|
||||
run: pip install pip --upgrade
|
||||
- name: Install Pillow
|
||||
run: pip install Pillow==6.2.2
|
||||
if: ${{matrix.torchvision == '0.4.2'}}
|
||||
- name: Install PyTorch
|
||||
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
||||
- name: Install MMCV
|
||||
run: |
|
||||
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch${{matrix.mmcv}}/index.html
|
||||
python -c 'import mmcv; print(mmcv.__version__)'
|
||||
- name: Install unittest dependencies
|
||||
run: |
|
||||
pip install -r requirements.txt
|
||||
- name: Build and install
|
||||
run: rm -rf .eggs && pip install -e .
|
||||
- name: Run unittests and generate coverage report
|
||||
run: |
|
||||
pip install timm
|
||||
coverage run --branch --source mmseg -m pytest tests/
|
||||
coverage xml
|
||||
coverage report -m
|
||||
if: ${{matrix.torch >= '1.5.0'}}
|
||||
- name: Skip timm unittests and generate coverage report
|
||||
run: |
|
||||
coverage run --branch --source mmseg -m pytest tests/ --ignore tests/test_models/test_backbones/test_timm_backbone.py
|
||||
coverage xml
|
||||
coverage report -m
|
||||
if: ${{matrix.torch < '1.5.0'}}
|
||||
|
||||
build_cuda101:
|
||||
runs-on: ubuntu-18.04
|
||||
container:
|
||||
image: pytorch/pytorch:1.6.0-cuda10.1-cudnn7-devel
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.7]
|
||||
torch:
|
||||
[
|
||||
1.5.1+cu101,
|
||||
1.6.0+cu101,
|
||||
1.7.0+cu101,
|
||||
1.8.0+cu101
|
||||
]
|
||||
include:
|
||||
- torch: 1.5.1+cu101
|
||||
torch_version: torch1.5.1
|
||||
torchvision: 0.6.1+cu101
|
||||
mmcv: 1.5.0
|
||||
- torch: 1.6.0+cu101
|
||||
torch_version: torch1.6.0
|
||||
torchvision: 0.7.0+cu101
|
||||
mmcv: 1.6.0
|
||||
- torch: 1.7.0+cu101
|
||||
torch_version: torch1.7.0
|
||||
torchvision: 0.8.1+cu101
|
||||
mmcv: 1.7.0
|
||||
- torch: 1.8.0+cu101
|
||||
torch_version: torch1.8.0
|
||||
torchvision: 0.9.0+cu101
|
||||
mmcv: 1.8.0
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 python${{matrix.python-version}}-dev
|
||||
apt-get clean
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
- name: Install Pillow
|
||||
run: python -m pip install Pillow==6.2.2
|
||||
if: ${{matrix.torchvision < 0.5}}
|
||||
- name: Install PyTorch
|
||||
run: python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
|
||||
- name: Install mmseg dependencies
|
||||
run: |
|
||||
python -V
|
||||
python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch${{matrix.mmcv}}/index.html
|
||||
python -m pip install -r requirements.txt
|
||||
python -c 'import mmcv; print(mmcv.__version__)'
|
||||
- name: Build and install
|
||||
run: |
|
||||
rm -rf .eggs
|
||||
python setup.py check -m -s
|
||||
TORCH_CUDA_ARCH_LIST=7.0 pip install .
|
||||
- name: Run unittests and generate coverage report
|
||||
run: |
|
||||
python -m pip install timm
|
||||
coverage run --branch --source mmseg -m pytest tests/
|
||||
coverage xml
|
||||
coverage report -m
|
||||
if: ${{matrix.torch >= '1.5.0'}}
|
||||
- name: Skip timm unittests and generate coverage report
|
||||
run: |
|
||||
coverage run --branch --source mmseg -m pytest tests/ --ignore tests/test_models/test_backbones/test_timm_backbone.py
|
||||
coverage xml
|
||||
coverage report -m
|
||||
if: ${{matrix.torch < '1.5.0'}}
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v1.0.10
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
flags: unittests
|
||||
env_vars: OS,PYTHON
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
|
||||
build_cuda102:
|
||||
runs-on: ubuntu-18.04
|
||||
container:
|
||||
image: pytorch/pytorch:1.9.0-cuda10.2-cudnn7-devel
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8, 3.9]
|
||||
torch: [1.9.0+cu102]
|
||||
include:
|
||||
- torch: 1.9.0+cu102
|
||||
torch_version: torch1.9.0
|
||||
torchvision: 0.10.0+cu102
|
||||
mmcv_link: 1.9.0
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
|
||||
apt-get clean
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
- name: Install Pillow
|
||||
run: python -m pip install Pillow==6.2.2
|
||||
if: ${{matrix.torchvision < 0.5}}
|
||||
- name: Install PyTorch
|
||||
run: python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
|
||||
- name: Install mmseg dependencies
|
||||
run: |
|
||||
python -V
|
||||
python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch${{matrix.mmcv_link}}/index.html
|
||||
python -m pip install -r requirements.txt
|
||||
python -c 'import mmcv; print(mmcv.__version__)'
|
||||
- name: Build and install
|
||||
run: |
|
||||
rm -rf .eggs
|
||||
python setup.py check -m -s
|
||||
TORCH_CUDA_ARCH_LIST=7.0 pip install .
|
||||
- name: Run unittests and generate coverage report
|
||||
run: |
|
||||
python -m pip install timm
|
||||
coverage run --branch --source mmseg -m pytest tests/
|
||||
coverage xml
|
||||
coverage report -m
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
files: ./coverage.xml
|
||||
flags: unittests
|
||||
env_vars: OS,PYTHON
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
26
.github/workflows/deploy.yml
vendored
Normal file
26
.github/workflows/deploy.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: deploy
|
||||
|
||||
on: push
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-n-publish:
|
||||
runs-on: ubuntu-latest
|
||||
if: startsWith(github.event.ref, 'refs/tags')
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.7
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: Build MMSegmentation
|
||||
run: |
|
||||
pip install wheel
|
||||
python setup.py sdist bdist_wheel
|
||||
- name: Publish distribution to PyPI
|
||||
run: |
|
||||
pip install twine
|
||||
twine upload dist/* -u __token__ -p ${{ secrets.pypi_password }}
|
||||
31
.github/workflows/lint.yml
vendored
Normal file
31
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: lint
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.7
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: Install pre-commit hook
|
||||
run: |
|
||||
pip install pre-commit
|
||||
pre-commit install
|
||||
- name: Linting
|
||||
run: |
|
||||
sudo apt-add-repository ppa:brightbox/ruby-ng -y
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ruby2.7
|
||||
pre-commit run --all-files
|
||||
- name: Check docstring coverage
|
||||
run: |
|
||||
pip install interrogate
|
||||
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --exclude mmseg/ops --ignore-regex "__repr__" --fail-under 80 mmseg
|
||||
119
.gitignore
vendored
Normal file
119
.gitignore
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/en/_build/
|
||||
docs/zh_cn/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
||||
data
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# custom
|
||||
*.pkl
|
||||
*.pkl.json
|
||||
*.log.json
|
||||
work_dirs/
|
||||
mmseg/.mim
|
||||
|
||||
# Pytorch
|
||||
*.pth
|
||||
51
.pre-commit-config.yaml
Normal file
51
.pre-commit-config.yaml
Normal file
@ -0,0 +1,51 @@
|
||||
repos:
|
||||
- repo: https://gitlab.com/pycqa/flake8.git
|
||||
rev: 3.8.3
|
||||
hooks:
|
||||
- id: flake8
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.10.1
|
||||
hooks:
|
||||
- id: isort
|
||||
- repo: https://github.com/pre-commit/mirrors-yapf
|
||||
rev: v0.30.0
|
||||
hooks:
|
||||
- id: yapf
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.1.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: check-yaml
|
||||
- id: end-of-file-fixer
|
||||
- id: requirements-txt-fixer
|
||||
- id: double-quote-string-fixer
|
||||
- id: check-merge-conflict
|
||||
- id: fix-encoding-pragma
|
||||
args: ["--remove"]
|
||||
- id: mixed-line-ending
|
||||
args: ["--fix=lf"]
|
||||
- repo: https://github.com/markdownlint/markdownlint
|
||||
rev: v0.11.0
|
||||
hooks:
|
||||
- id: markdownlint
|
||||
args: ["-r", "~MD002,~MD013,~MD029,~MD033,~MD034",
|
||||
"-t", "allow_different_nesting"]
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.1.0
|
||||
hooks:
|
||||
- id: codespell
|
||||
- repo: https://github.com/myint/docformatter
|
||||
rev: v1.3.1
|
||||
hooks:
|
||||
- id: docformatter
|
||||
args: ["--in-place", "--wrap-descriptions", "79"]
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: update-model-index
|
||||
name: update-model-index
|
||||
description: Collect model information and update model-index.yml
|
||||
entry: .dev/md2yml.py
|
||||
additional_dependencies: [mmcv, lxml]
|
||||
language: python
|
||||
files: ^configs/.*\.md$
|
||||
require_serial: true
|
||||
9
.readthedocs.yml
Normal file
9
.readthedocs.yml
Normal file
@ -0,0 +1,9 @@
|
||||
version: 2
|
||||
|
||||
formats: all
|
||||
|
||||
python:
|
||||
version: 3.7
|
||||
install:
|
||||
- requirements: requirements/docs.txt
|
||||
- requirements: requirements/readthedocs.txt
|
||||
8
CITATION.cff
Normal file
8
CITATION.cff
Normal file
@ -0,0 +1,8 @@
|
||||
cff-version: 1.2.0
|
||||
message: "If you use this software, please cite it as below."
|
||||
authors:
|
||||
- name: "MMSegmentation Contributors"
|
||||
title: "OpenMMLab Semantic Segmentation Toolbox and Benchmark"
|
||||
date-released: 2020-07-10
|
||||
url: "https://github.com/open-mmlab/mmsegmentation"
|
||||
license: Apache-2.0
|
||||
203
LICENSE
Normal file
203
LICENSE
Normal file
@ -0,0 +1,203 @@
|
||||
Copyright 2020 The MMSegmentation Authors. All rights reserved.
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2020 The MMSegmentation Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
4
MANIFEST.in
Normal file
4
MANIFEST.in
Normal file
@ -0,0 +1,4 @@
|
||||
include requirements/*.txt
|
||||
include mmseg/.mim/model-index.yml
|
||||
recursive-include mmseg/.mim/configs *.py *.yml
|
||||
recursive-include mmseg/.mim/tools *.py *.sh
|
||||
71
README.md
71
README.md
@ -1 +1,70 @@
|
||||
# kneron-mmsegmentation
|
||||
# Kneron AI Training/Deployment Platform (mmsegmentation-based)
|
||||
|
||||
|
||||
## Introduction
|
||||
|
||||
[kneron-mmsegmentation](https://github.com/kneron/kneron-mmsegmentation) is a platform built upon the well-known [mmsegmentation](https://github.com/open-mmlab/mmsegmentation) for mmsegmentation. If you are looking for original mmsegmentation document, please visit [mmsegmentation docs](https://mmsegmentation.readthedocs.io/en/latest/) for detailed mmsegmentation usage.
|
||||
|
||||
In this repository, we provide an end-to-end training/deployment flow to realize on Kneron's AI accelerators:
|
||||
|
||||
1. **Training/Evalulation:**
|
||||
- Modified model configuration file and verified for Kneron hardware platform
|
||||
- Please see [Overview of Benchmark and Model Zoo](#Overview-of-Benchmark-and-Model-Zoo) for Kneron-Verified model list
|
||||
2. **Converting to ONNX:**
|
||||
- tools/pytorch2onnx_kneron.py (beta)
|
||||
- Export *optimized* and *Kneron-toolchain supported* onnx
|
||||
- Automatically modify model for arbitrary data normalization preprocess
|
||||
3. **Evaluation**
|
||||
- tools/test_kneron.py (beta)
|
||||
- Evaluate the model with *pytorch checkpoint, onnx, and kneron-nef*
|
||||
4. **Testing**
|
||||
- inference_kn (beta)
|
||||
- Verify the converted [NEF](http://doc.kneron.com/docs/#toolchain/manual/#5-nef-workflow) model on Kneron USB accelerator with this API
|
||||
5. **Converting Kneron-NEF:** (toolchain feature)
|
||||
- Convert the trained pytorch model to [Kneron-NEF](http://doc.kneron.com/docs/#toolchain/manual/#5-nef-workflow) model, which could be used on Kneron hardware platform.
|
||||
|
||||
## License
|
||||
|
||||
This project is released under the [Apache 2.0 license](LICENSE).
|
||||
|
||||
## Changelog
|
||||
|
||||
N/A
|
||||
|
||||
## Overview of Benchmark and Kneron Model Zoo
|
||||
|
||||
| Backbone | Crop Size | Mem (GB) | mIoU | Config | Download |
|
||||
|:--------:|:---------:|:--------:|:----:|:------:|:--------:|
|
||||
| STDC 1 | 512x1024 | 7.15 | 69.29|[config](https://github.com/kneron/kneron-mmsegmentation/tree/master/configs/stdc/kn_stdc1_in1k-pre_512x1024_80k_cityscapes.py)|[model](https://github.com/kneron/Model_Zoo/blob/main/mmsegmentation/stdc_1/latest.zip)
|
||||
|
||||
NOTE: The performance may slightly differ from the original implementation since the input size is smaller.
|
||||
|
||||
## Installation
|
||||
- Please refer to the Step 1 of [docs_kneron/stdc_step_by_step.md#step-1-environment](docs_kneron/stdc_step_by_step.md) for installation.
|
||||
- Please refer to [Kneron PLUS - Python: Installation](http://doc.kneron.com/docs/#plus_python/introduction/install_dependency/) for the environment setup for Kneron USB accelerator.
|
||||
|
||||
## Getting Started
|
||||
### Tutorial - Kneron Edition
|
||||
- [STDC-Seg: Step-By-Step](docs_kneron/stdc_step_by_step.md): A tutorial for users to get started easily. To see detailed documents, please see below.
|
||||
|
||||
### Documents - Kneron Edition
|
||||
- [Kneron ONNX Export] (under development)
|
||||
- [Kneron Inference] (under development)
|
||||
- [Kneron Toolchain Step-By-Step (YOLOv3)](http://doc.kneron.com/docs/#toolchain/yolo_example/)
|
||||
- [Kneron Toolchain Manual](http://doc.kneron.com/docs/#toolchain/manual/#0-overview)
|
||||
|
||||
### Original mmsegmentation Documents
|
||||
- [Original mmsegmentation getting started](https://github.com/open-mmlab/mmsegmentation#getting-started): It is recommended to read the original mmsegmentation getting started documents for other mmsegmentation operations.
|
||||
- [Original mmsegmentation readthedoc](https://mmsegmentation.readthedocs.io/en/latest/): Original mmsegmentation documents.
|
||||
|
||||
## Contributing
|
||||
[kneron-mmsegmentation](https://github.com/kneron/kneron-mmsegmentation) a platform built upon [OpenMMLab-mmsegmentation](https://github.com/open-mmlab/mmsegmentation)
|
||||
|
||||
- For issues regarding to the original [mmsegmentation](https://github.com/open-mmlab/mmsegmentation):
|
||||
We appreciate all contributions to improve [OpenMMLab-mmsegmentation](https://github.com/open-mmlab/mmsegmentation). Ongoing projects can be found in out [GitHub Projects](https://github.com/open-mmlab/mmsegmentation/projects). Welcome community users to participate in these projects. Please refer to [CONTRIBUTING.md](.github/CONTRIBUTING.md) for the contributing guideline.
|
||||
|
||||
- For issues regarding to this repository [kneron-mmsegmentation](https://github.com/kneron/kneron-mmsegmentation): Welcome to leave the comment or submit pull requests here to improve kneron-mmsegmentation
|
||||
|
||||
|
||||
## Related Projects
|
||||
- [kneron-mmdetection](https://github.com/kneron/kneron-mmdetection): Kneron training/deployment platform on [OpenMMLab - mmdetection](https://github.com/open-mmlab/mmdetection) object detection toolbox
|
||||
|
||||
54
configs/_base_/datasets/ade20k.py
Normal file
54
configs/_base_/datasets/ade20k.py
Normal file
@ -0,0 +1,54 @@
|
||||
# dataset settings
|
||||
dataset_type = 'ADE20KDataset'
|
||||
data_root = 'data/ade/ADEChallengeData2016'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (512, 512)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations', reduce_zero_label=True),
|
||||
dict(type='Resize', img_scale=(2048, 512), 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=(2048, 512),
|
||||
# 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='images/training',
|
||||
ann_dir='annotations/training',
|
||||
pipeline=train_pipeline),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/validation',
|
||||
ann_dir='annotations/validation',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/validation',
|
||||
ann_dir='annotations/validation',
|
||||
pipeline=test_pipeline))
|
||||
59
configs/_base_/datasets/chase_db1.py
Normal file
59
configs/_base_/datasets/chase_db1.py
Normal file
@ -0,0 +1,59 @@
|
||||
# dataset settings
|
||||
dataset_type = 'ChaseDB1Dataset'
|
||||
data_root = 'data/CHASE_DB1'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
img_scale = (960, 999)
|
||||
crop_size = (128, 128)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
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, 2.0],
|
||||
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='RepeatDataset',
|
||||
times=40000,
|
||||
dataset=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/training',
|
||||
ann_dir='annotations/training',
|
||||
pipeline=train_pipeline)),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/validation',
|
||||
ann_dir='annotations/validation',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/validation',
|
||||
ann_dir='annotations/validation',
|
||||
pipeline=test_pipeline))
|
||||
54
configs/_base_/datasets/cityscapes.py
Normal file
54
configs/_base_/datasets/cityscapes.py
Normal file
@ -0,0 +1,54 @@
|
||||
# dataset settings
|
||||
dataset_type = 'CityscapesDataset'
|
||||
data_root = 'data/cityscapes/'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (512, 1024)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
dict(type='Resize', img_scale=(2048, 1024), 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=(2048, 1024),
|
||||
# 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=2,
|
||||
workers_per_gpu=2,
|
||||
train=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='leftImg8bit/train',
|
||||
ann_dir='gtFine/train',
|
||||
pipeline=train_pipeline),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='leftImg8bit/val',
|
||||
ann_dir='gtFine/val',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='leftImg8bit/val',
|
||||
ann_dir='gtFine/val',
|
||||
pipeline=test_pipeline))
|
||||
35
configs/_base_/datasets/cityscapes_1024x1024.py
Normal file
35
configs/_base_/datasets/cityscapes_1024x1024.py
Normal file
@ -0,0 +1,35 @@
|
||||
_base_ = './cityscapes.py'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (1024, 1024)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
dict(type='Resize', img_scale=(2048, 1024), 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=(2048, 1024),
|
||||
# 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(
|
||||
train=dict(pipeline=train_pipeline),
|
||||
val=dict(pipeline=test_pipeline),
|
||||
test=dict(pipeline=test_pipeline))
|
||||
35
configs/_base_/datasets/cityscapes_768x768.py
Normal file
35
configs/_base_/datasets/cityscapes_768x768.py
Normal file
@ -0,0 +1,35 @@
|
||||
_base_ = './cityscapes.py'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (768, 768)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
dict(type='Resize', img_scale=(2049, 1025), 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=(2049, 1025),
|
||||
# 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(
|
||||
train=dict(pipeline=train_pipeline),
|
||||
val=dict(pipeline=test_pipeline),
|
||||
test=dict(pipeline=test_pipeline))
|
||||
35
configs/_base_/datasets/cityscapes_769x769.py
Normal file
35
configs/_base_/datasets/cityscapes_769x769.py
Normal file
@ -0,0 +1,35 @@
|
||||
_base_ = './cityscapes.py'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (769, 769)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
dict(type='Resize', img_scale=(2049, 1025), 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=(2049, 1025),
|
||||
# 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(
|
||||
train=dict(pipeline=train_pipeline),
|
||||
val=dict(pipeline=test_pipeline),
|
||||
test=dict(pipeline=test_pipeline))
|
||||
35
configs/_base_/datasets/cityscapes_832x832.py
Normal file
35
configs/_base_/datasets/cityscapes_832x832.py
Normal file
@ -0,0 +1,35 @@
|
||||
_base_ = './cityscapes.py'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (832, 832)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
dict(type='Resize', img_scale=(2048, 1024), 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=(2048, 1024),
|
||||
# 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(
|
||||
train=dict(pipeline=train_pipeline),
|
||||
val=dict(pipeline=test_pipeline),
|
||||
test=dict(pipeline=test_pipeline))
|
||||
57
configs/_base_/datasets/coco-stuff10k.py
Normal file
57
configs/_base_/datasets/coco-stuff10k.py
Normal file
@ -0,0 +1,57 @@
|
||||
# dataset settings
|
||||
dataset_type = 'COCOStuffDataset'
|
||||
data_root = 'data/coco_stuff10k'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (512, 512)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations', reduce_zero_label=True),
|
||||
dict(type='Resize', img_scale=(2048, 512), 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=(2048, 512),
|
||||
# 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,
|
||||
reduce_zero_label=True,
|
||||
img_dir='images/train2014',
|
||||
ann_dir='annotations/train2014',
|
||||
pipeline=train_pipeline),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
reduce_zero_label=True,
|
||||
img_dir='images/test2014',
|
||||
ann_dir='annotations/test2014',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
reduce_zero_label=True,
|
||||
img_dir='images/test2014',
|
||||
ann_dir='annotations/test2014',
|
||||
pipeline=test_pipeline))
|
||||
54
configs/_base_/datasets/coco-stuff164k.py
Normal file
54
configs/_base_/datasets/coco-stuff164k.py
Normal file
@ -0,0 +1,54 @@
|
||||
# dataset settings
|
||||
dataset_type = 'COCOStuffDataset'
|
||||
data_root = 'data/coco_stuff164k'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (512, 512)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
dict(type='Resize', img_scale=(2048, 512), 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=(2048, 512),
|
||||
# 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='images/train2017',
|
||||
ann_dir='annotations/train2017',
|
||||
pipeline=train_pipeline),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/val2017',
|
||||
ann_dir='annotations/val2017',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/val2017',
|
||||
ann_dir='annotations/val2017',
|
||||
pipeline=test_pipeline))
|
||||
59
configs/_base_/datasets/drive.py
Normal file
59
configs/_base_/datasets/drive.py
Normal file
@ -0,0 +1,59 @@
|
||||
# dataset settings
|
||||
dataset_type = 'DRIVEDataset'
|
||||
data_root = 'data/DRIVE'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
img_scale = (584, 565)
|
||||
crop_size = (64, 64)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
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, 2.0],
|
||||
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='RepeatDataset',
|
||||
times=40000,
|
||||
dataset=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/training',
|
||||
ann_dir='annotations/training',
|
||||
pipeline=train_pipeline)),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/validation',
|
||||
ann_dir='annotations/validation',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/validation',
|
||||
ann_dir='annotations/validation',
|
||||
pipeline=test_pipeline))
|
||||
59
configs/_base_/datasets/hrf.py
Normal file
59
configs/_base_/datasets/hrf.py
Normal file
@ -0,0 +1,59 @@
|
||||
# dataset settings
|
||||
dataset_type = 'HRFDataset'
|
||||
data_root = 'data/HRF'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
img_scale = (2336, 3504)
|
||||
crop_size = (256, 256)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
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, 2.0],
|
||||
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='RepeatDataset',
|
||||
times=40000,
|
||||
dataset=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/training',
|
||||
ann_dir='annotations/training',
|
||||
pipeline=train_pipeline)),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/validation',
|
||||
ann_dir='annotations/validation',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/validation',
|
||||
ann_dir='annotations/validation',
|
||||
pipeline=test_pipeline))
|
||||
54
configs/_base_/datasets/kn_cityscapes.py
Normal file
54
configs/_base_/datasets/kn_cityscapes.py
Normal file
@ -0,0 +1,54 @@
|
||||
# dataset settings
|
||||
dataset_type = 'CityscapesDataset'
|
||||
data_root = 'data/cityscapes/'
|
||||
img_norm_cfg = dict(
|
||||
mean=[128., 128., 128.], std=[256., 256., 256.], to_rgb=True)
|
||||
crop_size = (512, 1024)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
dict(type='Resize', img_scale=(2048, 1024), 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=(2048, 1024),
|
||||
img_scale=(1024, 512),
|
||||
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=2,
|
||||
workers_per_gpu=2,
|
||||
train=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='leftImg8bit/train',
|
||||
ann_dir='gtFine/train',
|
||||
pipeline=train_pipeline),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='leftImg8bit/val',
|
||||
ann_dir='gtFine/val',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='leftImg8bit/val',
|
||||
ann_dir='gtFine/val',
|
||||
pipeline=test_pipeline))
|
||||
54
configs/_base_/datasets/loveda.py
Normal file
54
configs/_base_/datasets/loveda.py
Normal file
@ -0,0 +1,54 @@
|
||||
# dataset settings
|
||||
dataset_type = 'LoveDADataset'
|
||||
data_root = 'data/loveDA'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (512, 512)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations', reduce_zero_label=True),
|
||||
dict(type='Resize', img_scale=(2048, 512), 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=(1024, 1024),
|
||||
# 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='img_dir/train',
|
||||
ann_dir='ann_dir/train',
|
||||
pipeline=train_pipeline),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='img_dir/val',
|
||||
ann_dir='ann_dir/val',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='img_dir/val',
|
||||
ann_dir='ann_dir/val',
|
||||
pipeline=test_pipeline))
|
||||
60
configs/_base_/datasets/pascal_context.py
Normal file
60
configs/_base_/datasets/pascal_context.py
Normal file
@ -0,0 +1,60 @@
|
||||
# dataset settings
|
||||
dataset_type = 'PascalContextDataset'
|
||||
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 = (480, 480)
|
||||
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
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))
|
||||
60
configs/_base_/datasets/pascal_context_59.py
Normal file
60
configs/_base_/datasets/pascal_context_59.py
Normal file
@ -0,0 +1,60 @@
|
||||
# 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 = (480, 480)
|
||||
|
||||
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))
|
||||
57
configs/_base_/datasets/pascal_voc12.py
Normal file
57
configs/_base_/datasets/pascal_voc12.py
Normal file
@ -0,0 +1,57 @@
|
||||
# dataset settings
|
||||
dataset_type = 'PascalVOCDataset'
|
||||
data_root = 'data/VOCdevkit/VOC2012'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (512, 512)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
dict(type='Resize', img_scale=(2048, 512), 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=(2048, 512),
|
||||
# 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='SegmentationClass',
|
||||
split='ImageSets/Segmentation/train.txt',
|
||||
pipeline=train_pipeline),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='JPEGImages',
|
||||
ann_dir='SegmentationClass',
|
||||
split='ImageSets/Segmentation/val.txt',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='JPEGImages',
|
||||
ann_dir='SegmentationClass',
|
||||
split='ImageSets/Segmentation/val.txt',
|
||||
pipeline=test_pipeline))
|
||||
9
configs/_base_/datasets/pascal_voc12_aug.py
Normal file
9
configs/_base_/datasets/pascal_voc12_aug.py
Normal file
@ -0,0 +1,9 @@
|
||||
_base_ = './pascal_voc12.py'
|
||||
# dataset settings
|
||||
data = dict(
|
||||
train=dict(
|
||||
ann_dir=['SegmentationClass', 'SegmentationClassAug'],
|
||||
split=[
|
||||
'ImageSets/Segmentation/train.txt',
|
||||
'ImageSets/Segmentation/aug.txt'
|
||||
]))
|
||||
54
configs/_base_/datasets/potsdam.py
Normal file
54
configs/_base_/datasets/potsdam.py
Normal file
@ -0,0 +1,54 @@
|
||||
# dataset settings
|
||||
dataset_type = 'PotsdamDataset'
|
||||
data_root = 'data/potsdam'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (512, 512)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations', reduce_zero_label=True),
|
||||
dict(type='Resize', img_scale=(512, 512), 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=(512, 512),
|
||||
# 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='img_dir/train',
|
||||
ann_dir='ann_dir/train',
|
||||
pipeline=train_pipeline),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='img_dir/val',
|
||||
ann_dir='ann_dir/val',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='img_dir/val',
|
||||
ann_dir='ann_dir/val',
|
||||
pipeline=test_pipeline))
|
||||
59
configs/_base_/datasets/stare.py
Normal file
59
configs/_base_/datasets/stare.py
Normal file
@ -0,0 +1,59 @@
|
||||
# dataset settings
|
||||
dataset_type = 'STAREDataset'
|
||||
data_root = 'data/STARE'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
img_scale = (605, 700)
|
||||
crop_size = (128, 128)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations'),
|
||||
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, 2.0],
|
||||
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='RepeatDataset',
|
||||
times=40000,
|
||||
dataset=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/training',
|
||||
ann_dir='annotations/training',
|
||||
pipeline=train_pipeline)),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/validation',
|
||||
ann_dir='annotations/validation',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='images/validation',
|
||||
ann_dir='annotations/validation',
|
||||
pipeline=test_pipeline))
|
||||
54
configs/_base_/datasets/vaihingen.py
Normal file
54
configs/_base_/datasets/vaihingen.py
Normal file
@ -0,0 +1,54 @@
|
||||
# dataset settings
|
||||
dataset_type = 'ISPRSDataset'
|
||||
data_root = 'data/vaihingen'
|
||||
img_norm_cfg = dict(
|
||||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
||||
crop_size = (512, 512)
|
||||
train_pipeline = [
|
||||
dict(type='LoadImageFromFile'),
|
||||
dict(type='LoadAnnotations', reduce_zero_label=True),
|
||||
dict(type='Resize', img_scale=(512, 512), 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=(512, 512),
|
||||
# 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='img_dir/train',
|
||||
ann_dir='ann_dir/train',
|
||||
pipeline=train_pipeline),
|
||||
val=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='img_dir/val',
|
||||
ann_dir='ann_dir/val',
|
||||
pipeline=test_pipeline),
|
||||
test=dict(
|
||||
type=dataset_type,
|
||||
data_root=data_root,
|
||||
img_dir='img_dir/val',
|
||||
ann_dir='ann_dir/val',
|
||||
pipeline=test_pipeline))
|
||||
14
configs/_base_/default_runtime.py
Normal file
14
configs/_base_/default_runtime.py
Normal file
@ -0,0 +1,14 @@
|
||||
# yapf:disable
|
||||
log_config = dict(
|
||||
interval=50,
|
||||
hooks=[
|
||||
dict(type='TextLoggerHook', by_epoch=False),
|
||||
# dict(type='TensorboardLoggerHook')
|
||||
])
|
||||
# yapf:enable
|
||||
dist_params = dict(backend='nccl')
|
||||
log_level = 'INFO'
|
||||
load_from = None
|
||||
resume_from = None
|
||||
workflow = [('train', 1)]
|
||||
cudnn_benchmark = True
|
||||
46
configs/_base_/models/ann_r50-d8.py
Normal file
46
configs/_base_/models/ann_r50-d8.py
Normal file
@ -0,0 +1,46 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='ANNHead',
|
||||
in_channels=[1024, 2048],
|
||||
in_index=[2, 3],
|
||||
channels=512,
|
||||
project_channels=256,
|
||||
query_scales=(1, ),
|
||||
key_pool_scales=(1, 3, 6, 8),
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
44
configs/_base_/models/apcnet_r50-d8.py
Normal file
44
configs/_base_/models/apcnet_r50-d8.py
Normal file
@ -0,0 +1,44 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='APCHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
pool_scales=(1, 2, 3, 6),
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=dict(type='SyncBN', requires_grad=True),
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
68
configs/_base_/models/bisenetv1_r18-d32.py
Normal file
68
configs/_base_/models/bisenetv1_r18-d32.py
Normal file
@ -0,0 +1,68 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
backbone=dict(
|
||||
type='BiSeNetV1',
|
||||
in_channels=3,
|
||||
context_channels=(128, 256, 512),
|
||||
spatial_channels=(64, 64, 64, 128),
|
||||
out_indices=(0, 1, 2),
|
||||
out_channels=256,
|
||||
backbone_cfg=dict(
|
||||
type='ResNet',
|
||||
in_channels=3,
|
||||
depth=18,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 1, 1),
|
||||
strides=(1, 2, 2, 2),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
init_cfg=None),
|
||||
decode_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=256,
|
||||
in_index=0,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=[
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
channels=64,
|
||||
num_convs=1,
|
||||
num_classes=19,
|
||||
in_index=1,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
channels=64,
|
||||
num_convs=1,
|
||||
num_classes=19,
|
||||
in_index=2,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
],
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
80
configs/_base_/models/bisenetv2.py
Normal file
80
configs/_base_/models/bisenetv2.py
Normal file
@ -0,0 +1,80 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained=None,
|
||||
backbone=dict(
|
||||
type='BiSeNetV2',
|
||||
detail_channels=(64, 64, 128),
|
||||
semantic_channels=(16, 32, 64, 128),
|
||||
semantic_expansion_ratio=6,
|
||||
bga_channels=128,
|
||||
out_indices=(0, 1, 2, 3, 4),
|
||||
init_cfg=None,
|
||||
align_corners=False),
|
||||
decode_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
in_index=0,
|
||||
channels=1024,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=[
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=16,
|
||||
channels=16,
|
||||
num_convs=2,
|
||||
num_classes=19,
|
||||
in_index=1,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=32,
|
||||
channels=64,
|
||||
num_convs=2,
|
||||
num_classes=19,
|
||||
in_index=2,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=64,
|
||||
channels=256,
|
||||
num_convs=2,
|
||||
num_classes=19,
|
||||
in_index=3,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
channels=1024,
|
||||
num_convs=2,
|
||||
num_classes=19,
|
||||
in_index=4,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
],
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
44
configs/_base_/models/ccnet_r50-d8.py
Normal file
44
configs/_base_/models/ccnet_r50-d8.py
Normal file
@ -0,0 +1,44 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='CCHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
recurrence=2,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
35
configs/_base_/models/cgnet.py
Normal file
35
configs/_base_/models/cgnet.py
Normal file
@ -0,0 +1,35 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', eps=1e-03, requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
backbone=dict(
|
||||
type='CGNet',
|
||||
norm_cfg=norm_cfg,
|
||||
in_channels=3,
|
||||
num_channels=(32, 64, 128),
|
||||
num_blocks=(3, 21),
|
||||
dilations=(2, 4),
|
||||
reductions=(8, 16)),
|
||||
decode_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=256,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=0,
|
||||
concat_input=False,
|
||||
dropout_ratio=0,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss',
|
||||
use_sigmoid=False,
|
||||
loss_weight=1.0,
|
||||
class_weight=[
|
||||
2.5959933, 6.7415504, 3.5354059, 9.8663225, 9.690899, 9.369352,
|
||||
10.289121, 9.953208, 4.3097677, 9.490387, 7.674431, 9.396905,
|
||||
10.347791, 6.3927646, 10.226669, 10.241062, 10.280587,
|
||||
10.396974, 10.055647
|
||||
])),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(sampler=None),
|
||||
test_cfg=dict(mode='whole'))
|
||||
44
configs/_base_/models/danet_r50-d8.py
Normal file
44
configs/_base_/models/danet_r50-d8.py
Normal file
@ -0,0 +1,44 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='DAHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
pam_channels=64,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
44
configs/_base_/models/deeplabv3_r50-d8.py
Normal file
44
configs/_base_/models/deeplabv3_r50-d8.py
Normal file
@ -0,0 +1,44 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='ASPPHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
dilations=(1, 12, 24, 36),
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
50
configs/_base_/models/deeplabv3_unet_s5-d16.py
Normal file
50
configs/_base_/models/deeplabv3_unet_s5-d16.py
Normal file
@ -0,0 +1,50 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained=None,
|
||||
backbone=dict(
|
||||
type='UNet',
|
||||
in_channels=3,
|
||||
base_channels=64,
|
||||
num_stages=5,
|
||||
strides=(1, 1, 1, 1, 1),
|
||||
enc_num_convs=(2, 2, 2, 2, 2),
|
||||
dec_num_convs=(2, 2, 2, 2),
|
||||
downsamples=(True, True, True, True),
|
||||
enc_dilations=(1, 1, 1, 1, 1),
|
||||
dec_dilations=(1, 1, 1, 1),
|
||||
with_cp=False,
|
||||
conv_cfg=None,
|
||||
norm_cfg=norm_cfg,
|
||||
act_cfg=dict(type='ReLU'),
|
||||
upsample_cfg=dict(type='InterpConv'),
|
||||
norm_eval=False),
|
||||
decode_head=dict(
|
||||
type='ASPPHead',
|
||||
in_channels=64,
|
||||
in_index=4,
|
||||
channels=16,
|
||||
dilations=(1, 12, 24, 36),
|
||||
dropout_ratio=0.1,
|
||||
num_classes=2,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
in_index=3,
|
||||
channels=64,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=2,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='slide', crop_size=256, stride=170))
|
||||
46
configs/_base_/models/deeplabv3plus_r50-d8.py
Normal file
46
configs/_base_/models/deeplabv3plus_r50-d8.py
Normal file
@ -0,0 +1,46 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='DepthwiseSeparableASPPHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
dilations=(1, 12, 24, 36),
|
||||
c1_in_channels=256,
|
||||
c1_channels=48,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
44
configs/_base_/models/dmnet_r50-d8.py
Normal file
44
configs/_base_/models/dmnet_r50-d8.py
Normal file
@ -0,0 +1,44 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='DMHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
filter_sizes=(1, 3, 5, 7),
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=dict(type='SyncBN', requires_grad=True),
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
46
configs/_base_/models/dnl_r50-d8.py
Normal file
46
configs/_base_/models/dnl_r50-d8.py
Normal file
@ -0,0 +1,46 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='DNLHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
dropout_ratio=0.1,
|
||||
reduction=2,
|
||||
use_scale=True,
|
||||
mode='embedded_gaussian',
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
31
configs/_base_/models/dpt_vit-b16.py
Normal file
31
configs/_base_/models/dpt_vit-b16.py
Normal file
@ -0,0 +1,31 @@
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='pretrain/vit-b16_p16_224-80ecf9dd.pth', # noqa
|
||||
backbone=dict(
|
||||
type='VisionTransformer',
|
||||
img_size=224,
|
||||
embed_dims=768,
|
||||
num_layers=12,
|
||||
num_heads=12,
|
||||
out_indices=(2, 5, 8, 11),
|
||||
final_norm=False,
|
||||
with_cls_token=True,
|
||||
output_cls_token=True),
|
||||
decode_head=dict(
|
||||
type='DPTHead',
|
||||
in_channels=(768, 768, 768, 768),
|
||||
channels=256,
|
||||
embed_dims=768,
|
||||
post_process_channels=[96, 192, 384, 768],
|
||||
num_classes=150,
|
||||
readout_type='project',
|
||||
input_transform='multiple_select',
|
||||
in_index=(0, 1, 2, 3),
|
||||
norm_cfg=norm_cfg,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=None,
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole')) # yapf: disable
|
||||
47
configs/_base_/models/emanet_r50-d8.py
Normal file
47
configs/_base_/models/emanet_r50-d8.py
Normal file
@ -0,0 +1,47 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='EMAHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=256,
|
||||
ema_channels=512,
|
||||
num_bases=64,
|
||||
num_stages=3,
|
||||
momentum=0.1,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
48
configs/_base_/models/encnet_r50-d8.py
Normal file
48
configs/_base_/models/encnet_r50-d8.py
Normal file
@ -0,0 +1,48 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='EncHead',
|
||||
in_channels=[512, 1024, 2048],
|
||||
in_index=(1, 2, 3),
|
||||
channels=512,
|
||||
num_codes=32,
|
||||
use_se_loss=True,
|
||||
add_lateral=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
|
||||
loss_se_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=True, loss_weight=0.2)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
32
configs/_base_/models/erfnet_fcn.py
Normal file
32
configs/_base_/models/erfnet_fcn.py
Normal file
@ -0,0 +1,32 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained=None,
|
||||
backbone=dict(
|
||||
type='ERFNet',
|
||||
in_channels=3,
|
||||
enc_downsample_channels=(16, 64, 128),
|
||||
enc_stage_non_bottlenecks=(5, 8),
|
||||
enc_non_bottleneck_dilations=(2, 4, 8, 16),
|
||||
enc_non_bottleneck_channels=(64, 128),
|
||||
dec_upsample_channels=(64, 16),
|
||||
dec_stages_non_bottleneck=(2, 2),
|
||||
dec_non_bottleneck_channels=(64, 16),
|
||||
dropout_ratio=0.1,
|
||||
init_cfg=None),
|
||||
decode_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=16,
|
||||
channels=128,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
57
configs/_base_/models/fast_scnn.py
Normal file
57
configs/_base_/models/fast_scnn.py
Normal file
@ -0,0 +1,57 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True, momentum=0.01)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
backbone=dict(
|
||||
type='FastSCNN',
|
||||
downsample_dw_channels=(32, 48),
|
||||
global_in_channels=64,
|
||||
global_block_channels=(64, 96, 128),
|
||||
global_block_strides=(2, 2, 1),
|
||||
global_out_channels=128,
|
||||
higher_in_channels=64,
|
||||
lower_in_channels=128,
|
||||
fusion_out_channels=128,
|
||||
out_indices=(0, 1, 2),
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False),
|
||||
decode_head=dict(
|
||||
type='DepthwiseSeparableFCNHead',
|
||||
in_channels=128,
|
||||
channels=128,
|
||||
concat_input=False,
|
||||
num_classes=19,
|
||||
in_index=-1,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1)),
|
||||
auxiliary_head=[
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
channels=32,
|
||||
num_convs=1,
|
||||
num_classes=19,
|
||||
in_index=-2,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=True, loss_weight=0.4)),
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=64,
|
||||
channels=32,
|
||||
num_convs=1,
|
||||
num_classes=19,
|
||||
in_index=-3,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=True, loss_weight=0.4)),
|
||||
],
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
53
configs/_base_/models/fastfcn_r50-d32_jpu_psp.py
Normal file
53
configs/_base_/models/fastfcn_r50-d32_jpu_psp.py
Normal file
@ -0,0 +1,53 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 2, 2),
|
||||
out_indices=(1, 2, 3),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
neck=dict(
|
||||
type='JPU',
|
||||
in_channels=(512, 1024, 2048),
|
||||
mid_channels=512,
|
||||
start_level=0,
|
||||
end_level=-1,
|
||||
dilations=(1, 2, 4, 8),
|
||||
align_corners=False,
|
||||
norm_cfg=norm_cfg),
|
||||
decode_head=dict(
|
||||
type='PSPHead',
|
||||
in_channels=2048,
|
||||
in_index=2,
|
||||
channels=512,
|
||||
pool_scales=(1, 2, 3, 6),
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=1,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
52
configs/_base_/models/fcn_hr18.py
Normal file
52
configs/_base_/models/fcn_hr18.py
Normal file
@ -0,0 +1,52 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://msra/hrnetv2_w18',
|
||||
backbone=dict(
|
||||
type='HRNet',
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
extra=dict(
|
||||
stage1=dict(
|
||||
num_modules=1,
|
||||
num_branches=1,
|
||||
block='BOTTLENECK',
|
||||
num_blocks=(4, ),
|
||||
num_channels=(64, )),
|
||||
stage2=dict(
|
||||
num_modules=1,
|
||||
num_branches=2,
|
||||
block='BASIC',
|
||||
num_blocks=(4, 4),
|
||||
num_channels=(18, 36)),
|
||||
stage3=dict(
|
||||
num_modules=4,
|
||||
num_branches=3,
|
||||
block='BASIC',
|
||||
num_blocks=(4, 4, 4),
|
||||
num_channels=(18, 36, 72)),
|
||||
stage4=dict(
|
||||
num_modules=3,
|
||||
num_branches=4,
|
||||
block='BASIC',
|
||||
num_blocks=(4, 4, 4, 4),
|
||||
num_channels=(18, 36, 72, 144)))),
|
||||
decode_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=[18, 36, 72, 144],
|
||||
in_index=(0, 1, 2, 3),
|
||||
channels=sum([18, 36, 72, 144]),
|
||||
input_transform='resize_concat',
|
||||
kernel_size=1,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=-1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
45
configs/_base_/models/fcn_r50-d8.py
Normal file
45
configs/_base_/models/fcn_r50-d8.py
Normal file
@ -0,0 +1,45 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
num_convs=2,
|
||||
concat_input=True,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
51
configs/_base_/models/fcn_unet_s5-d16.py
Normal file
51
configs/_base_/models/fcn_unet_s5-d16.py
Normal file
@ -0,0 +1,51 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained=None,
|
||||
backbone=dict(
|
||||
type='UNet',
|
||||
in_channels=3,
|
||||
base_channels=64,
|
||||
num_stages=5,
|
||||
strides=(1, 1, 1, 1, 1),
|
||||
enc_num_convs=(2, 2, 2, 2, 2),
|
||||
dec_num_convs=(2, 2, 2, 2),
|
||||
downsamples=(True, True, True, True),
|
||||
enc_dilations=(1, 1, 1, 1, 1),
|
||||
dec_dilations=(1, 1, 1, 1),
|
||||
with_cp=False,
|
||||
conv_cfg=None,
|
||||
norm_cfg=norm_cfg,
|
||||
act_cfg=dict(type='ReLU'),
|
||||
upsample_cfg=dict(type='InterpConv'),
|
||||
norm_eval=False),
|
||||
decode_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=64,
|
||||
in_index=4,
|
||||
channels=64,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=2,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
in_index=3,
|
||||
channels=64,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=2,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='slide', crop_size=256, stride=170))
|
||||
36
configs/_base_/models/fpn_r50.py
Normal file
36
configs/_base_/models/fpn_r50.py
Normal file
@ -0,0 +1,36 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 1, 1),
|
||||
strides=(1, 2, 2, 2),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
neck=dict(
|
||||
type='FPN',
|
||||
in_channels=[256, 512, 1024, 2048],
|
||||
out_channels=256,
|
||||
num_outs=4),
|
||||
decode_head=dict(
|
||||
type='FPNHead',
|
||||
in_channels=[256, 256, 256, 256],
|
||||
in_index=[0, 1, 2, 3],
|
||||
feature_strides=[4, 8, 16, 32],
|
||||
channels=128,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
46
configs/_base_/models/gcnet_r50-d8.py
Normal file
46
configs/_base_/models/gcnet_r50-d8.py
Normal file
@ -0,0 +1,46 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='GCHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
ratio=1 / 4.,
|
||||
pooling_type='att',
|
||||
fusion_types=('channel_add', ),
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
74
configs/_base_/models/icnet_r50-d8.py
Normal file
74
configs/_base_/models/icnet_r50-d8.py
Normal file
@ -0,0 +1,74 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
backbone=dict(
|
||||
type='ICNet',
|
||||
backbone_cfg=dict(
|
||||
type='ResNetV1c',
|
||||
in_channels=3,
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
in_channels=3,
|
||||
layer_channels=(512, 2048),
|
||||
light_branch_middle_channels=32,
|
||||
psp_out_channels=512,
|
||||
out_channels=(64, 256, 256),
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
),
|
||||
neck=dict(
|
||||
type='ICNeck',
|
||||
in_channels=(64, 256, 256),
|
||||
out_channels=128,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False),
|
||||
decode_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
channels=128,
|
||||
num_convs=1,
|
||||
in_index=2,
|
||||
dropout_ratio=0,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=[
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
channels=128,
|
||||
num_convs=1,
|
||||
num_classes=19,
|
||||
in_index=0,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
channels=128,
|
||||
num_convs=1,
|
||||
num_classes=19,
|
||||
in_index=1,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
],
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
45
configs/_base_/models/isanet_r50-d8.py
Normal file
45
configs/_base_/models/isanet_r50-d8.py
Normal file
@ -0,0 +1,45 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='ISAHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
isa_channels=256,
|
||||
down_factor=(8, 8),
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
25
configs/_base_/models/lraspp_m-v3-d8.py
Normal file
25
configs/_base_/models/lraspp_m-v3-d8.py
Normal file
@ -0,0 +1,25 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', eps=0.001, requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
backbone=dict(
|
||||
type='MobileNetV3',
|
||||
arch='large',
|
||||
out_indices=(1, 3, 16),
|
||||
norm_cfg=norm_cfg),
|
||||
decode_head=dict(
|
||||
type='LRASPPHead',
|
||||
in_channels=(16, 24, 960),
|
||||
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)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
46
configs/_base_/models/nonlocal_r50-d8.py
Normal file
46
configs/_base_/models/nonlocal_r50-d8.py
Normal file
@ -0,0 +1,46 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='NLHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
dropout_ratio=0.1,
|
||||
reduction=2,
|
||||
use_scale=True,
|
||||
mode='embedded_gaussian',
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
68
configs/_base_/models/ocrnet_hr18.py
Normal file
68
configs/_base_/models/ocrnet_hr18.py
Normal file
@ -0,0 +1,68 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='CascadeEncoderDecoder',
|
||||
num_stages=2,
|
||||
pretrained='open-mmlab://msra/hrnetv2_w18',
|
||||
backbone=dict(
|
||||
type='HRNet',
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
extra=dict(
|
||||
stage1=dict(
|
||||
num_modules=1,
|
||||
num_branches=1,
|
||||
block='BOTTLENECK',
|
||||
num_blocks=(4, ),
|
||||
num_channels=(64, )),
|
||||
stage2=dict(
|
||||
num_modules=1,
|
||||
num_branches=2,
|
||||
block='BASIC',
|
||||
num_blocks=(4, 4),
|
||||
num_channels=(18, 36)),
|
||||
stage3=dict(
|
||||
num_modules=4,
|
||||
num_branches=3,
|
||||
block='BASIC',
|
||||
num_blocks=(4, 4, 4),
|
||||
num_channels=(18, 36, 72)),
|
||||
stage4=dict(
|
||||
num_modules=3,
|
||||
num_branches=4,
|
||||
block='BASIC',
|
||||
num_blocks=(4, 4, 4, 4),
|
||||
num_channels=(18, 36, 72, 144)))),
|
||||
decode_head=[
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=[18, 36, 72, 144],
|
||||
channels=sum([18, 36, 72, 144]),
|
||||
in_index=(0, 1, 2, 3),
|
||||
input_transform='resize_concat',
|
||||
kernel_size=1,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=-1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
dict(
|
||||
type='OCRHead',
|
||||
in_channels=[18, 36, 72, 144],
|
||||
in_index=(0, 1, 2, 3),
|
||||
input_transform='resize_concat',
|
||||
channels=512,
|
||||
ocr_channels=256,
|
||||
dropout_ratio=-1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
],
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
47
configs/_base_/models/ocrnet_r50-d8.py
Normal file
47
configs/_base_/models/ocrnet_r50-d8.py
Normal file
@ -0,0 +1,47 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='CascadeEncoderDecoder',
|
||||
num_stages=2,
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=[
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
dict(
|
||||
type='OCRHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
ocr_channels=256,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0))
|
||||
],
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
56
configs/_base_/models/pointrend_r50.py
Normal file
56
configs/_base_/models/pointrend_r50.py
Normal file
@ -0,0 +1,56 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='CascadeEncoderDecoder',
|
||||
num_stages=2,
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 1, 1),
|
||||
strides=(1, 2, 2, 2),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
neck=dict(
|
||||
type='FPN',
|
||||
in_channels=[256, 512, 1024, 2048],
|
||||
out_channels=256,
|
||||
num_outs=4),
|
||||
decode_head=[
|
||||
dict(
|
||||
type='FPNHead',
|
||||
in_channels=[256, 256, 256, 256],
|
||||
in_index=[0, 1, 2, 3],
|
||||
feature_strides=[4, 8, 16, 32],
|
||||
channels=128,
|
||||
dropout_ratio=-1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
dict(
|
||||
type='PointHead',
|
||||
in_channels=[256],
|
||||
in_index=[0],
|
||||
channels=256,
|
||||
num_fcs=3,
|
||||
coarse_pred_each_layer=True,
|
||||
dropout_ratio=-1,
|
||||
num_classes=19,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0))
|
||||
],
|
||||
# model training and testing settings
|
||||
train_cfg=dict(
|
||||
num_points=2048, oversample_ratio=3, importance_sample_ratio=0.75),
|
||||
test_cfg=dict(
|
||||
mode='whole',
|
||||
subdivision_steps=2,
|
||||
subdivision_num_points=8196,
|
||||
scale_factor=2))
|
||||
49
configs/_base_/models/psanet_r50-d8.py
Normal file
49
configs/_base_/models/psanet_r50-d8.py
Normal file
@ -0,0 +1,49 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='PSAHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
mask_size=(97, 97),
|
||||
psa_type='bi-direction',
|
||||
compact=False,
|
||||
shrink_factor=2,
|
||||
normalization_factor=1.0,
|
||||
psa_softmax=True,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
44
configs/_base_/models/pspnet_r50-d8.py
Normal file
44
configs/_base_/models/pspnet_r50-d8.py
Normal file
@ -0,0 +1,44 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 2, 4),
|
||||
strides=(1, 2, 1, 1),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='PSPHead',
|
||||
in_channels=2048,
|
||||
in_index=3,
|
||||
channels=512,
|
||||
pool_scales=(1, 2, 3, 6),
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
50
configs/_base_/models/pspnet_unet_s5-d16.py
Normal file
50
configs/_base_/models/pspnet_unet_s5-d16.py
Normal file
@ -0,0 +1,50 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained=None,
|
||||
backbone=dict(
|
||||
type='UNet',
|
||||
in_channels=3,
|
||||
base_channels=64,
|
||||
num_stages=5,
|
||||
strides=(1, 1, 1, 1, 1),
|
||||
enc_num_convs=(2, 2, 2, 2, 2),
|
||||
dec_num_convs=(2, 2, 2, 2),
|
||||
downsamples=(True, True, True, True),
|
||||
enc_dilations=(1, 1, 1, 1, 1),
|
||||
dec_dilations=(1, 1, 1, 1),
|
||||
with_cp=False,
|
||||
conv_cfg=None,
|
||||
norm_cfg=norm_cfg,
|
||||
act_cfg=dict(type='ReLU'),
|
||||
upsample_cfg=dict(type='InterpConv'),
|
||||
norm_eval=False),
|
||||
decode_head=dict(
|
||||
type='PSPHead',
|
||||
in_channels=64,
|
||||
in_index=4,
|
||||
channels=16,
|
||||
pool_scales=(1, 2, 3, 6),
|
||||
dropout_ratio=0.1,
|
||||
num_classes=2,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
in_index=3,
|
||||
channels=64,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=2,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='slide', crop_size=256, stride=170))
|
||||
34
configs/_base_/models/segformer_mit-b0.py
Normal file
34
configs/_base_/models/segformer_mit-b0.py
Normal file
@ -0,0 +1,34 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained=None,
|
||||
backbone=dict(
|
||||
type='MixVisionTransformer',
|
||||
in_channels=3,
|
||||
embed_dims=32,
|
||||
num_stages=4,
|
||||
num_layers=[2, 2, 2, 2],
|
||||
num_heads=[1, 2, 5, 8],
|
||||
patch_sizes=[7, 3, 3, 3],
|
||||
sr_ratios=[8, 4, 2, 1],
|
||||
out_indices=(0, 1, 2, 3),
|
||||
mlp_ratio=4,
|
||||
qkv_bias=True,
|
||||
drop_rate=0.0,
|
||||
attn_drop_rate=0.0,
|
||||
drop_path_rate=0.1),
|
||||
decode_head=dict(
|
||||
type='SegformerHead',
|
||||
in_channels=[32, 64, 160, 256],
|
||||
in_index=[0, 1, 2, 3],
|
||||
channels=256,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
35
configs/_base_/models/segmenter_vit-b16_mask.py
Normal file
35
configs/_base_/models/segmenter_vit-b16_mask.py
Normal file
@ -0,0 +1,35 @@
|
||||
# model settings
|
||||
backbone_norm_cfg = dict(type='LN', eps=1e-6, requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='pretrain/vit_base_p16_384.pth',
|
||||
backbone=dict(
|
||||
type='VisionTransformer',
|
||||
img_size=(512, 512),
|
||||
patch_size=16,
|
||||
in_channels=3,
|
||||
embed_dims=768,
|
||||
num_layers=12,
|
||||
num_heads=12,
|
||||
drop_path_rate=0.1,
|
||||
attn_drop_rate=0.0,
|
||||
drop_rate=0.0,
|
||||
final_norm=True,
|
||||
norm_cfg=backbone_norm_cfg,
|
||||
with_cls_token=True,
|
||||
interpolate_mode='bicubic',
|
||||
),
|
||||
decode_head=dict(
|
||||
type='SegmenterMaskTransformerHead',
|
||||
in_channels=768,
|
||||
channels=768,
|
||||
num_classes=150,
|
||||
num_layers=2,
|
||||
num_heads=12,
|
||||
embed_dims=768,
|
||||
dropout_ratio=0.0,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
|
||||
),
|
||||
test_cfg=dict(mode='slide', crop_size=(512, 512), stride=(480, 480)),
|
||||
)
|
||||
95
configs/_base_/models/setr_mla.py
Normal file
95
configs/_base_/models/setr_mla.py
Normal file
@ -0,0 +1,95 @@
|
||||
# model settings
|
||||
backbone_norm_cfg = dict(type='LN', eps=1e-6, requires_grad=True)
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='pretrain/jx_vit_large_p16_384-b3be5167.pth',
|
||||
backbone=dict(
|
||||
type='VisionTransformer',
|
||||
img_size=(768, 768),
|
||||
patch_size=16,
|
||||
in_channels=3,
|
||||
embed_dims=1024,
|
||||
num_layers=24,
|
||||
num_heads=16,
|
||||
out_indices=(5, 11, 17, 23),
|
||||
drop_rate=0.1,
|
||||
norm_cfg=backbone_norm_cfg,
|
||||
with_cls_token=False,
|
||||
interpolate_mode='bilinear',
|
||||
),
|
||||
neck=dict(
|
||||
type='MLANeck',
|
||||
in_channels=[1024, 1024, 1024, 1024],
|
||||
out_channels=256,
|
||||
norm_cfg=norm_cfg,
|
||||
act_cfg=dict(type='ReLU'),
|
||||
),
|
||||
decode_head=dict(
|
||||
type='SETRMLAHead',
|
||||
in_channels=(256, 256, 256, 256),
|
||||
channels=512,
|
||||
in_index=(0, 1, 2, 3),
|
||||
dropout_ratio=0,
|
||||
mla_channels=128,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=[
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=256,
|
||||
channels=256,
|
||||
in_index=0,
|
||||
dropout_ratio=0,
|
||||
num_convs=0,
|
||||
kernel_size=1,
|
||||
concat_input=False,
|
||||
num_classes=19,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=256,
|
||||
channels=256,
|
||||
in_index=1,
|
||||
dropout_ratio=0,
|
||||
num_convs=0,
|
||||
kernel_size=1,
|
||||
concat_input=False,
|
||||
num_classes=19,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=256,
|
||||
channels=256,
|
||||
in_index=2,
|
||||
dropout_ratio=0,
|
||||
num_convs=0,
|
||||
kernel_size=1,
|
||||
concat_input=False,
|
||||
num_classes=19,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=256,
|
||||
channels=256,
|
||||
in_index=3,
|
||||
dropout_ratio=0,
|
||||
num_convs=0,
|
||||
kernel_size=1,
|
||||
concat_input=False,
|
||||
num_classes=19,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
],
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
80
configs/_base_/models/setr_naive.py
Normal file
80
configs/_base_/models/setr_naive.py
Normal file
@ -0,0 +1,80 @@
|
||||
# model settings
|
||||
backbone_norm_cfg = dict(type='LN', eps=1e-6, requires_grad=True)
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='pretrain/jx_vit_large_p16_384-b3be5167.pth',
|
||||
backbone=dict(
|
||||
type='VisionTransformer',
|
||||
img_size=(768, 768),
|
||||
patch_size=16,
|
||||
in_channels=3,
|
||||
embed_dims=1024,
|
||||
num_layers=24,
|
||||
num_heads=16,
|
||||
out_indices=(9, 14, 19, 23),
|
||||
drop_rate=0.1,
|
||||
norm_cfg=backbone_norm_cfg,
|
||||
with_cls_token=True,
|
||||
interpolate_mode='bilinear',
|
||||
),
|
||||
decode_head=dict(
|
||||
type='SETRUPHead',
|
||||
in_channels=1024,
|
||||
channels=256,
|
||||
in_index=3,
|
||||
num_classes=19,
|
||||
dropout_ratio=0,
|
||||
norm_cfg=norm_cfg,
|
||||
num_convs=1,
|
||||
up_scale=4,
|
||||
kernel_size=1,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=[
|
||||
dict(
|
||||
type='SETRUPHead',
|
||||
in_channels=1024,
|
||||
channels=256,
|
||||
in_index=0,
|
||||
num_classes=19,
|
||||
dropout_ratio=0,
|
||||
norm_cfg=norm_cfg,
|
||||
num_convs=1,
|
||||
up_scale=4,
|
||||
kernel_size=1,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
dict(
|
||||
type='SETRUPHead',
|
||||
in_channels=1024,
|
||||
channels=256,
|
||||
in_index=1,
|
||||
num_classes=19,
|
||||
dropout_ratio=0,
|
||||
norm_cfg=norm_cfg,
|
||||
num_convs=1,
|
||||
up_scale=4,
|
||||
kernel_size=1,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
dict(
|
||||
type='SETRUPHead',
|
||||
in_channels=1024,
|
||||
channels=256,
|
||||
in_index=2,
|
||||
num_classes=19,
|
||||
dropout_ratio=0,
|
||||
norm_cfg=norm_cfg,
|
||||
num_convs=1,
|
||||
up_scale=4,
|
||||
kernel_size=1,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4))
|
||||
],
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
80
configs/_base_/models/setr_pup.py
Normal file
80
configs/_base_/models/setr_pup.py
Normal file
@ -0,0 +1,80 @@
|
||||
# model settings
|
||||
backbone_norm_cfg = dict(type='LN', eps=1e-6, requires_grad=True)
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='pretrain/jx_vit_large_p16_384-b3be5167.pth',
|
||||
backbone=dict(
|
||||
type='VisionTransformer',
|
||||
img_size=(768, 768),
|
||||
patch_size=16,
|
||||
in_channels=3,
|
||||
embed_dims=1024,
|
||||
num_layers=24,
|
||||
num_heads=16,
|
||||
out_indices=(9, 14, 19, 23),
|
||||
drop_rate=0.1,
|
||||
norm_cfg=backbone_norm_cfg,
|
||||
with_cls_token=True,
|
||||
interpolate_mode='bilinear',
|
||||
),
|
||||
decode_head=dict(
|
||||
type='SETRUPHead',
|
||||
in_channels=1024,
|
||||
channels=256,
|
||||
in_index=3,
|
||||
num_classes=19,
|
||||
dropout_ratio=0,
|
||||
norm_cfg=norm_cfg,
|
||||
num_convs=4,
|
||||
up_scale=2,
|
||||
kernel_size=3,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=[
|
||||
dict(
|
||||
type='SETRUPHead',
|
||||
in_channels=1024,
|
||||
channels=256,
|
||||
in_index=0,
|
||||
num_classes=19,
|
||||
dropout_ratio=0,
|
||||
norm_cfg=norm_cfg,
|
||||
num_convs=1,
|
||||
up_scale=4,
|
||||
kernel_size=3,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
dict(
|
||||
type='SETRUPHead',
|
||||
in_channels=1024,
|
||||
channels=256,
|
||||
in_index=1,
|
||||
num_classes=19,
|
||||
dropout_ratio=0,
|
||||
norm_cfg=norm_cfg,
|
||||
num_convs=1,
|
||||
up_scale=4,
|
||||
kernel_size=3,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
dict(
|
||||
type='SETRUPHead',
|
||||
in_channels=1024,
|
||||
channels=256,
|
||||
in_index=2,
|
||||
num_classes=19,
|
||||
dropout_ratio=0,
|
||||
norm_cfg=norm_cfg,
|
||||
num_convs=1,
|
||||
up_scale=4,
|
||||
kernel_size=3,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
],
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
83
configs/_base_/models/stdc.py
Normal file
83
configs/_base_/models/stdc.py
Normal file
@ -0,0 +1,83 @@
|
||||
norm_cfg = dict(type='BN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained=None,
|
||||
backbone=dict(
|
||||
type='STDCContextPathNet',
|
||||
backbone_cfg=dict(
|
||||
type='STDCNet',
|
||||
stdc_type='STDCNet1',
|
||||
in_channels=3,
|
||||
channels=(32, 64, 256, 512, 1024),
|
||||
bottleneck_type='cat',
|
||||
num_convs=4,
|
||||
norm_cfg=norm_cfg,
|
||||
act_cfg=dict(type='ReLU'),
|
||||
with_final_conv=False),
|
||||
last_in_channels=(1024, 512),
|
||||
out_channels=128,
|
||||
ffm_cfg=dict(in_channels=384, out_channels=256, scale_factor=4)),
|
||||
decode_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=256,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
num_classes=19,
|
||||
in_index=3,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=True,
|
||||
sampler=dict(type='OHEMPixelSampler', thresh=0.7, min_kept=10000),
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=[
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
channels=64,
|
||||
num_convs=1,
|
||||
num_classes=19,
|
||||
in_index=2,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
sampler=dict(type='OHEMPixelSampler', thresh=0.7, min_kept=10000),
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
dict(
|
||||
type='FCNHead',
|
||||
in_channels=128,
|
||||
channels=64,
|
||||
num_convs=1,
|
||||
num_classes=19,
|
||||
in_index=1,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=False,
|
||||
sampler=dict(type='OHEMPixelSampler', thresh=0.7, min_kept=10000),
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
dict(
|
||||
type='STDCHead',
|
||||
in_channels=256,
|
||||
channels=64,
|
||||
num_convs=1,
|
||||
num_classes=2,
|
||||
boundary_threshold=0.1,
|
||||
in_index=0,
|
||||
norm_cfg=norm_cfg,
|
||||
concat_input=False,
|
||||
align_corners=True,
|
||||
loss_decode=[
|
||||
dict(
|
||||
type='CrossEntropyLoss',
|
||||
loss_name='loss_ce',
|
||||
use_sigmoid=True,
|
||||
loss_weight=1.0),
|
||||
dict(type='DiceLoss', loss_name='loss_dice', loss_weight=1.0)
|
||||
]),
|
||||
],
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
44
configs/_base_/models/twins_pcpvt-s_fpn.py
Normal file
44
configs/_base_/models/twins_pcpvt-s_fpn.py
Normal file
@ -0,0 +1,44 @@
|
||||
# model settings
|
||||
backbone_norm_cfg = dict(type='LN')
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
backbone=dict(
|
||||
type='PCPVT',
|
||||
init_cfg=dict(
|
||||
type='Pretrained', checkpoint='pretrained/pcpvt_small.pth'),
|
||||
in_channels=3,
|
||||
embed_dims=[64, 128, 320, 512],
|
||||
num_heads=[1, 2, 5, 8],
|
||||
patch_sizes=[4, 2, 2, 2],
|
||||
strides=[4, 2, 2, 2],
|
||||
mlp_ratios=[8, 8, 4, 4],
|
||||
out_indices=(0, 1, 2, 3),
|
||||
qkv_bias=True,
|
||||
norm_cfg=backbone_norm_cfg,
|
||||
depths=[3, 4, 6, 3],
|
||||
sr_ratios=[8, 4, 2, 1],
|
||||
norm_after_stage=False,
|
||||
drop_rate=0.0,
|
||||
attn_drop_rate=0.,
|
||||
drop_path_rate=0.2),
|
||||
neck=dict(
|
||||
type='FPN',
|
||||
in_channels=[64, 128, 320, 512],
|
||||
out_channels=256,
|
||||
num_outs=4),
|
||||
decode_head=dict(
|
||||
type='FPNHead',
|
||||
in_channels=[256, 256, 256, 256],
|
||||
in_index=[0, 1, 2, 3],
|
||||
feature_strides=[4, 8, 16, 32],
|
||||
channels=128,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=150,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
52
configs/_base_/models/twins_pcpvt-s_upernet.py
Normal file
52
configs/_base_/models/twins_pcpvt-s_upernet.py
Normal file
@ -0,0 +1,52 @@
|
||||
# model settings
|
||||
backbone_norm_cfg = dict(type='LN')
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
backbone=dict(
|
||||
type='PCPVT',
|
||||
init_cfg=dict(
|
||||
type='Pretrained', checkpoint='pretrained/pcpvt_small.pth'),
|
||||
in_channels=3,
|
||||
embed_dims=[64, 128, 320, 512],
|
||||
num_heads=[1, 2, 5, 8],
|
||||
patch_sizes=[4, 2, 2, 2],
|
||||
strides=[4, 2, 2, 2],
|
||||
mlp_ratios=[8, 8, 4, 4],
|
||||
out_indices=(0, 1, 2, 3),
|
||||
qkv_bias=True,
|
||||
norm_cfg=backbone_norm_cfg,
|
||||
depths=[3, 4, 6, 3],
|
||||
sr_ratios=[8, 4, 2, 1],
|
||||
norm_after_stage=False,
|
||||
drop_rate=0.0,
|
||||
attn_drop_rate=0.,
|
||||
drop_path_rate=0.2),
|
||||
decode_head=dict(
|
||||
type='UPerHead',
|
||||
in_channels=[64, 128, 320, 512],
|
||||
in_index=[0, 1, 2, 3],
|
||||
pool_scales=(1, 2, 3, 6),
|
||||
channels=512,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=150,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=320,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=150,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
44
configs/_base_/models/upernet_r50.py
Normal file
44
configs/_base_/models/upernet_r50.py
Normal file
@ -0,0 +1,44 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained='open-mmlab://resnet50_v1c',
|
||||
backbone=dict(
|
||||
type='ResNetV1c',
|
||||
depth=50,
|
||||
num_stages=4,
|
||||
out_indices=(0, 1, 2, 3),
|
||||
dilations=(1, 1, 1, 1),
|
||||
strides=(1, 2, 2, 2),
|
||||
norm_cfg=norm_cfg,
|
||||
norm_eval=False,
|
||||
style='pytorch',
|
||||
contract_dilation=True),
|
||||
decode_head=dict(
|
||||
type='UPerHead',
|
||||
in_channels=[256, 512, 1024, 2048],
|
||||
in_index=[0, 1, 2, 3],
|
||||
pool_scales=(1, 2, 3, 6),
|
||||
channels=512,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=1024,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
54
configs/_base_/models/upernet_swin.py
Normal file
54
configs/_base_/models/upernet_swin.py
Normal file
@ -0,0 +1,54 @@
|
||||
# model settings
|
||||
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
||||
backbone_norm_cfg = dict(type='LN', requires_grad=True)
|
||||
model = dict(
|
||||
type='EncoderDecoder',
|
||||
pretrained=None,
|
||||
backbone=dict(
|
||||
type='SwinTransformer',
|
||||
pretrain_img_size=224,
|
||||
embed_dims=96,
|
||||
patch_size=4,
|
||||
window_size=7,
|
||||
mlp_ratio=4,
|
||||
depths=[2, 2, 6, 2],
|
||||
num_heads=[3, 6, 12, 24],
|
||||
strides=(4, 2, 2, 2),
|
||||
out_indices=(0, 1, 2, 3),
|
||||
qkv_bias=True,
|
||||
qk_scale=None,
|
||||
patch_norm=True,
|
||||
drop_rate=0.,
|
||||
attn_drop_rate=0.,
|
||||
drop_path_rate=0.3,
|
||||
use_abs_pos_embed=False,
|
||||
act_cfg=dict(type='GELU'),
|
||||
norm_cfg=backbone_norm_cfg),
|
||||
decode_head=dict(
|
||||
type='UPerHead',
|
||||
in_channels=[96, 192, 384, 768],
|
||||
in_index=[0, 1, 2, 3],
|
||||
pool_scales=(1, 2, 3, 6),
|
||||
channels=512,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
||||
auxiliary_head=dict(
|
||||
type='FCNHead',
|
||||
in_channels=384,
|
||||
in_index=2,
|
||||
channels=256,
|
||||
num_convs=1,
|
||||
concat_input=False,
|
||||
dropout_ratio=0.1,
|
||||
num_classes=19,
|
||||
norm_cfg=norm_cfg,
|
||||
align_corners=False,
|
||||
loss_decode=dict(
|
||||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
||||
# model training and testing settings
|
||||
train_cfg=dict(),
|
||||
test_cfg=dict(mode='whole'))
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user