# ResNext ###### tags: `paper` `已公開` [toc] <font color=red>一句話說明ResNext: 在ResNet基礎上結合Inception</font> ## Introduction #### 先來認識inception module 它來自於[GoogLeNet](https://arxiv.org/pdf/1409.4842.pdf),向Yan LeCun的LeNet致敬(最早的CNN)。 ![](https://i.imgur.com/mpLtXBs.png) 這個策略引入了一個新的維度,我們稱之為“**cardinality(基數)**”,作為深度和寬度維度之外的一個重要因素。當我們增加容量時,**增加cardinality比更深或更廣更有效**。Inception 模型系列已經證明,精心設計的拓撲結構能夠以較低的理論複雜性實現令人信服的準確性。 Inception module 的精神在於split-transform-merge。在 Inception 模塊中,輸入被分成幾個低維embeddings,由一組specialized filters (3x3, 5x5, etc.)轉換,並通過concatenation合併。 在本文中,提出了一個簡單的架構,它採用 VGG/ResNets 的重複層策略,同時以一種簡單、可擴展的方式結合了**split-transform-merge 策略**。我們網絡中的module執行一組transformations,每個transform都在low-dim. embedding上,其輸出通過aggreagte by sum。並展示了,即使在保持計算複雜性和模型大小的限制條件下,我們的aggregated transformations優於原始 ResNet module。我們的方法證明,**cardinality是一個具體的、可測量的維度,除了寬度和深度的維度之外,它也很重要**。 ## Related Work - **Multi-branch convolutional networks** come from Inception models - **Grouped Convolution** come from AlexNet - **Compressing convolutional networks** a widely adopted technique to reduce redundancy of deep convolutional networks and accelerate/compress them. 我們的方法不是壓縮,而是一種根據經驗顯示出更強表示能力的架構。 - **Ensembling** is that averaging a set of independently trained networks is an effective solution to improving accuracy. 不是像ResNet一樣用加法,而是用aggregated。 But we argue that it is imprecise to view our method as ensembling, because the members to be aggregated are trained jointly, not independently. > Grouped Conv. ![](https://mdimg.wxwenku.com/getimg/356ed03bdc643f9448b3f6485edc229b6a84407768c79a98a04603fc7c285091cc1955c60b5d062c2222d2604544fe1f.jpg) ## Method ### Template We adopt a highly modularized design following VGG/ResNets. Our network consists of a stack of residiual blocks. These blocks have the same topology, and are subject to two simple rules inspired by VGG/ResNets. 1. 如果生成相同大小的空間圖,則block 共享相同的超參數(寬度和過濾器大小) 2. 每次空間圖被2的因子下採樣時,block的寬度乘以2。是為了確保所有block的計算複雜度(就 FLOPs 而言)大致相同 基於上述兩個規則,我們僅需設計一個 template module。這兩條規則大大縮小了設計空間,讓我們可以專注於幾個關鍵因素。 ![](https://i.imgur.com/lr7KSKw.png) ### Revisiting Simple Neurons The simplest neurons in artificial neural networks perform inner product (weighted sum), which is the elementary transformation done by full-connected and convolutional layers. 可以被表是成以下等式1: $$ \sum^{D}_{i=1}{w_{i}x_{i}} \tag1 $$ where $x=[x_{i}, x_{2}, ..., x_{D}]$ neurons, D-channel input vector to the neuron and, $w_{i}$ is filter's weight for i-th channel ![](https://i.imgur.com/vq8Nrqo.png) 受到原始的neurons 的啟發,並重鑄成splitting, transforming, aggregatting[圖二] - Splitting: 將向量x切片成一個低維embedding,上圖每個 $x_{i}$ - Transforming: 對低維表示進行轉換,如上圖 $w_{i}x_{i}$ - Aggregating: 對所有embaddings 做aggregate by $\sum^{D}_{i=1}$ ### Aggregated Transformations 經過上面簡單的分析neuron,可以將transform($w_{i}x_{i}$) 替換成更通用的函數,其本身也可以是一個網路。借鏡於[Network-in-Network](https://arxiv.org/abs/1312.4400)(下圖),我們重新表示aggregated transform as等式2: ![](https://i.imgur.com/BJhElH1.png) $$ F(x) = \sum^{C}_{i=1} \Gamma_{i}(x) \tag2 $$ $\Gamma_{i}(x)$是一個隨意的函數。類似於簡單的神經元,應該將$x$ 投影到一個embedding(optionally low-dim) 然後transform(變換)它。$C$ 是要聚合轉換集的大小(is the size of the set of transformations to be aggregated.) 本篇論文將$C$ 稱之cardinality. $C$ 類似於等式1的$D$,但是$C$ 不需要等於 $D$ 且可以是任意數。 我們認為cardinality控制了更複雜的轉換數量。 **我們通過實驗表明cardinality這個基本維度,比寬度和深度的維度更有效**。 本篇論文考慮簡單的transform functions: 所有 $\Gamma_{i}$'s 擁有相同的拓樸。延伸了VGG風格的策略(repeating layers of the same shape),這有助於隔離幾個因素並擴展到任何大量的轉換。我們將個別的transform設置成瓶頸形結構。如(圖一,右) The aggregated transformation , 等式2作爲 residual function: $$ y = x + \sum^{C}_{i=1}{\Gamma_{i}(x)} \tag3 $$ where y is the output. **等價關係** ![](https://i.imgur.com/NDzqbk4.png) - Relation to Inception-ResNet 許多tensor操作(圖一右,也就是圖三a ),等價於圖三b:bulb:。 圖三b,出現 Inception-ResNet block,因為它涉及殘差函數中的分支和concatenating。 但與所有 Inception 或 Inception-ResNet module不同,我們在多條路徑之間共享相同的拓撲。 - Relation to Grouped Convolutions 將圖三b用grouped conv.重構成圖三c。Splitting 本質上是由分組卷積層在將其輸入通道分成組實現的。(Splitting is essentially done by the grouped convolutional layer when it divides its input channels into groups.) The grouped convolutional layer in performs 32 groups of convolutions whose input and output channels are 4-dimensional. The grouped convolutional layer concatenates them as the outputs of the layer ![](https://i.imgur.com/B8YRvR4.png) :::success :bulb: $A_{1}B_{1} + A_{2}B_{2} = [A1, A2][B1;B2]$ where$[,]$ is horizontal concatenation and $[ ; ]$ is vertical concatenation. :bulb: $A$ 代表圖三a的每個[$4,3*3,4$],$B$代表圖三a的每個[$4,1*1,256$] ::: We note that the reformulations produce nontrivial topologies only when the block has depth≥3 . If block depth = 2, 如圖四所示 without bottleneck。 ![](https://i.imgur.com/msbcfQo.png) 儘管我們展示了concatenation or grouped convolution(圖3),但是這樣的重構並不不能適用於等式3的一般形式,例如,transformation $\Gamma_{i}$ 採用任意形式並且是heterogenous。我們在本文中選擇使用同構(homogenous)形式,因為它們更簡單和可擴展。 在這種簡化的情況下,分組卷積如[圖3c] 所示,有利於預測實施,因此作者最後採用這個結構。 ### Model Capacity - 原始ResNet以圖一左為例,參數量有 $256*64 +3*3*64*64 + 64*256 \approx 70k$ 個。 - 我們所提出的網路以圖一右為例,參數量有$C \cdot(256*d+ 3*3*d*d +d*256) \tag4$ 當 cardinality C=32, bottleneck width d=4,約為70k的參數量。(透過等式4計算) ## Experiments 請參考原文 ## 參考資料 - [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/pdf/1611.05431.pdf)