Adaptive Pyramid Context Network (APCNet) for semantic segmentation. APCNet adaptively constructs multi-scale contextual representations with multiple well-designed Adaptive Context Modules (ACMs). Specifically, each ACM leverages a global image representation as a guidance to estimate the local affinity coefficients for each sub-region. And then calculates a context vector with these affinities.
pip3 install -r requirements.txt
python3 setup.py build && cp build/lib.linux*/mmcv/_ext.cpython* mmcv
Go to visit Cityscapes official website, then choose 'Download' to download the Cityscapes dataset.
Specify /path/to/cityscapes
to your Cityscapes path in later training process, the unzipped dataset path structure sholud look like:
cityscapes/
├── gtFine
│ ├── test
│ ├── train
│ │ ├── aachen
│ │ └── bochum
│ └── val
│ ├── frankfurt
│ ├── lindau
│ └── munster
└── leftImg8bit
├── train
│ ├── aachen
│ └── bochum
└── val
├── frankfurt
├── lindau
└── munster
mkdir -p data/
ln -s /path/to/cityscapes data/cityscapes
The available configs are as follows:
# VOC2012
apcnet_r50-d8_512x512_1k_voc.py
apcnet_r50-d8_512x512_20k_voc
# ADE
apcnet_r50-d8_512x512_80k_ade20k
apcnet_r50-d8_512x512_160k_ade20k
apcnet_r101-d8_512x512_80k_ade20k
apcnet_r101-d8_512x512_160k_ade20k
# CityScapes
apcnet_r50-d8_512x1024_1k_cityscapes
apcnet_r50-d8_512x1024_40k_cityscapes
apcnet_r50-d8_512x1024_80k_cityscapes
apcnet_r50-d8_769x769_40k_cityscapes
apcnet_r50-d8_769x769_80k_cityscapes
apcnet_r101-d8_512x1024_40k_cityscapes
apcnet_r101-d8_512x1024_80k_cityscapes
apcnet_r101-d8_769x769_40k_cityscapes
apcnet_r101-d8_769x769_80k_cityscapes
bash train.sh <config file> [training args] # config file can be found in the configs directory
bash train_dist.sh <config file> <num_gpus> [training args] # config file can be found in the configs directory
bash train_dist.sh configs/apcnet/apcnet_r50-d8_512x1024_40k_cityscapes.py 8
# the dir to save logs and models
work-dir: str = None
# the checkpoint file to load weights from
load-from: str = None
# the checkpoint file to resume from
resume-from: str = None
# whether not to evaluate the checkpoint during training
no-validate: bool = False
# (Deprecated, please use --gpu-id) number of gpus to
# use (only applicable to non-distributed training)
gpus: int = None
# (Deprecated, please use --gpu-id) ids of gpus to use
# (only applicable to non-distributed training)
gpu-ids: int = None
# id of gpu to use (only applicable to non-distributed training)
gpu-id: int = 0
# random seed
seed: int = None
# Whether or not set different seeds for different ranks
diff_seed: bool = False
# whether to set deterministic options for CUDNN backend.
deterministic: bool = False
# --options is deprecated in favor of --cfg_options' and it
# will not be supported in version v0.22.0. Override some
# settings in the used config, the key-value pair in xxx=yyy
# format will be merged into config file. If the value to be
# overwritten is a list, it should be like key="[a,b]" or key=a,b
# It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]"
# Note that the quotation marks are necessary and that no white space
# is allowed.
options: str = None
# override some settings in the used config, the key-value pair
# in xxx=yyy format will be merged into config file. If the value
# to be overwritten is a list, it should be like key="[a,b]" or key=a,b
# It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]"
# Note that the quotation marks are necessary and that no white
# space is allowed.
cfg-options: str = None
# job launcher
launcher: str = "none"
# local rank
local_rank: int = 0
# distributed backend
dist_backend: str = None
# resume from the latest checkpoint automatically.
auto-resume: bool = False
Method | Backbone | Crop Size | Lr schd | Mem (GB) | mIoU (BI x 4) |
---|---|---|---|---|---|
APCNet | R-50-D8 | 512x1024 | 40000 | 7.7 | 77.53 |
Method | Backbone | Crop Size | Lr schd | Mem (GB) | mIoU (BI x 4) |
---|---|---|---|---|---|
APCNet | R-50-D8 | 512x512 | 1000 | 20.1 | 66.63 |
APCNet | R-50-D8 | 512x512 | 20000 | 20.1 | 69.68 |
-Ref: https://mmsegmentation.readthedocs.io/en/latest/dataset_prepare.html#cityscapes -Ref: Author Results -Ref: https://github.com/open-mmlab/mmsegmentation
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。