chainerCV教程二︱7行代碼chainerCV實現圖像分割SegNet
碼雲鏈接:https://gitee.com/mattzheng/chainercv_SegNet/tree/master
github鏈接:https://github.com/mattzheng/chainer_SegNet
相關code都放在上面了.
1、 圖像分割SegNet相關參考
github鏈接:https://github.com/chainer/chainercv
官方文檔鏈接:http://chainercv.readthedocs.io/en/stable/index.html
預訓練模型下載頁面:https://github.com/yuyu2172/share-weights/releases/
SegNet參考的caffe實現及預訓練模型:http://mi.eng.cam.ac.uk/projects/segnet/tutorial.html
由chainercv自帶的預訓練模型
採用的數據集為:camvid
數據集類別camvid_label_names:』Sky』, 『Building』, 『Pole』, 『Road』, 『Pavement』, 『Tree』, 『SignSymbol』, 『Fence』, 『Car』, 『Pedestrian』, 『Bicyclist』
不同類別的顏色camvid_label_colors:(128, 128, 128), (128, 0, 0), (192, 192, 128), (128, 64, 128), (60, 40, 222), (128, 128, 0), (192, 128, 128), (64, 64, 128), (64, 0, 128), (64, 64, 0), (0, 128, 192)
其中需要注意的是:
(1)』pip install chainercv』好像沒有load進去vis_semantic_segmentation模塊,所以我的做法是從github中加到:/usr/local/lib/python3.5/dist-packages/chainercv/visualizations目錄下(github該模塊鏈接:https://github.com/chainer/chainercv/tree/master/chainercv/visualizations)
(2)讀圖的時候,注意最好使用chainercv自帶的讀入函數utils.read_image
code展示:
SegNetBasic函數解析(來源文檔):
camvid數據是類別較少的分類。
SegNetBasic(n_class=None, pretrained_model=None, initialW=None)函數,有三個參數,n_class是預訓練模型的參數,pretrained_model是預訓練模型位置
predict(imgs),imgs輸入array的list
.
2、自己訓練segnet模型
其他的,如果你要自己訓練segnet模型,請參考該頁面
First, move to this directory (i.e., examples/segnet) and run:
一個使用的demo:
模型評估的函數:
官方自帶的一個預訓練模型後的模型使用demo


TAG:素質雲筆記 |