3.4.10 · D3Convolutional Neural Networks

Worked examples — DenseNet and EfficientNet

2,154 words10 min readBack to topic

This page is a calculator you can trust. The parent note gave you the formulas; here we run them through every kind of input — small blocks, big blocks, compression that rounds down, the degenerate "no bottleneck" case, exponential scaling that blows up, and the exam-twist where a number is hidden. Before touching a single example, let us list every situation these formulas can face.


The scenario matrix

Every problem in this topic is one of the cells below. If you can do all of them, nothing on an exam can surprise you.

Cell Case class What makes it tricky
A DenseNet channel counting, plain Running concatenation total
B Transition compression with clean division is a whole number
C Transition compression that rounds down — the floor bites
D Bottleneck vs. no-bottleneck parameter count when does beat ? (degenerate small- edge)
E Full network trace (multi-block, DenseNet-121 style) chaining A+B across 4 blocks
F EfficientNet constraint check () verifying a candidate triple
G EfficientNet compound scaling at a given exponential growth , resolution rounding
H Limiting / degenerate scaling (, one dimension only) what "no scaling" and "unbalanced scaling" cost
I Word problem (memory / FLOP budget) real-world units, choosing a config
J Exam twist (solve backwards for a hidden or ) invert the formula
Recall What does concatenation do to channel count that addition does not?

Concatenation ::: stacks channels, so counts add up (); ResNet addition keeps the channel count fixed.

Below, ten worked examples cover cells A–J. Each cell is labelled.


Example 1 — Cell A: plain channel counting

Forecast: guess the final number before reading. (Add four times to 16 — hold that thought.)

  1. Layer 1 sees , outputs new → running total . Why this step? Each produces exactly feature maps; concatenation appends them.
  2. Layer 2 sees 24, outputs 8. Why this step? Its input is everything so far — the concatenation .
  3. Layer 3 sees 32.
  4. Layer 4 sees 40.

Answer: output channels.

Verify: closed form . ✓ The step-by-step and the formula agree.


Example 2 — Cell B: compression, clean division

Forecast: half of 48 — will the floor matter here?

  1. Apply with , . Why this step? The transition's conv projects channels down to to keep growth in check.

Answer: 24 channels.

Verify: exactly — no rounding needed. Units: channels → channels. ✓


Example 3 — Cell C: compression that rounds down

Forecast: — you cannot have half a channel. What happens?

  1. Compute . Why this step? Raw product first, then floor — order matters.
  2. Apply the floor: . Why this step? Channel count must be a whole number; DenseNet uses (round down), never round-to-nearest.

Answer: 22 channels (not 23!).

Verify: . ✓


Example 4 — Cell D: bottleneck vs. no-bottleneck (degenerate small-)

Forecast: bottlenecks are famous for saving parameters — do they always?

Recall the two costs from the parent:

  • With bottleneck: (the ) (the on channels).
  • Without bottleneck: (a plain ).
  1. Late block, , :
    • With: .
    • Without: . Why this step? Plug into both formulas and compare totals. → Bottleneck saves parameters. Worth it.
  2. Early degenerate, , :
    • With: .
    • Without: . Why this step? Same formulas, tiny . Now the fixed term dominates. → Bottleneck is worse by params.

Answer: bottlenecks help when is large (deep in a block); at tiny the constant overhead makes them lose.

Verify: solve the break-even . For , . So above channels the bottleneck wins — consistent with "worse at 12, better at 300." ✓


Example 5 — Cell E: full DenseNet-121-style trace

Forecast: the parent quotes 256 → 128 → 512 → 256 → 1024 → 512 → 1024. Reproduce it.

  1. Block 1 out: . Why? Cell-A formula with .
  2. Transition 1: . Why? Cell-B compression.
  3. Block 2 out: .
  4. Transition 2: .
  5. Block 3 out: .
  6. Transition 3: .
  7. Block 4 out: (no transition follows → global average pool). Why this step for each? Alternate Cell A (block) and Cell B (transition) down the chain.

Answer: .

Verify: every arrow matches the parent's DenseNet-121 table. ✓


Example 6 — Cell F: EfficientNet constraint check

Forecast: the whole point is FLOPs doubling per -step — is this triple close to 2?

  1. Compute . Why? Width appears squared in FLOPs (input × output channels).
  2. Compute . Why? Resolution squared (spatial ).
  3. Multiply: . Why this step? This is — the per- FLOP multiplier.

Answer: , which rounds to within the "" tolerance. ✓ Valid.

Verify: , and . ✓


Example 7 — Cell G: compound scaling at (B7)

Forecast: exponentials at — expect roughly depth.

  1. Depth . Why? Depth scales as by definition of compound scaling. .
  2. Width . Why? Width scales as .
  3. Resolution . , so . Why this step? Resolution scales as off the 224 baseline.

Answer: depth , width , resolution px.

Verify: , , . ✓


Example 8 — Cell H: limiting / degenerate scaling

Forecast: should mean "do nothing." And pouring all budget into depth should waste it.

  1. : , , . Why? Anything to the power 0 is 1 — this is the B0 baseline, no scaling.
  2. Depth-only : FLOPs . Cost = 2× FLOPs. Why this step? Depth is linear in FLOPs.
  3. Balanced FLOPs (i.e. ): by construction FLOPs too — same cost, but spread across three dimensions. Why this step? The constraint was designed so one -step = 2× FLOPs.

Answer: (a) → the untouched baseline. (b) Both spend 2× FLOPs, but balanced scaling empirically gives higher accuracy — same budget, better spent. The degenerate depth-only choice is legal but suboptimal.

Verify: ; and , matching the depth-only 2×. ✓


Example 9 — Cell I: word / budget problem (with figure)

Forecast: solve for the biggest whole .

  1. Set inequality: . Why this step? Output channels grow as ; the cap is a hard memory limit.
  2. Solve: . Why this step? Isolate .
  3. Floor to whole layers: (since gives ). Why this step? You cannot have a fractional layer, and 5 overshoots.
  4. Actual output: channels. Compress: .

Answer: , block output , post-transition channels.

Figure — DenseNet and EfficientNet

The figure shows the running channel total climbing by each layer (burnt-orange steps), the plum ceiling at 100, and the teal drop to 44 after compression.

Verify: gives (rejected); gives (accepted); . ✓


Example 10 — Cell J: exam twist (solve backwards)

Forecast: invert each formula instead of plugging forward.

  1. Channel inversion: . Why this step? The output formula is linear in ; algebra recovers it.
  2. Scaling inversion: with . Take logs: . Why this step? is the exponent; the logarithm is the tool that "undoes" an exponent (it answers "what power gives this value?", exactly like arctan undoes tan).
  3. Evaluate: , , ratio . Why this step? , so cleanly.

Answer: , and .

Verify: forward-check both: ✓; ✓.


Recall Why is the logarithm the right tool to recover

from ? Because ::: sits in the exponent, and is the exact inverse of exponentiation — it asks "which power produced this number?"

Connections