日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Deep learning前的图像预处理

發布時間:2025/10/17 编程问答 7 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Deep learning前的图像预处理 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

(1)調節尺寸

As data(Images) few into the NN should be scaled according the image size that the NN is designed to take, usually a square i.e 100x100,250x250


(2) 特征標準化(Feature Standardization)

  • 【參考文獻】
    • https://blog.csdn.net/xjp_xujiping/article/details/102981133
    • https://blog.csdn.net/kane7csdn/article/details/86475918
    • https://blog.csdn.net/dengheng4891/article/details/101446368

特征標準化(Feature Standardization)
特征標準化的目的是使數據集中所有特征都具有零均值和單位方差,即數據的每一個維度具有零均值和單位方差,這也是比較常見的一種歸一化方法,比如使用SVM時候也要進行類似處理。在實際應用中,特征標準化的具體做法是:首先計算每一個維度上數據的均值(使用全體數據計算),之后在每一個維度上都減去該均值。下一步便是在數據的每一維度上除以該維度上數據的標準差。

例如(X)是一個訓練樣本集,包含m個訓練樣本且每個訓練樣本的維數是n。應用特征標準化時先計算各行數據的均值,然后樣本集(X)減去該均值得到零均值化后的樣本集(X{’})。之后(X{’})的各行除以該行數據的標準差就會得到特征標準化后的樣本。

若輸入是自然彩色圖像,由于色彩通道間并不存在平穩特性,因此通常對數據進行特征縮放(使像素值位于 [0,1] 區間)。然后再進行PCA/ZCA白化等操作,在白化前需進行特征分量均值歸零(即使特征的每一個維度具有零均值,通常不需要除以各維度數據的標準差,因為各維度標準差很接近)。在UFLDL教程的練習中(linear decoder)采用的是這種方法,而在有些論文中,也會采用第二種方法(逐樣本去均值和除以標準差),如論文“An Analysis of Single-Layer Networks in Unsupervised Feature Learning”,這樣在后續白化處理時是不是還需要再對各維度進行零均值化(因為計算協方差矩陣時需要這一步)。

Here is a explanation of it from Stanford CS231n 2016 Lectures[https://cs231n.github.io/neural-networks-2/].

Normalization refers to normalizing the data dimensions so that they are of approximately the same scale. For Image data There are two common ways of achieving this normalization.

(一) 減均值Mean subtraction

One is to divide each dimension by its standard deviation, once it has been zero-centered:
(X /= np.std(X, axis = 0)).
先計算訓練集均值,后用訓練和測試數據再減去均值

  • 【參考文獻】:
    • https://blog.csdn.net/Miss_yuki/article/details/80662017
    • https://niuyuanyuanna.github.io/2018/11/08/deep_learning/data-normalization/#%E9%80%90%E6%A0%B7%E6%9C%AC%E5%9D%87%E5%80%BC%E6%B6%88%E5%87%8Fper-example-mean-subtraction

(二)Normalization, 特征縮放至[-1,1]

Another form of this preprocessing normalizes each dimension so that the min and max along the dimension is -1 and 1 respectively. It only makes sense to apply this preprocessing if you have a reason to believe that different input features have different scales (or units), but they should be of approximately equal importance to the learning algorithm. In case of images, the relative scales of pixels are already approximately equal (and in range from 0 to 255), so it is not strictly necessary to perform this additional preprocessing step.


(3)降維PCA和白化:

Dimensionality reduction RGB to Grayscale image, neural network performance is allowed to be invariant to that dimension, or to make the training problem more tractable


總結

以上是生活随笔為你收集整理的Deep learning前的图像预处理的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。