本文轉(zhuǎn)載至知乎ID:Charles(白露未晞)知乎個人專欄
下載W3Cschool手機App,0基礎隨時隨地學編程>>戳此了解
導語
本文轉(zhuǎn)載至知乎ID:Charles(白露未晞)知乎個人專欄
下載W3Cschool手機App,0基礎隨時隨地學編程>>戳此了解
Hi~~~
“浮云一別后,流水十年間。”忙忙碌碌中發(fā)現(xiàn)又有多日沒有更新公眾號了,過來更一發(fā)~~~
【下個月再開始推一些爬蟲相關(guān)的內(nèi)容吧,這個月確實沒什么時間?!?/p>
利用全卷積網(wǎng)絡+濾波器實現(xiàn)細胞檢測。
讓我們愉快地開始吧!
相關(guān)文件
百度網(wǎng)盤下載鏈接: https://pan.baidu.com/s/16W2uByTpThAH8GUrv7pOZg
密碼: 5f5k
開發(fā)工具
Python版本:3.6.4
相關(guān)模塊:
numpy模塊;
PIL模塊;
scipy模塊;
TensorFlow-GPU模塊;
tensorlayer模塊;
matplotlib模塊;
以及一些Python自帶的模塊。
TensorFlow-GPU版本:
1.6.0
測試平臺:
Windows10
環(huán)境搭建
安裝Python并添加到環(huán)境變量,pip安裝需要的相關(guān)模塊即可。
其中,TensorFlow-GPU的環(huán)境搭建請自行參考相關(guān)的網(wǎng)絡教程,注意版本和驅(qū)動嚴格對應即可。
原理簡介
利用簡單的全卷積網(wǎng)絡+高斯和統(tǒng)計排序濾波器實現(xiàn)的細胞檢測算法。
其中全卷積網(wǎng)絡的結(jié)構(gòu)為:

訓練集包含6種類型的細胞圖像:
(依據(jù)其中心進行分類)
(1)細胞重疊:

(2)非目標細胞:

(3)細胞邊緣

(4)細胞間隙:

(5)背景:

(6)細胞中心點:

T_T相信聰明的小伙伴已經(jīng)猜到了:
我們采用的細胞檢測算法其實就是利用滑動窗口遍歷給定的圖像,把每個窗口的圖像感受野輸入到訓練好的網(wǎng)絡,判斷該窗口的中心是否為細胞中心,若是則標出。該思想類似于RCNN,不過我們對檢測結(jié)果加了濾波器來提高其精度。
至于具體實現(xiàn)過程,詳見相關(guān)文件中的源代碼。
使用演示
模型訓練:
在cmd窗口運行train.py文件即可。
相關(guān)文件中提供了原始數(shù)據(jù)集和轉(zhuǎn)為tfrecords格式的數(shù)據(jù)集。訓練只需使用tfrecords格式的數(shù)據(jù)集即可。若想自己生成,則將下圖中的注釋去掉,并將該函數(shù)中的原始數(shù)據(jù)集路徑修改為你自己的數(shù)據(jù)集路徑:

訓練效果圖:

模型測試:
相關(guān)文件中提供了訓練好的模型,在cmd窗口運行test.py文件即可,運行前請自行修改該文件內(nèi)的測試圖像路徑:

效果展示
原圖像1:

檢測效果1(注意紅點):

原圖像2:

檢測效果2:

That'all~~~
更多
模型設計的比較簡單,效率比較低。之后會推送一些高端點的算法~~~
代碼截止2018-05-30測試無誤。