Inception: parallel branches and channel reduction
Inception 网络
Build all four Inception branches, derive when 1×1 reduction saves work, and separate a module from GoogLeNet training.
inceptionStart with an experiment
Should a visual feature look at one pixel, a three-by-three neighbourhood or a five-by-five neighbourhood? An Inception module computes several branches and concatenates their features. It does not run a competition that selects only one branch for each image: the branches in this module are all evaluated.
The complication is cost. Applying a large spatial kernel to every input channel can be expensive. The original design uses one-by-one convolutions to reduce channel width before selected larger filters. This trades representation capacity against arithmetic, so the reduction width is a model choice rather than a free optimization.
We will build one module, inspect all four branch outputs, and independently count its parameters and multiplication work. GoogLeNet is a particular network assembled from such modules; one working module is not a reproduced GoogLeNet training run.
The model and its assumptions
In the inspected module, the branches are a 1-by-1 convolution, a 1-by-1 reduction followed by 3-by-3 convolution, a 1-by-1 reduction followed by 5-by-5 convolution, and 3-by-3 max pooling followed by 1-by-1 projection. Convolutions use ReLU. With stride one and suitable padding, all branches retain H and W and can be concatenated along channels. Szegedy et al., 2015 D2L: Inception branches
If their final widths are , the output shape is:
Concatenation preserves separate channel slots. It differs from elementwise addition, which would require matching widths and combine values in the same slots. A 1-by-1 projection mixes channels at a pixel; it does not itself enlarge the spatial receptive field.
Compare a direct K-by-K convolution with one that first reduces channels to R. Ignoring biases, their weights and per-pixel multiply-accumulates are:
Reduction saves this arithmetic only if:
For eight inputs, four outputs, K=5 and R=2, the counts are 800 versus 216. Increasing R can erase that saving. The reduction is learned, but fewer channels can discard useful information; a parameter calculation cannot establish unchanged accuracy.
The paper’s listed GoogLeNet main network starts with three weighted stem layers and has nine Inception modules, each with a longest weighted path of two layers, then a classifier: . This depth convention is not a count of every convolution on every parallel branch. The architecture also uses intermediate downsampling and final average pooling. Szegedy et al., 2015
Auxiliary classifiers are attached to the 4 a and 4 d module outputs during training. Their weighted losses augment the main loss:
They are discarded at inference in the described system. This is a training design, not an instruction to average three predictions at deployment. The author discussion includes hypotheses and later control observations about these heads; we do not turn it into a guarantee that auxiliary losses solve every deep-network optimization problem. Szegedy et al., 2015
A complete small program
Run with Python 3.12 and NumPy 1.26.4. The complete module uses explicit same-size convolution and max-pool boundaries. Max-pool padding is negative infinity rather than zero so an artificial outside value cannot beat a negative real input. A real value remains in every tested window. The returned branch list makes the concatenation inspectable.
import numpy as np
def conv_same(image,weights,bias):
a,w,b=np.asarray(image,dtype=float),np.asarray(weights,dtype=float),np.asarray(bias,dtype=float)
if a.ndim!=3 or w.ndim!=4 or w.shape[2]!=w.shape[3] or w.shape[2]%2!=1 or a.shape[2]!=w.shape[1] or b.shape!=(w.shape[0],):
raise ValueError('need HWC image, square odd OIKK kernel and O bias')
if min(a.shape)<1 or min(w.shape)<1 or not all(np.isfinite(v).all() for v in (a,w,b)):
raise ValueError('finite nonempty arrays required')
radius=w.shape[2]//2
padded=np.pad(a,((radius,radius),(radius,radius),(0,0)))
windows=np.lib.stride_tricks.sliding_window_view(padded,w.shape[2:],axis=(0,1))
return np.einsum('hwcij,ocij->hwo',windows,w)+b
def pool_same(image):
a=np.asarray(image,dtype=float)
if a.ndim!=3 or min(a.shape)<1 or not np.isfinite(a).all():
raise ValueError('finite nonempty HWC input required')
padded=np.pad(a,((1,1),(1,1),(0,0)),constant_values=-np.inf)
return np.lib.stride_tricks.sliding_window_view(padded,(3,3),axis=(0,1)).max(axis=(-1,-2))
def init_module(incoming=8,widths=(2,3,4,2,3,2),seed=7):
if type(incoming) is not int or incoming<1 or len(widths)!=6 or any(type(n) is not int or n<1 for n in widths):
raise ValueError('need positive input width and six positive output/reduction widths')
c1,r3,c3,r5,c5,cp=widths;rng=np.random.default_rng(seed)
def layer(cin,cout,k):
return (rng.normal(size=(cout,cin,k,k))*np.sqrt(2/(cin*k*k)),np.zeros(cout))
return dict(one=layer(incoming,c1,1),reduce3=layer(incoming,r3,1),three=layer(r3,c3,3),
reduce5=layer(incoming,r5,1),five=layer(r5,c5,5),poolproj=layer(incoming,cp,1))
def forward(image,module):
def apply(a,name):return np.maximum(conv_same(a,*module[name]),0)
branches=[apply(image,'one'),apply(apply(image,'reduce3'),'three'),
apply(apply(image,'reduce5'),'five'),apply(pool_same(image),'poolproj')]
return np.concatenate(branches,axis=2),branches
def counts(module,height,width):
if any(type(n) is not int or n<1 for n in (height,width)):
raise ValueError('positive spatial dimensions required')
weights=sum(w.size for w,b in module.values())
parameters=weights+sum(b.size for w,b in module.values())
return parameters,height*width*weights
if __name__=='__main__':
model=init_module();a=np.random.default_rng(4).normal(size=(9,9,8))
out,branches=forward(a,model)
print('branch shapes:',[b.shape for b in branches]);print('concatenated:',out.shape)
print('parameters and convolution MACs:',counts(model,9,9))
print('5x5 weights, direct versus reduction:',8*4*25,8*2+2*4*25)
full=init_module(192,(64,96,128,16,32,32))
print('3a-shaped module parameters and MACs:',counts(full,28,28))
branch shapes: [(9, 9, 2), (9, 9, 4), (9, 9, 3), (9, 9, 2)]
concatenated: (9, 9, 11)
parameters and convolution MACs: (346, 26730)
5x5 weights, direct versus reduction: 800 216
3a-shaped module parameters and MACs: (163696, 128049152)
The small module has 330 kernel weights and 16 biases, so 346 trainable parameters. Its 81 spatial positions require 26730 convolution MACs. The 3 a-shaped configuration uses the paper’s stated widths, but the exact 163696 parameter count is our sum including biases; it is not copied from an approximate table entry. Its 128049152 MAC count excludes pooling comparisons, bias additions, ReLU and memory movement.
The checks compare 1-by-1,3-by-3 and 5-by-5 convolution with an independent literal reference, verify negative-valued pooling boundaries, inspect branch placement in the output, and check cost arithmetic and invalid dimensions. This program contains neither a full stem/module stack nor auxiliary training, dataset preprocessing or a trained classifier.
Limits and comparisons
Multiple spatial branches supply different local supports, but they do not automatically create scale invariance. A resized object can still activate different features or occupy a different part of the window. Compare this design with SIFT, which explicitly constructs local scale/orientation frames before description.
A narrow reduction can be a bottleneck in both the computational and informational senses. Conversely, adding a wide 1-by-1 layer can increase work. Concatenation also creates activation tensors that must be stored or recomputed, and practical latency depends on memory access and kernel implementations. The paper’s reported system-level speed comparisons cannot be inferred from this isolated module’s parameter count.
The word Inception refers to a design family, while GoogLeNet in the paper identifies a particular network instance. Later choices of filters, normalization or auxiliary heads need their own specification. An implementation that preserves output shape can still change the computation and invalidate compatibility with trained weights.
Exercises with answers
1. The four branches output 2,4,3 and 2 channels. What is the combined width?
Answer. Concatenation gives 11 channels while preserving the common spatial dimensions. Elementwise addition would require equal branch widths and would be a different operation.
2. Compute the five-by-five branch cost with Cin=8,Cout=4,R=2.
Answer. Direct weights are 25×8×4=800. Reduction plus spatial weights are 8×2+25×2×4=216, excluding biases.
3. Must a 1-by-1 reduction always save computation?
Answer. No. With the same example and R=32, the count becomes 8×32+25×32×4=3456, more than 800. The reduction width must satisfy the cost inequality.
4. Do the two auxiliary classifiers remain in the described inference network?
Answer. No. Their discounted losses contribute during training; the paper discards these heads for inference. They are not a required three-head prediction ensemble.
Sources and next steps
The CVPR 2015 paper provides the module construction, the listed main network and auxiliary-head account. The D 2 L module is a separate teaching explanation of the four paths and concatenation. We use those sources to specify operations; we neither copy their model implementations nor claim to reproduce their benchmark scores. Szegedy et al., 2015 D2L: Inception branches
Compare VGG for a regular sequential block and ResNet for residual addition. Channel concatenation, channel projection and residual summation solve different structural problems even when their diagrams look similar.
Make a prediction, then check
Branches with 2,4,3 and 2 channels are concatenated. How many output channels result?
Learning objectives
- Trace branch shapes and distinguish concatenation from addition.
- Derive reduction costs and interpret auxiliary heads within training/inference scope.
Prerequisites & connections
Explore related knowledge →References
- Going Deeper with Convolutions — CVPR 2015 method
Christian Szegedy; Wei Liu; Yangqing Jia; Pierre Sermanet; Scott Reed; Dragomir Anguelov; Dumitru Erhan; Vincent Vanhoucke; Andrew Rabinovich · 2015 - Dive into Deep Learning 1.0.3 — inception
Aston Zhang; Zachary C. Lipton; Mu Li; Alexander J. Smola
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Codex · 2026-09-07 · Codex single-AI-author technical check: bounded primary-source passages, explicit image classification experiments and CNN architecture models, executed programs, independent mathematical references, input boundaries and bilingual alignment. Not independent human or second-agent review; no full-system research reproduction claimed.
- Single-agent authored technical review; runnable example, exact or literal reference checks, explicit assumptions and matching bilingual equations/exercises. Automated execution and rendering results recorded separately.
- 6 tests: literal 1/3/5-kernel convolution, negative-valued pooling boundaries, four-branch concatenation, independently summed parameters/MACs including 3 a dimensions, reduction counterexample and invalid dimensions. Only one module is executed; auxiliary training and full GoogLeNet are not implemented.
- Single AI author compared both locales across six sections, assumptions, definitions, equations, executed code and output, four exercise/answer pairs and scoped citations.43 checks across six draft articles; not independent human review or full historical training reproduction.
- Complete bilingual prose and corresponding exercises promoted with formal status and SHA binding. Algorithm tests read formal MDX; historical essays claim no executable program or computational tests.
- Content validation rejected GoogLeNet/GoogleNet as duplicate aliases after case normalization. Retained canonical GoogLeNet in the formal alias table; original frozen metadata preserved. Prose, equations, code and search meaning unchanged.
- After visual reading review, shortened/localized inline citation labels. Verified ordered link targets and every protected code/math/tag span unchanged; full source identities remain in metadata. Frozen drafts preserved and final article SHA rebound.
Source locations checked:
- Going Deeper with Convolutions — CVPR 2015 method · CVPR2015 physical4–5: dimensionality reduction, concatenation, table1, auxiliary classifier placement/loss/inference.
- Dive into Deep Learning 1.0.3 — inception · Inception class, four branches and channel concatenation; no upstream execution.
Related topics