cnn卷积神经网络_5分钟内卷积神经网络(CNN)
cnn卷積神經網絡
Convolutional neural networks (CNNs) are the most popular machine leaning models for image and video analysis.
卷積神經網絡(CNN)是用于圖像和視頻分析的最流行的機器學習模型。
示例任務 (Example Tasks)
Here are some example tasks that can be performed with a CNN:
以下是一些可以使用CNN執行的示例任務:
- Binary Classification: given an input image from a medical scan, determine if the patient has a lung nodule (1) or not (0) 二進制分類:給定來自醫學掃描的輸入圖像,確定患者是否患有肺結節(1)(0)
- Multilabel Classification: given an input image from a medical scan, determine if the patient has none, some, or all of the following: lung opacity, nodule, mass, atelectasis, cardiomegaly, pneumothorax 多標簽分類:給定來自醫學掃描的輸入圖像,確定患者是否患有以下疾病:肺渾濁,結節,腫塊,肺不張,心臟肥大,氣胸
CNN如何運作 (How CNNs Work)
In a CNN, a convolutional filter slides across an image to produce a feature map (which is labeled “convolved feature” in the image below):
在CNN中,卷積濾鏡會在圖像上滑動以生成特征圖(下圖中標記為“卷積特征”):
A filter detects a pattern.
過濾器檢測圖案。
High values in the output feature map are produced when the filter passes over an area of the image containing the pattern.
當濾鏡經過包含圖案的圖像區域時,將在輸出要素圖中產生較高的值。
Different filters detect different patterns.
不同的過濾器檢測不同的模式。
The kind of pattern that a filter detects is determined by the filter’s weights, which are shown as red numbers in the animation above.
過濾器檢測到的模式類型取決于過濾器的權重,權重在上方的動畫中顯示為紅色數字。
A filter weight gets multiplied against the corresponding pixel value, and then the results of these multiplications are summed up to produce the output value that goes in the feature map.
將濾鏡權重與相應的像素值相乘,然后將這些相乘的結果相加,以生成輸出到特征圖中的輸出值。
A convolutional neural network involves applying this convolution operation many time, with many different filters.
卷積神經網絡需要使用許多不同的濾波器多次應用此卷積運算。
This figure shows the first layer of a CNN:
此圖顯示了CNN的第一層:
Radiopedia)Radiopedia )In the diagram above, a CT scan slice is the input to a CNN. A convolutional filter labeled “filter 1” is shown in red. This filter slides across the input CT slice to produce a feature map, shown in red as “map 1.”
在上圖中,CT掃描切片是CNN的輸入。 標記為“過濾器1”的卷積過濾器以紅色顯示。 該濾鏡在輸入CT切片上滑動以生成特征圖,以紅色顯示為“圖1”。
Then a different filter called “filter 2” (not explicitly shown) which detects a different pattern slides across the input CT slice to produce feature map 2, shown in purple as “map 2.”
然后,一個稱為“過濾器2”(未明確顯示)的不同過濾器會在輸入的CT切片上滑動,以檢測不同的模式,以生成特征圖2,以紫色顯示為“圖2”。
This process is repeated for filter 3 (producing map 3 in yellow), filter 4 (producing map 4 in blue) and so on, until filter 8 (producing map 8 in red).
對濾鏡3(以黃色生成圖3),濾鏡4(以藍色生成圖4)等重復此過程,直到濾鏡8(以紅色生成圖8)。
This is the “first layer” of the CNN. The output of the first layer is thus a 3D chunk of numbers, consisting in this example of 8 different 2D feature maps.
這是CNN的“第一層”。 因此,第一層的輸出是3D數字塊,在此示例中包含8個不同的2D特征圖。
Image by Author圖片作者Next we go to the second layer of the CNN, which is shown above. We take our 3D representation (of 8 feature maps) and apply a filter called “filter a” to this. “Filter a” (in gray) is part of the second layer of the CNN. Notice that “filter a” is actually three dimensional, because it has a little 2×2 square of weights on each of the 8 different feature maps. Therefore the size of “filter a” is 8 x 2 x 2. In general, the filters in a “2D” CNN are 3D, and the filters in a “3D” CNN are 4D.
接下來,我們進入CNN的第二層,如上所示。 我們采用3D表示法(包含8個要素圖),并對此應用一個稱為“ filter a”的過濾器。 “過濾器a”(灰色)是CNN第二層的一部分。 請注意,“過濾器a”實際上是三維的,因為在8個不同的特征圖中,每個過濾器的權重只有2×2平方。 因此,“過濾器a”的大小為8 x 2 x2。通常,“ 2D” CNN中的過濾器為3D,而“ 3D” CNN中的過濾器為4D。
We slide filter a across the representation to produce map a, shown in grey. Then, we slide filter b across to get map b, and filter c across to get map c, and so on. This completes the second layer of the CNN.
我們在表示中滑動濾鏡a,以生成地圖a,以灰色顯示。 然后,我們將過濾器b滑到地圖b上,將過濾器c滑到地圖c上,依此類推。 這樣就完成了CNN的第二層。
We can then continue on to a third layer, a fourth layer, etc. for however many layers of the CNN are desired. CNNs can have many layers. As an example, a ResNet-18 CNN architecture has 18 layers.
然后,我們可以繼續進行到第三層,第四層等,因為需要CNN的許多層。 CNN可以有很多層。 例如,ResNet-18 CNN體系結構具有18層。
The figure below, from Krizhevsky et al., shows example filters from the early layers of a CNN. The filters early on in a CNN detect simple patterns like edges and lines going in certain directions, or simple color combinations.
下圖來自Krizhevsky等人 ,顯示了來自CNN早期層的示例過濾器。 CNN早期的濾鏡可檢測簡單的圖案,例如沿特定方向延伸的邊緣和線條,或簡單的顏色組合。
The figure below, from Siegel et al. adapted from Lee et al., shows examples of early layer filters at the bottom, intermediate layer filters in the middle, and later layer filters at the top.
下圖來自Siegel等。 改編自李等人。 的示例在底部顯示早期層過濾器,在中間顯示中間層過濾器,在頂部顯示較后層過濾器。
The early layer filters once again detect simple patterns like lines going in certain directions, while the intermediate layer filters detect more complex patterns like parts of faces, parts of cars, parts of elephants, and parts of chairs. The later layer filters detect patterns that are even more complicated, like whole faces, whole cars, etc. In this visualization each later layer filter is visualized as a weighted linear combination of the previous layer’s filters.
早期的層過濾器再次檢測簡單的圖案,例如沿特定方向的線條,而中間層的過濾器檢測更復雜的圖案,例如面部,汽車部分,大象部分和椅子部分。 后面的圖層過濾器檢測甚至更復雜的模式,例如整張臉,整輛汽車等。在此可視化中,每個后面的圖層過濾器都可視為上一層過濾器的加權線性組合。
如何學習過濾器 (How to Learn the Filters)
How do we know what feature values to use inside of each filter? We learn the feature values from the data. This is the “learning” part of “machine learning” or “deep learning.”
我們如何知道在每個過濾器內部使用哪些特征值? 我們從數據中學習特征值。 這是“機器學習”或“深度學習”的“學習”部分。
Steps:
腳步:
The following animation created by Tamas Szilagyi shows a neural network model learning. The animation shows a feedforward neural network rather than a convolutional neural network, but the learning principle is the same. In this animation each line represents a weight. The number shown next to the line is the weight value. The weight value changes as the model learns.
由Tamas Szilagyi創建的以下動畫顯示了神經網絡模型學習。 動畫顯示的是前饋神經網絡,而不是卷積神經網絡,但是學習原理是相同的。 在此動畫中,每條線代表一個權重。 該行旁邊顯示的數字是重量值。 權重值隨模型學習而變化。
衡量績效:AUROC (Measuring Performance: AUROC)
Image by Author圖片作者One popular performance metric for CNNs is the AUROC, or area under the receiver operating characteristic. This performance metric indicates whether the model can correctly rank examples. The AUROC is the probability that a randomly selected positive example has a higher predicted probability of being positive than a randomly selected negative example. An AUROC of 0.5 corresponds to a coin flip or useless model, while an AUROC of 1.0 corresponds to a perfect model.
CNN的一種流行性能指標是AUROC,即接收機工作特性下的面積。 此性能指標指示模型是否可以正確對示例進行排名。 AUROC是隨機選擇的陽性示例比隨機選擇的陰性示例具有更高的陽性預測概率的概率。 AUROC為0.5對應于硬幣翻轉或無用模型,而AUROC為1.0對應于理想模型。
附加閱讀 (Additional Reading)
For more details about CNNs, see:
有關CNN的更多詳細信息,請參閱:
How Computers See: Intro to Convolutional Neural Networks
計算機的外觀:卷積神經網絡簡介
The History of Convolutional Neural Networks
卷積神經網絡的歷史
Convolution vs. Cross-Correlation
卷積與互相關
For more details about how neural networks learn, see Introduction to Neural Networks.
有關神經網絡學習方式的更多詳細信息,請參見《神經網絡簡介》 。
Finally, for more details about AUROC, see:
最后,有關AUROC的更多詳細信息,請參見:
Measuring Performance: AUC (AUROC)
測量性能:AUC(AUROC)
The Complete Guide to AUC and Average Precision: Simulations nad Visualizations
AUC和平均精度的完整指南:模擬和可視化
Originally published at http://glassboxmedicine.com on August 3, 2020.
最初于 2020年8月3日 發布在 http://glassboxmedicine.com 上。
翻譯自: https://towardsdatascience.com/convolutional-neural-networks-cnns-in-5-minutes-dc86d0e27e1e
cnn卷積神經網絡
總結
以上是生活随笔為你收集整理的cnn卷积神经网络_5分钟内卷积神经网络(CNN)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 对标蔚来“女王副驾”?理想汽车申请注册皇
- 下一篇: TensorFlow:实战Google深