pytorch上实现语义分割网络bisenet

语义分割方向新近提出来的网络大概是deeplabv3+bisenet,在18年2月和8月先后被提出。

无条件相信google,于是直觉上认为deeplabv3+更靠谱。?

看paper的话,bisenet准确率更低,速度更快。

deeplabv3+之前已经实现,现在来对bisenet进行实现。

我的环境:

anaconda3
pytorch-gpu 1.0

文章目录

  • 模型
  • 数据集
  • 训练
  • 验证


分别找到tensorflowpytorch的版本:

tf: https://github.com/GeorgeSeif/Semantic-Segmentation-Suite
pt: https://github.com/CoinCheung/BiSeNet

But George said “This repo has been depricated and will no longer be handling issues. Feel free to use as is ?” so我这边选择pt版本。


模型

下载模型文件:

git clone https://github.com/CoinCheung/BiSeNet.git

数据集

实现过程使用Cityscapes Dataset作为数据集。
从www.cityscapes-dataset.com上下载Cityscapes Dataset——数据集leftImg8bit_trainvaltest.zip (11GB)和对应的标注集gtFine_trainvaltest.zip (241MB)。下载完成后解压到路径BiSeNet/data/,目录结构:

BiSeNet/data/

  • gtFine
  • leftImg8bit

训练

在路径BiSeNet/下:

CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 train.py

会出现:

it: 79500/80000, lr: 0.000105, loss: 2.3915, eta: 0:06:58, time: 41.0036
it: 79550/80000, lr: 0.000096, loss: 2.4082, eta: 0:06:16, time: 40.9691
it: 79600/80000, lr: 0.000086, loss: 2.3882, eta: 0:05:34, time: 40.9198
it: 79650/80000, lr: 0.000076, loss: 2.4236, eta: 0:04:53, time: 43.7076
it: 79700/80000, lr: 0.000067, loss: 2.3925, eta: 0:04:11, time: 40.7097
it: 79750/80000, lr: 0.000056, loss: 2.4639, eta: 0:03:29, time: 40.9966
it: 79800/80000, lr: 0.000046, loss: 2.4212, eta: 0:02:47, time: 43.6417
it: 79850/80000, lr: 0.000036, loss: 2.4144, eta: 0:02:06, time: 40.9328
it: 79900/80000, lr: 0.000025, loss: 2.4603, eta: 0:01:24, time: 40.9232
it: 79950/80000, lr: 0.000013, loss: 2.3965, eta: 0:00:42, time: 40.9462
it: 80000/80000, lr: 0.000000, loss: 2.4537, eta: 0:00:00, time: 43.6481
training done, model saved to: ./res/model_final.pth


================================================================================
evaluating the model ...

setup and restore model
  0%|                                                   | 0/100 [00:00<?, ?it/s]
compute the mIOU
100%|█████████████████████████████████████████| 100/100 [18:32<00:00, 10.92s/it]
mIOU is: 0.786584

验证

在路径BiSeNet/下:

python evaluate.py

会出现:

================================================================================
evaluating the model ...

setup and restore model
compute the mIOU
100%|█████████████████████████████████████████| 100/100 [17:14<00:00, 10.30s/it]
mIOU is: 0.784525

你可能感兴趣的:(语义分割,pytorch,语义分割,pytorch,bisenet)