同步操作将从 PaddlePaddle/PaddleSeg 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
The implementation of Hierarchical Multi-Scale Attention based on PaddlePaddle. [Paper]
Based on the above work, we made some optimizations:
We achieve mIoU of 87% on Cityscapes validation set.
The actual effect is as follows (for high-definition pictures, please click here).
System Requirements:
Highly recommend you install the GPU version of PaddlePaddle, due to large overhead of segmentation models, otherwise it could be out of memory while running the models. For more detailed installation tutorials, please refer to the official website of PaddlePaddle。
You should use API Calling method to install PaddleSeg for flexible development.
pip install paddleseg
Download following files and put into data/cityscapes
directory. Then unzip these files.
mkdir -p data/cityscapes
Firstly please download 3 files from Cityscapes dataset
Run the following commands to do the label conversion:
pip install cityscapesscripts
python ../../tools/convert_cityscapes.py --cityscapes_path data/cityscapes --num_workers 8
Where 'cityscapes_path' should be adjusted according to the actual dataset path. 'num_workers' determines the number of processes started and the size can be adjusted according to the actual situation.
Then download and uncompress Autolabelled-Data from google drive
Delete useless tmp
directory in refinement_final
directory.
rm -r tmp/
Convert autolabelled data according to PaddleSeg data format:
python tools/convert_cityscapes_autolabeling.py --dataset_root data/cityscapes/
Finally, you need to organize data following the below structure.
cityscapes
|
|--leftImg8bit
| |--train
| |--val
| |--test
|
|--gtFine
| |--train
| |--val
| |--test
|
|--leftImg8bit_trainextra
| |--leftImg8bit
| |--train_extra
| |--augsburg
| |--bayreuth
| |--...
|
|--convert_autolabelled
| |--augsburg
| |--bayreuth
| |--...
mkdir -p saved_model && cd saved_model
wget https://bj.bcebos.com/paddleseg/dygraph/cityscapes/mscale_ocr_hrnetw48_cityscapes_autolabel_mapillary/model.pdparams
cd ..
Model | Backbone | mIoU | mIoU (flip) | mIoU (5 scales + flip) |
---|---|---|---|---|
MscaleOCRNet | HRNet_w48 | 86.89% | 86.99% | 87.00% |
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python -u -m paddle.distributed.launch val.py \
--config configs/mscale_ocr_cityscapes_autolabel_mapillary.yml --num_workers 3 --model_path saved_model/model.pdparams
The reported mIoU should be 86.89. This evaluates with scales of 0.5, 1.0 and 2.0. This requires 14.2GB of GPU memory.
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python -u -m paddle.distributed.launch val.py \
--config configs/mscale_ocr_cityscapes_autolabel_mapillary.yml --num_workers 3 --model_path saved_model/model.pdparams \
--aug_eval --flip_horizontal
The reported mIoU should be 86.99. This evaluates with scales of 0.5, 1.0, 2.0 and flip horizontal. This requires 14.2GB of GPU memory.
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python -u -m paddle.distributed.launch val.py \
--config configs/mscale_ocr_cityscapes_autolabel_mapillary_ms_val.yml --num_workers 3 --model_path saved_model/model.pdparams \
--aug_eval --flip_horizontal
The reported mIoU should be 87.00. This evaluates with scales of 0.5, 1.0, 1.5, 2.0, 2.5 and flip horizontal. This requires 21.2GB of GPU memory.
mkdir -p pretrain && cd pretrain
wget https://bj.bcebos.com/paddleseg/dygraph/cityscapes/ocrnet_hrnetw48_mapillary/pretrained.pdparams
cd ..
Pretrained weights were obtained by pretraining on the Mapillary dataset from OCRNet (backbone is HRNet w48).
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python -u -m paddle.distributed.launch train.py \
--config configs/mscale_ocr_cityscapes_autolabel_mapillary.yml --use_vdl \
--save_dir saved_model/mscale_ocr_cityscapes_autolabel_mapillary --save_interval 2000 --num_workers 5 --do_eval
Note that this requires 32GB of GPU memory. You can remove argument --do_eval
to turn off evaluation during training, thus it only requires 25GB of GPU memory.
If you run out of memory, try to lower the crop size.
Please refer to
Thanks for their contributions!
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。