當前位置:
首頁 >
深度学习笔记7 Working with Large Images 卷积特征提取
發布時間:2025/4/16
105
豆豆
生活随笔
收集整理的這篇文章主要介紹了
深度学习笔记7 Working with Large Images 卷积特征提取
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
動機
在用稀疏自編碼器對8*8 或28*28等小圖像提取特征時是可行的,但是若對大圖像學習整幅圖像的特征,將會非常耗時。因此需要把這種“全連接”的設計改為“部分聯通”的網絡。
卷積
自然圖像有其固有特性——圖像的一部分統計特征與其他部分是一樣的,這也意味著我們在這一部分上學習的特征也能用在另一部分上,所以對這個圖像上的所以位置,我們都能使用同樣的學習特征。
比如,可以8*8的樣本中學習到一些特征,并把這個特征應用到圖像的任意地方去。特別是,我們可以從8*8的樣本中學習的特征跟原來的大尺寸圖像做卷積。
池化
得到的卷積特征就可以去訓練分類器了,但是由于卷積特征的維數很高,除了計算慢之外,還容易出現過擬合。因此把每一個的卷積特征進行池化。如卷積特征是89^2*400,表示400個特征,每個特征有89^2維。池化就是對每一特征89^2,平均分成若干固定大小不相干的塊,可以用塊內的平均或最大值代表,這樣若分成了10塊,則89^2維就變成了10維。
池化具有平移性
練習
這個部分感覺做了練習才理解的清楚了。
step1:從大圖像中隨機提取8*8的小塊–> ZCA白化–>用SparseEncoder提取出特征。
step2:實現卷積
step3:池化
function pooledFeatures = cnnPool(poolDim, convolvedFeatures) %cnnPool Pools the given convolved features % % Parameters: % poolDim - dimension of pooling region % convolvedFeatures - convolved features to pool (as given by cnnConvolve) % convolvedFeatures(featureNum, imageNum, imageRow, imageCol) % % Returns: % pooledFeatures - matrix of pooled features in the form % pooledFeatures(featureNum, imageNum, poolRow, poolCol) % numImages = size(convolvedFeatures, 2); numFeatures = size(convolvedFeatures, 1); convolvedDim = size(convolvedFeatures, 3);pooledFeatures = zeros(numFeatures, numImages, floor(convolvedDim / poolDim), floor(convolvedDim / poolDim));numRegin=floor(convolvedDim / poolDim); for featureNum=1:numFeaturesfor imageNum=1:numImagesfor row=1:numReginfor col=1:numReginregin=convolvedFeatures(featureNum, imageNum,(row-1)*poolDim+1:row*poolDim,(col-1)*poolDim+1:col*poolDim);pooledFeatures(featureNum,imageNum,row,col)=mean(regin(:));endendend end end總結
以上是生活随笔為你收集整理的深度学习笔记7 Working with Large Images 卷积特征提取的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 深度学习笔记6:Learning col
- 下一篇: 深度学习笔记8 数据预处理