{"notes":[{"id":"reparameterization/dbb","category":"reparameterization","legacyPath":"reparameterization/2103-dbb","legacySlug":"2103-dbb","legacyPaths":[],"title":"DBB","subtitle":"Six Disciples","author":"Z. Yuan","paperDate":"2021-03-24","publishedOn":"2025-02-07","paperTitle":"Diverse Branch Block: Building a Convolution as an Inception-like Unit","paperUrl":"https://arxiv.org/abs/2103.13425","bibliography":{"title":"Diverse Branch Block: Building a Convolution as an Inception-like Unit","authors":["Xiaohan Ding","Xiangyu Zhang","Jungong Han","Guiguang Ding"],"url":"https://arxiv.org/abs/2103.13425","pdfUrl":"https://arxiv.org/pdf/2103.13425","codeUrl":null,"preprint":{"id":"2103.13425","submittedOn":"2021-03-24","url":"https://arxiv.org/abs/2103.13425"},"publication":{"venue":"CVPR","year":2021,"kind":"conference","url":"https://arxiv.org/abs/2103.13425"},"citation":"@misc{reparameterizationdbb2021,\n  title = {{Diverse Branch Block: Building a Convolution as an Inception-like Unit}},\n  author = {Xiaohan Ding and Xiangyu Zhang and Jungong Han and Guiguang Ding},\n  year = {2021},\n  eprint = {2103.13425},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2103.13425}\n}\n","citationPath":"/content/papers/citations/reparameterization/dbb.577c41e6ebd5.bib"},"thumbnail":{"src":"/content/papers/assets/7c460ee5b5fb61e8043a7e8fc9e566fe1bb68ebbdc31c8f4dae2a86b3b5f0bf0.jpg","width":1190,"height":460},"locale":"en","path":"/content/papers/en/reparameterization/dbb.5370300db724.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"solution","text":"Solution","depth":2},{"id":"type-one-conv-bn","text":"Type One: Conv-BN","depth":3},{"id":"type-two-branch-add","text":"Type Two: Branch Add","depth":3},{"id":"type-three-sequential-conv","text":"Type Three: Sequential Conv","depth":3},{"id":"type-four-depth-concat","text":"Type Four: Depth Concat","depth":3},{"id":"type-five-average-pooling","text":"Type Five: Average Pooling","depth":3},{"id":"type-six-multi-scale-conv","text":"Type Six: Multi-scale Conv","depth":3},{"id":"experimental-setup","text":"Experimental Setup","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"comparison-with-other-methods","text":"Comparison with Other Methods","depth":3},{"id":"ablation-study","text":"Ablation Study","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"tags":["reparameterization","image-classification","classic-cnns","tsinghua"],"relatedReading":[{"id":"reparameterization/repvgg","relation":"background","topic":"Merging training branches for inference"},{"id":"reparameterization/mobileone","relation":"next","topic":"Merging training branches for inference"}]},{"id":"reparameterization/repvgg","category":"reparameterization","legacyPath":"reparameterization/2101-repvgg","legacySlug":"2101-repvgg","legacyPaths":[],"title":"RepVGG","subtitle":"Making VGG Great Again","author":"Z. Yuan","paperDate":"2021-01-11","publishedOn":"2024-07-15","paperTitle":"RepVGG: Making VGG-style ConvNets Great Again","paperUrl":"https://arxiv.org/abs/2101.03697","bibliography":{"title":"RepVGG: Making VGG-style ConvNets Great Again","authors":["Xiaohan Ding","Xiangyu Zhang","Ningning Ma","Jungong Han","Guiguang Ding","Jian Sun"],"url":"https://arxiv.org/abs/2101.03697","pdfUrl":"https://arxiv.org/pdf/2101.03697","codeUrl":null,"preprint":{"id":"2101.03697","submittedOn":"2021-01-11","url":"https://arxiv.org/abs/2101.03697"},"publication":{"venue":"CVPR","year":2021,"kind":"conference","url":"https://arxiv.org/abs/2101.03697"},"citation":"@misc{reparameterizationrepvgg2021,\n  title = {{RepVGG: Making VGG-style ConvNets Great Again}},\n  author = {Xiaohan Ding and Xiangyu Zhang and Ningning Ma and Jungong Han and Guiguang Ding and Jian Sun},\n  year = {2021},\n  eprint = {2101.03697},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2101.03697}\n}\n","citationPath":"/content/papers/citations/reparameterization/repvgg.a8a729b9514b.bib"},"thumbnail":{"src":"/content/papers/assets/ed80741f073c5691ee7165b3b5d340699a61a3e3cd389dcffc84bea436b09836.jpg","width":1224,"height":968},"locale":"en","path":"/content/papers/en/reparameterization/repvgg.04b60bdf3b00.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"high-memory-usage","text":"High Memory Usage","depth":3},{"id":"slow-inference-speed","text":"Slow Inference Speed","depth":3},{"id":"however","text":"However...","depth":3},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"reparameterization","text":"Reparameterization","depth":3},{"id":"parameter-configuration","text":"Parameter Configuration","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"imagenet-performance","text":"ImageNet Performance","depth":3},{"id":"ablation-experiments","text":"Ablation Experiments","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"tags":["reparameterization","image-classification","classic-cnns","real-time","tsinghua","megvii"],"relatedReading":[{"id":"reparameterization/dbb","relation":"next","topic":"Merging training branches for inference"},{"id":"reparameterization/qarepvgg","relation":"next","topic":"Quantizing reparameterized networks"}]},{"id":"reparameterization/mobileone","category":"reparameterization","legacyPath":"reparameterization/2206-mobileone","legacySlug":"2206-mobileone","legacyPaths":[],"title":"MobileOne","subtitle":"One Millisecond Optimization","author":"Z. Yuan","paperDate":"2022-06-08","publishedOn":"2024-07-16","paperTitle":"MobileOne: An Improved One millisecond Mobile Backbone","paperUrl":"https://arxiv.org/abs/2206.04040","bibliography":{"title":"MobileOne: An Improved One millisecond Mobile Backbone","authors":["Pavan Kumar Anasosalu Vasu","James Gabriel","Jeff Zhu","Oncel Tuzel","Anurag Ranjan"],"url":"https://arxiv.org/abs/2206.04040","pdfUrl":"https://arxiv.org/pdf/2206.04040","codeUrl":null,"preprint":{"id":"2206.04040","submittedOn":"2022-06-08","url":"https://arxiv.org/abs/2206.04040"},"publication":{"venue":"CVPR","year":2023,"kind":"conference","url":"https://arxiv.org/abs/2206.04040"},"citation":"@misc{reparameterizationmobileone2022,\n  title = {{MobileOne: An Improved One millisecond Mobile Backbone}},\n  author = {Pavan Kumar Anasosalu Vasu and James Gabriel and Jeff Zhu and Oncel Tuzel and Anurag Ranjan},\n  year = {2022},\n  eprint = {2206.04040},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2206.04040}\n}\n","citationPath":"/content/papers/citations/reparameterization/mobileone.cbade423cf61.bib"},"thumbnail":{"src":"/content/papers/assets/f1d3676416f16224fbdba82b7113b2c4894d48fee9149dd2c8bc61fe781b22e2.jpg","width":840,"height":976},"locale":"en","path":"/content/papers/en/reparameterization/mobileone.247ee1e1848d.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"problem-solving","text":"Problem Solving","depth":2},{"id":"bottleneck-analysis---activation-functions","text":"Bottleneck Analysis - Activation Functions","depth":3},{"id":"bottleneck-analysis---architecture","text":"Bottleneck Analysis - Architecture","depth":3},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"model-configuration","text":"Model Configuration","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"imagenet-performance","text":"ImageNet Performance","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"tags":["reparameterization","image-classification","classic-cnns","lightweight","real-time","apple"],"relatedReading":[{"id":"reparameterization/dbb","relation":"background","topic":"Merging training branches for inference"},{"id":"reparameterization/fastvit","relation":"comparison","topic":"Fast visual backbones for deployment"},{"id":"reparameterization/repvit","relation":"comparison","topic":"Fast visual backbones for deployment"}]}],"text":"After reading this paper, I never found the time to organize my thoughts.\n\nNow, let's discuss the content of this paper.\n\n## Problem Definition\n\nDo you remember RepVGG?\n\nTo briefly recap, \"re-parameterization\" refers to using more complex structures or multiple branches during training to learn diverse feature representations. After the model is trained, these complex structures' parameters are integrated and merged into a simplified model, so that during inference, it retains the efficiency of a \"single-path convolution.\"\n\nRepVGG is a representative of this concept, as shown in the diagram below:\n\n\n\n![repvgg](/content/papers/assets/1f3ba1cd2ffd91091315fd249caf027989ca667b188261f621b2bac077b18748.jpg)\n\n\n\nDuring training, additional 1×1 convolutions, identity branches, etc., are introduced. Finally, they are all \"condensed\" into pure 3×3 convolution layers, making the inference structure regular and easy to optimize like VGG; parameter count remains a separate design consideration.\n\n\n> [!TIP]\n> \n> If you're unfamiliar with the concept of re-parameterization, we recommend you first read the RepVGG paper:\n> \n> - [**[21.01] RepVGG: Making VGG Great Again**](/blog/papers/reparameterization/repvgg)\n\n\nAfter reading RepVGG, you might wonder whether this branch design could be even more diverse.\n\nThe authors of this paper thought the same way, perhaps we can find a more diverse design that allows the model to learn more varied features during training:\n\n- **As long as we can consolidate them into a single branch during inference, it's worth considering!**\n\nBased on this goal, the authors ultimately proposed six composable equivalence transformations, not six mandatory branches in every DBB.\n\n## Solution\n\n\n\n![dbb](/content/papers/assets/7c460ee5b5fb61e8043a7e8fc9e566fe1bb68ebbdc31c8f4dae2a86b3b5f0bf0.jpg)\n\n\n\n### Type One: Conv-BN\n\nCommon convolution layers are often followed by a Batch Normalization (BN) layer, i.e., \"conv → BN.\"\n\nDuring inference, BN can be viewed as \"performing an affine transformation on the same output channel with fixed statistics\": subtracting the channel mean $\\mu_j$, dividing by the standard deviation $\\sigma_j$, multiplying by the learned coefficient $\\gamma_j$, and adding the bias $\\beta_j$.\n\nWe can merge BN with the preceding convolution into a new convolution kernel and bias using \"homogeneity and additivity,\" as follows:\n\n$$\nF'_j \\;\\leftarrow\\; \\frac{\\gamma_j}{\\sigma_j} \\, F_j,\\quad\nb'_j \\;\\leftarrow\\; -\\,\\frac{\\mu_j \\,\\gamma_j}{\\sigma_j} \\;+\\; \\beta_j.\n$$\n\nThis assumes a bias-free convolution and $\\sigma_j=\\sqrt{\\mathrm{running\\_var}_j+\\epsilon}$. With an existing convolution bias $b_j$, use $b^{\\prime}_j=(b_j-\\mu_j)\\gamma_j/\\sigma_j+\\beta_j$. BN must use fixed evaluation statistics.\n\nThis way, there's no need to explicitly separate \"convolution + BN\" during inference, but instead directly use the new convolution kernel $F'_j$ and new bias $b'_j$.\n\n### Type Two: Branch Add\n\nBranch addition refers to adding the outputs of two convolutions with the same configuration (e.g., same kernel size, same number of channels).\n\nFrom additivity, after applying \"Type One\" to both convolutions, if their kernels are $F^{(1)}, F^{(2)}$ and biases are $b^{(1)}, b^{(2)}$, the merged result is:\n\n$$\nF^{(0)} \\;\\leftarrow\\; F^{(1)} + F^{(2)},\\quad\nb^{(0)} \\;\\leftarrow\\; b^{(1)} + b^{(2)}\n$$\n\nThe branches must first be compatible affine convolutions with shared inputs, stride, groups and spatial alignment. Arbitrary nonlinear activations inside a branch prevent this kernel-sum fusion.\n\n### Type Three: Sequential Conv\n\nFor sequential convolution layers, such as \"1 × 1 conv → BN → K × K conv → BN,\" they can also be merged into an equivalent K × K convolution. The merging process is as follows:\n\n1. First, merge the 1 × 1 conv + BN into an equivalent 1 × 1 convolution (obtaining $F^{(1)}, b^{(1)}$).\n2. Then, merge the K × K conv + BN into another equivalent K × K convolution (obtaining $F^{(2)}, b^{(2)}$).\n3. Finally, combine these two layers.\n\nWith stride 1, the first 1×1 convolution mixes channels without changing spatial resolution. Fusion composes these linear maps rather than merely transposing a matrix. The first bias is weighted by the second kernel and added to the second bias.\n\nAfter organizing, we get a new K × K convolution $F^{(0)}, b^{(0)}$, completing the merging of sequential layers.\n\n\n> [!TIP]\n> \n> **Padding Issue**\n> \n> The problem is not simply that padding both layers adds a ring. The first layer already has a bias. Zero-padding its output before the second convolution omits that bias at the boundary, so a fused convolution with a single constant bias can give different edge values.\n> \n> The paper gives two equivalent designs: pad the input before the first layer and leave the second unpadded, or pad the intermediate output with the channel-wise value $b^{(1)}$. BN folding and boundary handling must be treated together.\n\n\n### Type Four: Depth Concat\n\n\n\n![depth-concat](/content/papers/assets/ba3842e2d586582a99e52cf57e55effade6135f5ee720c69ddb1ab2dc3d9336f.jpg)\n\n\n\nInception-like structures often use \"depth concatenation\" to combine the outputs of multiple branches along the channel dimension.\n\nIf these branches are simply \"convolutions\" and spatially aligned, we can directly concatenate their convolution kernels along the output dimension:\n\n$$\nF^{(0)} \\;\\leftarrow\\; \\mathrm{CONCAT}\\bigl(F^{(1)}, F^{(2)}\\bigr),\n\\quad\nb^{(0)} \\;\\leftarrow\\; \\mathrm{CONCAT}\\bigl(b^{(1)}, b^{(2)}\\bigr).\n$$\n\nThis is equivalent to merging all the original output channels into a single large convolution. A similar approach can be applied to grouped convolutions, where channel-wise splitting and merging are performed.\n\n### Type Five: Average Pooling\n\nAverage pooling can actually be considered a special type of convolution.\n\nIf we have a pooling kernel of size $K \\times K$, it is equivalent to a convolution with a kernel of the same size, where all $K^2$ spatial positions for matching input/output channels have weight $1/K^2$, and cross-channel weights are zero:\n\n$$\nF_{d,c,:,:} =\n\\begin{cases}\n1/K^2, & \\text{if } d=c,\\\\\n0, & \\text{otherwise}.\n\\end{cases}\n$$\n\nThis requires a fixed denominator of $K^2$ at every location and matching padding. Boundary rules that exclude padding and change the divisor cannot be represented by this fixed kernel directly. Stride 1 smooths; larger strides also downsample.\n\nTherefore, if average pooling is used in a branch, it can be directly converted into a fixed-parameter convolution kernel and then combined with other branches using the previously discussed transformations (such as additivity).\n\n### Type Six: Multi-scale Conv\n\n\n\n![multi-scale](/content/papers/assets/5f53911e158f386206e44d96bd9a4fcd2a4c97d8a99aaa7dc818fb22c376aa73.jpg)\n\n\n\nIf the network contains convolution kernels of different sizes (e.g., $1 \\times 1$, $1 \\times K$, $K \\times 1$, $k_h \\times k_w$, etc.), they can all be viewed as cases where certain positions in a $K \\times K$ convolution kernel are \"zero-padded.\"\n\nIn this way, all different sizes (as long as they are not larger than $K \\times K$) can be \"expanded\" to the same $K \\times K$ convolution kernel dimension, keeping them aligned, and ultimately merged additively.\n\n### Experimental Setup\n\n![expirement](/content/papers/assets/6f42368293a9ff81eb68fc6ba2209aeafad5563bf4b675f8826514921d5a6dd7.jpg)\n\nThe table above summarizes the experimental configuration.\n\nThe authors used standard data augmentation on CIFAR-10/100, including expanding images to 40×40, random cropping, and horizontal flipping. For quick feasibility verification, VGG-16 was chosen, and following the ACNet approach, the original two FC layers were replaced with global average pooling, followed by a single fully connected layer with 512 neurons. For fair comparison, BN was added to each convolution layer of VGG.\n\nImageNet-1K contains 1.28 million training images and 50,000 validation images. Small models (AlexNet, MobileNet) used standard augmentation (random cropping and flipping), while ResNet-18/50 also included color jitter and lighting variations. AlexNet was designed similarly to ACNet, without local response normalization (LRN), and BN was added after each convolution. The learning rate for both CIFAR and ImageNet was adjusted using cosine annealing (initial value 0.1).\n\nFor COCO detection, CenterNet was used, trained for 126k iterations with an initial learning rate of 0.02, decaying by 0.1 at 81k and 108k iterations. Cityscapes semantic segmentation followed the official PSPNet settings, using a poly learning rate strategy (base 0.01, exponent 0.9), for a total of 200 epochs.\n\nIn all architectures, the authors replaced K×K convolutions (1 < K < 7) and subsequent BN layers with DBB, forming DBB-Net. Larger convolutions (e.g., 7×7, 11×11) were not included in the experiment, as they are less frequently used in model design. All models were trained under the same configuration, and DBB-Net was eventually converted back to the original structure for testing. All experiments were conducted in PyTorch.\n\n## Discussion\n\n### Comparison with Other Methods\n\n\n\n![compare](/content/papers/assets/7a4c7f5d872da96a0b4df95a1e4d8f844df90b2db926d4551362e6ab9c88e56a.jpg)\n\n\n\nThe experimental results, as shown in the table above, demonstrate significant and consistent performance improvements with DBB-Net on both CIFAR and ImageNet:\n\n- VGG-16 improved by 0.67 and 1.67 percentage points on CIFAR-10 and CIFAR-100,\n- AlexNet improved by 1.96 percentage points on ImageNet,\n- MobileNet improved by 0.99 percentage points,\n- ResNet-18/50 improved by 1.45/0.57 percentage points.\n\nACNet, which theoretically is a special case of DBB, performed worse than DBB in the experiments, indicating that merging paths of varying complexity, similar to Inception, is more beneficial than relying solely on multi-scale convolution feature aggregation.\n\n### Ablation Study\n\n\n\n![ablation](/content/papers/assets/1e548e3fda8fa965b355d5e2aec317a22d09f340c59f2d03d11b192a5d8f5fe2.jpg)\n\n\n\nThe authors conducted a series of ablation experiments based on ResNet-18 to validate the importance of diverse connections and non-linearity during training.\n\nThe results show that removing any branch of DBB leads to a decrease in performance, showing that each branch helps in this experiment, rather than establishing that all are indispensable for every task. Additionally, even with only three branches, the accuracy exceeds 70%, demonstrating the effectiveness of diversified structures. In resource-constrained scenarios, retaining the main K×K convolution and adding only 1×1 and 1×1−AVG branches can build a lightweight DBB, with only a slight decrease in accuracy but significantly better training efficiency.\n\nFurther comparison between DBB and duplicate blocks reveals that even with fewer training parameters, DBB outperforms structures with duplicated convolutions. For instance, the accuracy of the (K×K + 1×1) combination (70.15%) is higher than double K×K (69.81%), showing that a weaker component combined with a stronger one is more advantageous than two equally strong components.\n\nSimilarly, DBB with (K×K + 1×1 + 1×1−AVG) (70.40%) outperformed triple K×K (70.29%), even though the latter's training parameters are 2.3 times larger, further proving that the diversity of connections is more important than merely increasing the number of parameters.\n\nTo confirm that these improvements were not solely due to different initializations, the authors created a \"baseline + init\" control group, initializing ResNet-18 with convolutions obtained by merging a randomly initialized, untrained DBB-Net and training under the same settings. The final accuracy (69.67%) was comparable to the baseline with standard initialization, indicating that the performance improvement was not due to initialization strategies.\n\nFinally, the authors also analyzed the impact of BN on the non-linearity during training.\n\nWhen BN was moved to after the branch addition, making the branches before the sum purely linear during training (the post-sum BN remains), the performance improvement was significantly reduced. For example, the accuracy of the (K×K + 1×1) DBB under this condition was only 69.83%, lower than the original DBB (70.15%). This shows that even without considering training non-linearity, diversified branches still improve model performance, but the non-linear structure with BN further enhances the learning capability.\n\nThe experiments also examined training and test speeds. On eight 1080Ti GPUs, full DBB training throughput falls from **4.44 to 4.06 batches/s**. Before branch fusion, single-GPU test throughput falls from **19.24 to 4.11 batches/s**. The converted networks have the same inference structure as their baselines, so neither the training speed nor the unfused test speed is the deployed model's speed.\n\n## Conclusion\n\nThis study presents a novel convolutional neural network building module: **DBB (Diverse Branch Block)**, which enables the fusion of diversified branches through a single convolution.\n\nThe experiments demonstrate that DBB can effectively improve the performance of existing architectures without increasing inference costs. The key factors contributing to DBB's superiority over regular convolution layers are diversified connections and non-linearity during training. This research provides new directions for future network designs, showcasing a more flexible and efficient approach to convolution computation.\n","imageSizes":{"/content/papers/assets/1f3ba1cd2ffd91091315fd249caf027989ca667b188261f621b2bac077b18748.jpg":{"width":1120,"height":1080},"/content/papers/assets/7c460ee5b5fb61e8043a7e8fc9e566fe1bb68ebbdc31c8f4dae2a86b3b5f0bf0.jpg":{"width":1190,"height":460},"/content/papers/assets/ba3842e2d586582a99e52cf57e55effade6135f5ee720c69ddb1ab2dc3d9336f.jpg":{"width":936,"height":812},"/content/papers/assets/5f53911e158f386206e44d96bd9a4fcd2a4c97d8a99aaa7dc818fb22c376aa73.jpg":{"width":974,"height":346},"/content/papers/assets/6f42368293a9ff81eb68fc6ba2209aeafad5563bf4b675f8826514921d5a6dd7.jpg":{"width":1224,"height":264},"/content/papers/assets/7a4c7f5d872da96a0b4df95a1e4d8f844df90b2db926d4551362e6ab9c88e56a.jpg":{"width":1224,"height":392},"/content/papers/assets/1e548e3fda8fa965b355d5e2aec317a22d09f340c59f2d03d11b192a5d8f5fe2.jpg":{"width":1296,"height":566}}}
