本文轉(zhuǎn)載至知乎ID:Charles(白露未晞)知乎個人專欄
下載W3Cschool手機(jī)App,0基礎(chǔ)隨時(shí)隨地學(xué)編程>>戳此了解
導(dǎo)語
本文轉(zhuǎn)載至知乎ID:Charles(白露未晞)知乎個人專欄
下載W3Cschool手機(jī)App,0基礎(chǔ)隨時(shí)隨地學(xué)編程>>戳此了解
Hi~~~
“浮云一別后,流水十年間?!泵γβ德抵邪l(fā)現(xiàn)又有多日沒有更新公眾號了,過來更一發(fā)~~~
【下個月再開始推一些爬蟲相關(guān)的內(nèi)容吧,這個月確實(shí)沒什么時(shí)間?!?/p>
利用全卷積網(wǎng)絡(luò)+濾波器實(shí)現(xiàn)細(xì)胞檢測。
讓我們愉快地開始吧!
相關(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)絡(luò)教程,注意版本和驅(qū)動嚴(yán)格對應(yīng)即可。
原理簡介
利用簡單的全卷積網(wǎng)絡(luò)+高斯和統(tǒng)計(jì)排序?yàn)V波器實(shí)現(xiàn)的細(xì)胞檢測算法。
其中全卷積網(wǎng)絡(luò)的結(jié)構(gòu)為:

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

(2)非目標(biāo)細(xì)胞:

(3)細(xì)胞邊緣

(4)細(xì)胞間隙:

(5)背景:

(6)細(xì)胞中心點(diǎn):

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

訓(xùn)練效果圖:

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

效果展示
原圖像1:

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

原圖像2:

檢測效果2:

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