segnet分割网络的地址说明:http://mi.eng.cam.ac.uk/projects/segnet/tutorial.html
在这个里面主要讲解如何使用segnet以及每一步的步骤,对于里面所介绍的只有一些关键部分,对于一些细节有点缺失,博主将会一步一步的说明一下如何利用segnet对自己的数据进行分割。
segnet代码的github地址:https://github.com/alexgkendall/SegNet-Tutorial
一些博文对segnet的讲解
(1)http://blog.csdn.net/fate_fjh/article/details/53467948
(2)http://blog.csdn.net/u014451076/article/details/70741629
首先对原来segnet网络实验的说明:
/SegNet/
CamVid/
test/
testannot/
train/
trainannot/
test.txt
train.txt
Models/
# SegNet and SegNet-Basic model files for training and testing
Scripts/
compute_bn_statistics.py
test_segmentation_camvid.py
caffe-segnet/
# caffe implementation
这些是对用到的github公布的segnet代码的一个介绍。大家可以按步骤看一下
之后的操作,(1)创建训练所用的list,即train.txt,test.txt这两个文件,这两个文件的生成方法代码我在下一个博文里面写;
(2)开始训练,用到的文件:segnet_train.prototxt,segnet_solver.prototxt。
(3)训练,三种形式
1 ./SegNet/caffe-segnet/build/tools/caffe train -gpu 0 -solver /SegNet/Models/segnet_solver.prototxt # This will begin training SegNet on GPU 0
2 ./SegNet/caffe-segnet/build/tools/caffe train -gpu 0 -solver /SegNet/Models/segnet_basic_solver.prototxt # This will begin training SegNet-Basic on GPU 0
3 ./SegNet/caffe-segnet/build/tools/caffe train -gpu 0 -solver /SegNet/Models/segnet_solver.prototxt -weights /SegNet/Models/VGG_ILSVRC_16_layers.caffemodel # This will begin training SegNet on GPU 0 with a pretrained encoder
不要忘了建立保存,训练模型的地方
(4)测试,测试有点小烦,主要用的文件有:compute_bn_statistics.py,test_segmentation_camvid.py这连个文件会中的compute_bn_statistics.py会生成test_weights.caffemodel,生成的命令语句如下:
1、python /Segnet/Scripts/compute_bn_statistics.py /SegNet/Models/segnet_train.prototxt /SegNet/Models/Training/segnet_iter_10000.caffemodel /Segnet/Models/Inference/ # compute BN statistics for SegNet
2、python /Segnet/Scripts/compute_bn_statistics.py /SegNet/Models/segnet_basic_train.prototxt /SegNet/Models/Training/segnet_basic_iter_10000.caffemodel /Segnet/Models/Inference/ # compute BN statistics for SegNet-Basic
(5)显示测试结果,文件有test_segmentation_camvid.py,segnet_inference.prototxt ,test_weights.caffemodel,命令如下
1、python /SegNet/Scripts/test_segmentation_camvid.py --model /SegNet/Models/segnet_inference.prototxt --weights /SegNet/Models/Inference/test_weights.caffemodel --iter 233 # Test SegNet
2、python /SegNet/Scripts/test_segmentation_camvid.py --model /SegNet/Models/segnet_basic_inference.prototxt --weights /SegNet/Models/Inference/test_weights.caffemodel --iter 233 # Test SegNetBasic
按照上面步骤大家就可以看见官网公布的数据以及网络的结果喽。下一篇博客讲解自己的数据是如何从头开始操作。