GDSCNN模型有一般的语义分割模型的常规流,并且在这基础上增加了形状流。常规流和正常的语义分割模型一样,而形状流则是对图片进行边缘检测,这样增加边缘检测可以使语义分割准确率提高,效果更好。
论文: Gated-SCNN: Gated Shape CNNs for Semantic Segmentation
模型包括
常规流:使用wider_resnet进行语义分割。
形状流:利用常规流分割过程中的结果,对图片进行边缘检测。
融合模块:将常规流分割得到的结果和形状流边缘检测的结果进行融合,得到分割图片。
used Dataset :Cityscape Dataset Website
It contains 5,000 finely annotated images split into training, validation and testing sets with 2,975, 500, and 1,525 images respectively.
pip install -r requirements.txt
gscnn
├─ README.md # descriptions
├── datasetsnew
├─ cityscapes.py # Cityscapes Class
├── cityscpes_lables.py # Cityscapes_labels
├── data_transform.py # data_transform
├── edge_utils.py # preprocess edge
└─ setup_data.py # preprocess data
├── my_functionals
├─ custom_functional.py # loss function
├─ DualTaskLoss.py # the forth loss
└─ GatedSpatialConv.py # gatedspatialconv
├──network
├─ gscnn.py # main network
├─ mynn.py # batchnorm
├─ Resnet.py # resnet
├─ wider_resnet.py # wider resnet
├──uuu
├─ AttrDict.py # config dict
└─ misc.py # method_meter
├─ generatorloss.py # generate loss
├ loss.py # define loss
└─ trainonestep.py # trainonestepcell
├─ train_onestep.py # train
├─ eval.py # eval
├─ config.py # config
数据预处理、训练、评估的相关参数在train.py
等文件
数据预处理相关参数
data_root 预处理前加载原始数据集目录
batchsize batchsize大小
train_dataset 训练集
val_dataset 测试集
训练和模型相关参数
lr 学习率
edge_weight 边缘loss的权重
seg_weight 分割loss的权重
att_weight 第三个loss的权重
dual_weight 融合loss的权重
max_epoch 训练的epoch数目
评估相关参数
model_path ckpt文件
data_root 测试集路径
配置相关参数
device_traget 硬件,只支持ASCEND
device_id 设备号
数据预处理运行示例:
python setup.py
进行数据预处理并加载到dataloader
运行示例:
python train_onestep.py
参数:
device_id 可用机器数目
lr 学习率
edge_weight 边缘loss的权重
seg_weight 分割loss的权重
att_weight 第三个loss的权重
dual_weight 融合loss的权重
max_epoch 训练的epoch数目
上述命令将在后台运行,可以通过train.log查看结果
运行示例:
python eval.py
参数:
model_path ckpt文件
data_root 测试集路径
参数 | gscnn |
---|---|
资源 | Ascend910 |
上传日期 | 2022-11-20 |
MindSpore版本 | 1.7.1 |
数据集 | Cityscapes |
训练参数 | 8p, epoch = 225, batch_size = 2, lr=0.001 |
优化器 | SGD |
损失函数 | JointEdgeSegLoss(seg_loss, edge_loss, dual_loss) |
输出 | mean_iu(55.15%) |
损失值 | 1.58 |
运行速度 | 8p 4180 ms/step |
训练总时间 | 8p 约66h |
随机性主要来自下面两点:
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》