{"notes":[{"id":"classic-cnns/resnet","category":"classic-cnns","legacyPath":"classic-cnns/1512-resnet","legacySlug":"1512-resnet","legacyPaths":[],"title":"ResNet","subtitle":"Convolutional with 100 Layers","author":"Z. Yuan","paperDate":"2015-12-10","publishedOn":"2024-08-08","paperTitle":"Deep Residual Learning for Image Recognition","paperUrl":"https://arxiv.org/abs/1512.03385","bibliography":{"title":"Deep Residual Learning for Image Recognition","authors":["Kaiming He","Xiangyu Zhang","Shaoqing Ren","Jian Sun"],"url":"https://arxiv.org/abs/1512.03385","pdfUrl":"https://arxiv.org/pdf/1512.03385","codeUrl":null,"preprint":{"id":"1512.03385","submittedOn":"2015-12-10","url":"https://arxiv.org/abs/1512.03385"},"publication":{"venue":"CVPR","year":2016,"kind":"conference","url":"https://doi.org/10.1109/cvpr.2016.90"},"citation":"@misc{classiccnnsresnet2015,\n  title = {{Deep Residual Learning for Image Recognition}},\n  author = {Kaiming He and Xiangyu Zhang and Shaoqing Ren and Jian Sun},\n  year = {2015},\n  eprint = {1512.03385},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1512.03385}\n}\n","citationPath":"/content/papers/citations/classic-cnns/resnet.cf4014e8baae.bib"},"thumbnail":{"src":"/content/papers/assets/b8fe87fe757249ea6d7bb667fef3196754b9f80e28bf842a69b540ca94585d08.jpg","width":1224,"height":408},"locale":"en","path":"/content/papers/en/classic-cnns/resnet.b65375cb9846.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"what-is-residual","text":"What is Residual?","depth":3},{"id":"residual-learning","text":"Residual Learning","depth":3},{"id":"residual-module","text":"Residual Module","depth":3},{"id":"network-architecture","text":"Network Architecture","depth":3},{"id":"architectures-and-computation","text":"Architectures and Computation","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"resnet-18-vs-resnet-34","text":"ResNet-18 vs ResNet-34","depth":3},{"id":"deeper-bottleneck-architectures","text":"Deeper Bottleneck Architectures","depth":3},{"id":"performance-on-imagenet","text":"Performance on ImageNet","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"classic-cnns/vgg","relation":"background","topic":"Training deeper convolutional networks"},{"id":"classic-cnns/densenet","relation":"next","topic":"Training deeper convolutional networks"}]},{"id":"classic-cnns/vgg","category":"classic-cnns","legacyPath":"classic-cnns/1409-vgg","legacySlug":"1409-vgg","legacyPaths":[],"title":"VGG","subtitle":"Deep and More Deep","author":"Z. Yuan","paperDate":"2014-09-04","publishedOn":"2024-07-11","paperTitle":"Very Deep Convolutional Networks for Large-Scale Image Recognition","paperUrl":"https://arxiv.org/abs/1409.1556","bibliography":{"title":"Very Deep Convolutional Networks for Large-Scale Image Recognition","authors":["Karen Simonyan","Andrew Zisserman"],"url":"https://arxiv.org/abs/1409.1556","pdfUrl":"https://arxiv.org/pdf/1409.1556","codeUrl":null,"preprint":{"id":"1409.1556","submittedOn":"2014-09-04","url":"https://arxiv.org/abs/1409.1556"},"publication":{"venue":"ICLR","year":2015,"kind":"conference","url":"https://arxiv.org/pdf/1409.1556"},"citation":"@misc{classiccnnsvgg2014,\n  title = {{Very Deep Convolutional Networks for Large-Scale Image Recognition}},\n  author = {Karen Simonyan and Andrew Zisserman},\n  year = {2014},\n  eprint = {1409.1556},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1409.1556}\n}\n","citationPath":"/content/papers/citations/classic-cnns/vgg.6d704fc68256.bib"},"thumbnail":{"src":"/content/papers/assets/f8c8263e4970f0d994107c8084552e778e2f8f3cee14e213551fb6b0942568c2.jpg","width":968,"height":980},"locale":"en","path":"/content/papers/en/classic-cnns/vgg.2ffb2f474c3a.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"problem-solving","text":"Problem Solving","depth":2},{"id":"network-architecture","text":"Network Architecture","depth":3},{"id":"training-details","text":"Training Details","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"lrn-contribution","text":"LRN Contribution","depth":3},{"id":"performance-on-imagenet","text":"Performance on ImageNet","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"classic-cnns/alexnet","relation":"background","topic":"Training deeper convolutional networks"},{"id":"classic-cnns/resnet","relation":"next","topic":"Training deeper convolutional networks"},{"id":"reparameterization/vanillanet","relation":"next","topic":"Simplifying convolutional network design"}]},{"id":"classic-cnns/densenet","category":"classic-cnns","legacyPath":"classic-cnns/1608-densenet","legacySlug":"1608-densenet","legacyPaths":[],"title":"DenseNet","subtitle":"Connecting Everything","author":"Z. Yuan","paperDate":"2016-08-25","publishedOn":"2024-07-02","paperTitle":"Densely Connected Convolutional Networks","paperUrl":"https://arxiv.org/abs/1608.06993","bibliography":{"title":"Densely Connected Convolutional Networks","authors":["Gao Huang","Zhuang Liu","Laurens van der Maaten","Kilian Q. Weinberger"],"url":"https://arxiv.org/abs/1608.06993","pdfUrl":"https://arxiv.org/pdf/1608.06993","codeUrl":null,"preprint":{"id":"1608.06993","submittedOn":"2016-08-25","url":"https://arxiv.org/abs/1608.06993"},"publication":{"venue":"CVPR","year":2017,"kind":"conference","url":"https://arxiv.org/abs/1608.06993"},"citation":"@misc{classiccnnsdensenet2016,\n  title = {{Densely Connected Convolutional Networks}},\n  author = {Gao Huang and Zhuang Liu and Laurens van der Maaten and Kilian Q. Weinberger},\n  year = {2016},\n  eprint = {1608.06993},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1608.06993}\n}\n","citationPath":"/content/papers/citations/classic-cnns/densenet.6f28153b67f7.bib"},"thumbnail":{"src":"/content/papers/assets/4f073a0fd1fc5b7415ca19c48934d180f9043fddc08301819a50ceb1b0ebfc69.jpg","width":1184,"height":828},"locale":"en","path":"/content/papers/en/classic-cnns/densenet.9b1c0f86199d.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"network-architecture","text":"Network Architecture","depth":3},{"id":"transition-layers-and-average-pooling","text":"Transition Layers and Average Pooling","depth":3},{"id":"growth-rate","text":"Growth Rate","depth":3},{"id":"bottleneck-layers","text":"Bottleneck Layers","depth":3},{"id":"compression","text":"Compression","depth":3},{"id":"implementation-details","text":"Implementation Details","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"experimental-results","text":"Experimental Results","depth":3},{"id":"compact-models","text":"Compact Models","depth":3},{"id":"feature-reuse","text":"Feature Reuse","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"classic-cnns/resnet","relation":"background","topic":"Training deeper convolutional networks"}]}],"text":"BatchNorm and suitable initialization made deep networks easier to optimize. Yet the ResNet authors observed something puzzling: adding layers could increase even the training error.\n\nSo why are models still difficult to train well?\n\n## Defining the Problem\n\n![ResNet paper Figure 1: training and test errors of 20- and 56-layer plain networks on CIFAR-10](/content/papers/assets/e400771cae578f9365b229baa7bbb4c74f5898f307439218bfcaa0368c947f9d.jpg)\n\n*Paper Figure 1: training error on the left, test error on the right. These are CIFAR-10 plain networks, not the 18/34-layer ImageNet comparison below.*\n\nThe authors conducted an experiment.\n\nIn principle, a deeper model has at least one solution no worse than a shallow one: the added layers can implement identities while the others copy the shallow model. Yet the **56-layer plain network** in this CIFAR-10 plot has higher training and test errors than the **20-layer plain network**.\n\nThe crucial point is that training error also rises, so overfitting alone cannot explain it. The authors inspected signals and gradients in their experiments and did not attribute this degradation directly to vanishing gradients. The question becomes one of optimization: a good solution can be constructed, but training does not find it.\n\nHence, the authors define this issue as the model degradation problem.\n\n## Solving the Problem\n\n### What is Residual?\n\nIn mathematics and engineering, a residual is the difference between an observed value and a reference value.\n\nComputer vision also uses residual representations of local image descriptors: they encode how a descriptor differs from a reference such as a dictionary or model. This can capture variations, provide a compact way to process them, and help distinguish subtle image features. Those are background uses of the word. In ResNet, the reference is the network block's own input, and the residual branch learns what to add to it.\n\n### Residual Learning\n\n![ResNet paper Figure 2: residual branch F(x) and identity shortcut x, followed by ReLU](/content/papers/assets/84ac0b0e37b09da1cb214a083fc5d8f9630780998c66a09b8338961eca4b3b8e.jpg)\n\n*Paper Figure 2: the shortcut carries $x$, the two weighted layers produce $F(x)$, and ReLU follows the addition. This is the paper's original block, not every later ResNet variant.*\n\nLet $H(x)$ denote the mapping a residual block should learn, and $x$ its input features—not necessarily the raw image.\n\nRather than directly fitting $H(x)$, the residual branch learns $F(x)$ and the sum becomes $F(x)+x$. Its target is therefore $F(x):=H(x)-x$. The desired mapping stays the same; its parameterization changes.\n\nIf a suitable mapping is close to the identity, the residual branch only needs to approach zero. This is the authors’ optimization intuition; the experiments test whether it helps.\n\nA shortcut skips one or more layers and adds the block input to the branch output. When shapes match, an identity shortcut adds no trainable parameters, though the addition has a small computational cost. Whether this reparameterization improves optimization is tested against plain networks of the same depth below.\n\n### Residual Module\n\n![ResNet paper Figure 5: two-layer basic block at left and three-layer bottleneck block at right](/content/papers/assets/b8fe87fe757249ea6d7bb667fef3196754b9f80e28bf842a69b540ca94585d08.jpg)\n\n*Paper Figure 5: the bottleneck uses 1×1 convolutions to narrow and then restore the channels around a 3×3 convolution. The two illustrated designs have similar computational complexity.*\n\nThe paper uses both a two-layer basic block and a three-layer bottleneck. The **two examples have similar computational complexity**; parameter counts require a separate comparison. Other branch depths are possible, but the authors did not observe a benefit from a one-layer residual function.\n\nThe two paths must have matching shapes before addition. For dimension changes, the paper compares zero-padding shortcuts with $1 \\times 1$ projection shortcuts; projections can also use stride to adjust spatial size. The original block applies ReLU after addition.\n\n### Network Architecture\n\nThis might be the \"longest\" image we've seen in a paper...\n\n![ResNet paper Figure 3: VGG-19, a 34-layer plain network and a 34-layer residual network](/content/papers/assets/9c5752a1e0635b240d3615fed155978fdd02a2423bf1a9cd36036d7f4ce04a23.jpg)\n\n*Paper Figure 3: solid shortcuts preserve dimensions; dotted shortcuts cross to smaller feature maps and more channels. The plain and residual 34-layer networks each use about 3.6 billion FLOPs in the paper's convention.*\n\nThe figure compares VGG-19, a 34-layer plain network and ResNet-34. The last two have the same depth and backbone but differ in shortcuts. Most convolutions use $3 \\times 3$ kernels, following two design rules:\n\n1. For the same output feature map size, the stacked convolutional layers should have the same number of output channels.\n2. If the feature map size is halved, the number of channels is doubled to keep the per-layer convolutional computation at roughly the same scale.\n\nDownsampling is achieved through convolutions with a stride of 2, and the final classification is done using a global average pooling layer followed by a fully connected layer.\n\nIn the paper's multiply-add count, the 34-layer network uses about **3.6 billion FLOPs**, versus **19.6 billion** for VGG-19: roughly **18%**. That FLOP ratio is not a measured latency ratio.\n\n\n> [!TIP]\n> \n> Can't imagine how long one has to scroll if it were ResNet-152...\n\n\n### Architectures and Computation\n\n![ResNet paper Table 1: 18/34/50/101/152-layer architectures, block counts and FLOPs](/content/papers/assets/d97cd88d856e56b344f44b6fa8f6b963333e2540423a032897a64e77829dcf56.jpg)\n\n*Paper Table 1: 18/34-layer networks use basic blocks, while 50/101/152-layer networks use bottlenecks. The bottom row gives FLOPs, not parameter counts.*\n\nThe table specifies **block configurations and computation**. Its FLOP count ranges from **1.8 billion** for 18 layers to **11.3 billion** for 152 layers, below the paper's **15.3/19.6 billion** for VGG-16/19. It does not list parameter counts, so parameter growth cannot be read directly from this table.\n\nOther training configurations are as follows:\n\n1. **Data Augmentation**:\n\n   - **Scale Augmentation**: The short side of an image is resized to a random size in the range [256, 480] for scale augmentation.\n   - **Crop and Flip**: Randomly crop a 224×224 area from the image or its horizontal flip and subtract the mean value of each pixel.\n   - **Color Augmentation**: Use standard color augmentation methods detailed in AlexNet.\n\n2. **Normalization and Activation**:\n\n   - Use Batch Normalization (BN) after each convolution and before activation to stabilize and accelerate training.\n\n3. **Weight Initialization**:\n\n   - Use Kaiming initialization to initialize weights, training all plain and residual networks from scratch.\n     - [**[15.02] Delving deep into rectifiers: Surpassing human-level performance on imagenet classification**](https://arxiv.org/abs/1502.01852)\n\n4. **Optimizer**:\n\n   - Use mini-batch Stochastic Gradient Descent as the optimizer with a batch size of 256.\n   - **Learning Rate**: Set the initial learning rate to 0.1, dividing it by 10 when the error reaches a stable level.\n   - **Weight Decay**: Set to 0.0001.\n   - **Momentum**: Set to 0.9.\n\n5. **Other Configurations**:\n\n   - **Dropout**: Do not use dropout during training.\n\n## Discussion\n\n### ResNet-18 vs ResNet-34\n\n![ResNet paper Table 2: ImageNet top-1 validation errors for 18/34-layer plain and residual networks](/content/papers/assets/020c8d031eb9c5fe3a2898fe4755bceddab79483062e9ff69e779cd6ba8b96c5.jpg)\n\n*Paper Table 2: ten-crop top-1 error on ImageNet validation; the matched residual variants add no shortcut parameters.*\n\nThe authors first evaluated the plain networks with 18 and 34 layers.\n\nThe plain network's top-1 validation error rises from **27.94%** at 18 layers to **28.54%** at 34. With parameter-free shortcuts, ResNet-34 scores **25.03%** and ResNet-18 **27.88%**. Table 2 uses **ten crops**; the training plot below uses center-crop validation errors.\n\n![ResNet paper Figure 4: ImageNet training curves for 18/34-layer plain and residual networks](/content/papers/assets/5ff0a2ec0a7d51a67616e7313e8caafdd3a2073982e36bc6946713a1172c8540.jpg)\n\n*Paper Figure 4: plain networks on the left, ResNets on the right; thin lines are training error and bold lines center-crop validation error. These are not Table 2's ten-crop numbers.*\n\nThe figure reveals a degradation problem: although the solution space of the 18-layer plain network is a subset of the 34-layer network, the 34-layer plain network has higher training error throughout the training process. The authors believe this optimization difficulty is unlikely to be caused by gradient vanishing. These plain networks are trained with Batch Normalization (BN), ensuring non-zero variance in forward propagation signals. The authors also checked the backward gradient norms and did not observe vanishing forward or backward signals in these experiments.\n\nIn fact, the 34-layer plain network still achieves competitive accuracy, indicating that the solver works to some extent. The authors speculate that the convergence speed of the deep plain network might decrease exponentially, affecting the reduction in training error. Future research will further investigate the causes of this optimization difficulty.\n\nThe authors then add shortcuts around each pair of $3 \\times 3$ convolutions. Table 2 uses **option A**: changed dimensions are matched by zero-padding, without extra shortcut weights. ResNet-34's top-1 validation error is **2.85 percentage points** lower than ResNet-18's, and Figure 4 also shows lower training error. The evidence supports relief from degradation in this setup.\n\n### Deeper Bottleneck Architectures\n\n![ResNet paper Figure 5: basic two-layer and bottleneck three-layer blocks](/content/papers/assets/b8fe87fe757249ea6d7bb667fef3196754b9f80e28bf842a69b540ca94585d08.jpg)\n\n*Figure 5 again: the 50/101/152-layer networks use the bottleneck at right, retaining identity shortcuts when dimensions match.*\n\nThe authors constructed deeper networks for ImageNet.\n\nDue to training time considerations, the authors modified the building block to a bottleneck design. For each residual function $F$, three layers are stacked instead of two, as shown above.\n\nThese three layers are $1 \\times 1$, $3 \\times 3$, and $1 \\times 1$ convolutions. The $1 \\times 1$ layers are responsible for reducing and then restoring (increasing) dimensions, with the $3 \\times 3$ layer functioning as a bottleneck with smaller input/output dimensions. The two designs have similar time complexity.\n\n- **ResNet-50**: By replacing each 2-layer block with this 3-layer bottleneck block, ResNet-50 is constructed.\n- **ResNet-101 and ResNet-152**: More 3-layer blocks are used to build ResNet-101 and ResNet-152.\n\n### Performance on ImageNet\n\n![ResNet paper Table 4: ImageNet single-model top-1 and top-5 validation errors](/content/papers/assets/d80f09a3bfc9b79b1ab790f3e6114b459e7cdf3ae2135f3a7708626589cc4d6d.jpg)\n\n*Paper Table 4: mostly single-model validation scores; the dagger-marked VGG (ILSVRC'14) 8.43% entry is a test-set result.*\n\nThe table above shows the performance of ResNet on ImageNet. The baseline 34-layer ResNet already achieves very competitive accuracy.\n\nAs the network depth increases, the 50/101/152-layer ResNets show significant improvements in accuracy over the 34-layer ResNet. No degradation problem is observed, and the benefits of depth are evident across all evaluation metrics.\n\nThe ResNet-152 row is a **single model** on ImageNet validation: **4.49%** top-5 error and **19.38%** top-1 error. One dagger-marked VGG row is from a test set and is not a matched validation comparison. The unpictured Table 5 instead reports a six-model ensemble's **3.57% top-5 test error**, the ILSVRC 2015 competition result; it is not this table's single-model score.\n\n## Conclusion\n\nBefore ResNet, training ever deeper networks was difficult. Residual learning offered a practical way to improve optimization: in the experiments here, adding shortcuts helped deeper networks avoid the rise in training error seen in their plain counterparts. That made very deep models feasible and quickly made ResNet a reference architecture.\n\nIts success inspired later designs such as DenseNet and ResNeXt, which continued to refine network structure and performance.\n\nResNet backbones later appeared in applications such as medical imaging, autonomous driving and surveillance. Those uses show the reach of the design, although this paper's own evidence comes from its image-recognition experiments.\n","imageSizes":{"/content/papers/assets/e400771cae578f9365b229baa7bbb4c74f5898f307439218bfcaa0368c947f9d.jpg":{"width":1260,"height":452},"/content/papers/assets/84ac0b0e37b09da1cb214a083fc5d8f9630780998c66a09b8338961eca4b3b8e.jpg":{"width":936,"height":380},"/content/papers/assets/b8fe87fe757249ea6d7bb667fef3196754b9f80e28bf842a69b540ca94585d08.jpg":{"width":1224,"height":408},"/content/papers/assets/9c5752a1e0635b240d3615fed155978fdd02a2423bf1a9cd36036d7f4ce04a23.jpg":{"width":818,"height":1864},"/content/papers/assets/d97cd88d856e56b344f44b6fa8f6b963333e2540423a032897a64e77829dcf56.jpg":{"width":1224,"height":536},"/content/papers/assets/020c8d031eb9c5fe3a2898fe4755bceddab79483062e9ff69e779cd6ba8b96c5.jpg":{"width":1224,"height":252},"/content/papers/assets/5ff0a2ec0a7d51a67616e7313e8caafdd3a2073982e36bc6946713a1172c8540.jpg":{"width":1224,"height":392},"/content/papers/assets/d80f09a3bfc9b79b1ab790f3e6114b459e7cdf3ae2135f3a7708626589cc4d6d.jpg":{"width":1224,"height":732}}}
