VGG-16 Explained: Architecture, Cost, and When It Still Fits Production

VGG16 architecture block by block: 13 conv and 3 FC layers, where its 138M parameters and its compute sit, why ResNet replaced it, and when it still fits.

VGG-16 Explained: Architecture, Cost, and When It Still Fits Production
Written by TechnoLynx Published on 30 Aug 2026

The VGG16 architecture is a plain stack of 13 convolutional layers using 3×3 filters, grouped into five blocks that each end in a 2×2 max-pool, followed by three fully connected layers of 4096, 4096 and 1000 units and a softmax. That simple layout holds about 138 million parameters, and roughly three-quarters of them sit in one layer: the first fully connected one. Memory and compute live at the other end of the network, in the early convolutions. That split shapes what VGG16 costs to store and what it costs to run.

The VGG16 Architecture, Block by Block

Every convolution in VGG16 is a 3×3 filter with stride 1 and padding 1, and every pooling layer is a 2×2 max-pool with stride 2 and no padding. The output-size formula (W − F + 2P)/S + 1 shows that a 3×3 convolution with padding 1 and stride 1 keeps the spatial size unchanged, so only the pools shrink the feature map, halving width and height each time while keeping the channel count. Channel width starts at 64 and doubles after each max-pool until it reaches 512.

Stage Layers Channels Output size
Block 1 2 conv (3×3) + max-pool 64 112×112×64
Block 2 2 conv (3×3) + max-pool 128 56×56×128
Block 3 3 conv (3×3) + max-pool 256 28×28×256
Block 4 3 conv (3×3) + max-pool 512 14×14×512
Block 5 3 conv (3×3) + max-pool 512 7×7×512
Classifier FC 4096, FC 4096, FC 1000, softmax n/a 1000 class probabilities

The 2-2-3-3-3 split of convolutions across the blocks and the spatial sizes follow from the published configuration and five halvings of 224 (224 / 2⁵ = 7). The original paper trained on fixed 224×224 RGB crops, with subtraction of the training-set mean RGB value as the only preprocessing.

Why stack small filters instead of using big ones? Two stacked 3×3 layers see the same 5×5 region as a single 5×5 layer, but with fewer weights (2 × 9C² against 25C² for C channels) and an extra ReLU between them. VGG was the network that moved the standard kernel from AlexNet’s 11×11 down to 3×3, and 3×3 stayed the default until ConvNeXt revisited it in 2022. Simonyan and Zisserman’s main contribution was showing that pushing a classical ConvNet to 16 to 19 weight layers with these small filters gave a large improvement over earlier configurations.

How Many Layers and Parameters Does VGG16 Have?

VGG16 has 16 weight layers, 13 convolutional and 3 fully connected; the five max-pool layers and the softmax carry no weights and are not counted in the name. Torchvision’s reference implementation reports exactly 138,357,544 parameters. The original paper lists 138 million for configuration D (VGG16) against 144 million for configuration E, the 19-layer VGG19.

Worked Example: Where the 138M Parameters Sit

The arithmetic follows from the layer shapes in the table above, counting weights plus biases:

  1. FC6: the 7×7×512 output of block 5 flattens to 25,088 values, so FC6 holds 25,088 × 4,096 + 4,096 = 102,764,544 parameters.
  2. FC7: 4,096 × 4,096 + 4,096 = 16,781,312 parameters.
  3. FC8: 4,096 × 1,000 + 1,000 = 4,097,000 parameters.
  4. Classifier total: 123,642,856 parameters, about 89% of torchvision’s 138,357,544.
  5. All 13 convolutional layers together: 138,357,544 − 123,642,856 = 14,714,688 parameters, roughly 11%.

That matches the Stanford CS231n notes, which put roughly 100M of VGGNet’s approximately 140M weights in the first fully connected layer. CS231n also notes that these fully connected layers were later found removable with no performance downgrade. A 2018 pruning study calls the redundancy in the three 4096-dimensional layers “very obvious” and cuts one of them entirely.

Memory and FLOPs Live in the Early Convolutions, Not the Classifier

The parameter split is the opposite of the cost split. CS231n’s per-layer walk-through of VGGNet notes that most of the memory and compute time go to the early convolutional layers, while most of the parameters sit in the last fully connected layers. A single image’s forward activations come to about 24 million values, or roughly 93 MB in FP32, and about twice that once backward-pass storage is added.

During training, larger batches increase that memory allocation. In the vDNN study (Rhu et al., 2016), the intermediate feature maps and workspace took an order of magnitude more memory than the weights of each layer, and the feature extraction layers accounted for 96% of VGG16’s memory at batch size 256. The same study measured about 15 GB for batch 128 and 28 GB for batch 256, so a 12 GB NVIDIA Titan X could hold only batch 64 without parallelisation or memory virtualisation.

Compute follows the same pattern. Torchvision lists VGG16 at 15.47 GFLOPS per image, He et al. (2015) give 15.3 billion multiply-adds, and a 2018 pruning paper states that more than 90% of VGG16’s FLOPs sit in its convolutional layers.

One number makes the practical consequence concrete: torchvision lists the 138,357,544-parameter VGG16 file at 527.8 MB.

The implication is easy to miss. Dropping or shrinking the fully connected head cuts the model file by most of its size but leaves untouched the early convolutions, where most of the compute time goes.

How Slow Is VGG16 Inference Compared with ResNet-50 and Mobile Networks?

On CPU, a 2021 transfer-learning study for mobile robotics measured VGG16 at 38.63 seconds to process a batch of 32 images, against 12.17 seconds for ResNet-50 and between 1.97 and 2.53 seconds for MobileNetV3. The same study puts VGG16 at 138.3M parameters against 25.5M for ResNet-50. Canziani et al. (2016) found the operation count a reliable estimate of inference time across the networks they analysed.

Where the model has to stay and the latency has to come down, TechnoLynx’s GPU Performance Engineering work makes workloads faster and cheaper on the target hardware through kernels, memory, compilers and profiling.

The 2021 robotics study reports a theoretical 25.98 frames per second for VGG16 on a Jetson Nano 4GB, and a 68% throughput gain from FP16 over FP32. Its authors still concluded that inference accelerators cannot bring VGG16 or ResNet-50 to real-time levels for their place-recognition task. A 2020 benchmark of AI frameworks on phones called VGG16 extremely slow on mobile devices and too heavy to use there. Bianco et al. (2018) benchmark memory and inference time across representative networks on a Titan X Pascal and a Jetson TX1, which is a useful reference when comparing backbones across very different compute budgets.

As a detection backbone, VGG16 takes most of the time budget. In Faster R-CNN the VGG16 convolutions took 141 ms of a 198 ms total per image (5 fps on a GPU), and the SSD authors report that about 80% of forward time is spent in the VGG16 base network.

Why Did ResNet Replace VGG16?

ResNet addressed the degradation problem that stopped plain stacks from getting deeper, and did so at lower complexity than VGG. He et al. (2015) showed that past a certain depth, adding layers to a plain network raised training error, a degradation that was not caused by overfitting. Residual learning lets stacked layers fit a residual mapping through identity shortcuts, and those shortcuts add neither parameters nor computation.

The cost numbers show why the switch was easy to justify:

  • Compute: the 152-layer ResNet needs 11.3 billion FLOPs against 15.3 billion for VGG16, and the 34-layer baseline needs 3.6 billion, 18% of VGG19’s 19.6 billion.
  • Parameters: ResNet ends in global average pooling and a single 1000-way fully connected layer, with no hidden fully connected layers. That removes the 4096-wide head that holds most of VGG16’s weights.
  • Accuracy: in the PyTorch model zoo, ResNet-50 beats VGG16 by around 3% top-1 on ImageNet, as cited in a 2018 pruning paper. Torchvision lists VGG16 at 71.592% top-1.
  • Detection: swapping VGG16 for ResNet-101 in the same Faster R-CNN pipeline raised COCO mAP@[.5, .95] by 6.0 points, a 28% relative improvement that the authors attribute solely to the better features.

ResNet-50’s robustness to vanishing gradients made it one of the most adopted architectures for transfer learning, and it replaced VGG16 as the main backbone for that use. CS231n described ResNets as the default choice in practice as early as May 2016. Inception and DenseNet also helped make VGG obsolete; the GoogLeNet Inception architecture took the opposite route to VGG, cutting parameters to about 4M through its Inception module.

Can VGG16 Take Images That Are Not 224×224?

Yes, but only the convolutional part of the network is size-agnostic. The fully connected head is not. FC6 expects exactly 25,088 inputs (7×7×512), so any input that does not reduce to a 7×7 map after five pools breaks the weight shape. There are two ways around it.

Drop the head. Keras exposes this as include_top=False, which accepts any 3-channel input no smaller than 32×32, such as (200, 200, 3); with include_top=True the input must be (224, 224, 3). The 32-pixel minimum is the five halvings again: 32 / 2⁵ = 1, a 1×1 map.

Convert the head to convolutions. The original paper turned FC6 into a 7×7 convolution and FC7 and FC8 into 1×1 convolutions, so the network can run on a whole uncropped image and return a class score map whose spatial size depends on the input. Long et al. used the same move for Fully Convolutional Networks, recasting VGG16 to take input of any size for semantic segmentation. The pretrained weights carry over, because the convolution kernels are the FC weights reshaped.

Three cautions apply. Scale matters: VGG’s own authors found that training with scale jittering (smallest side between 256 and 512) clearly beat fixed-scale training, even when testing at a single scale. Larger inputs raise the cost: one scene-recognition model ran VGG16 feature encoding at 448×448, four times the pixels of 224×224. Changing strides inside the network is also costly: the FCN authors found that setting pool5 to stride 1 forced a 14×14 FC6 kernel that was expensive and hard to learn. Whatever the size, keep the preprocessing the weights were trained with, which in the original paper meant mean RGB subtraction.

When VGG16 Still Earns a Place in a Production Vision System

VGG16 is rarely the right fresh choice for a new backbone, but it is not dead weight either. Its strengths are real: its simplicity makes it easy to fine-tune while still giving good accuracy, it showed no major accuracy drop under post-training quantisation in the 2021 robotics study, and it kept good robustness to viewpoint and lighting changes after quantisation. It also prunes well; one 2018 method cut its FLOPs by up to 5.0× with little accuracy loss on ImageNet.

Situation fit? Reasoning
An existing, validated pipeline built on VGG16 features Often yes, optimise rather than replace Re-validating a new backbone can cost more than FP16, pruning and head removal
Feature extraction or fine-tuning on a small dataset, with GPU inference Acceptable Easy to fine-tune; 4096-D penultimate features transferred well in the original paper
Mobile, phone or tight edge latency budgets No Measured as too slow on mobile and not real-time even with accelerators
New detection or segmentation backbone Usually no ResNet-101 beat VGG16 by 6.0 COCO mAP points in the same detector
You want VGG’s plain 3×3 inference body for deployment Consider RepVGG Plain 3×3 + ReLU at inference, faster than ResNet-50 on a 1080Ti
Storage-constrained deployment of a VGG16 classifier Yes, if the head goes The fully connected layers hold about 89% of parameters and can be removed

For feature extraction, the original authors removed the 1000-way layer and used the 4096-dimensional penultimate activations as image features, which set the state of the art on VOC classification at the time. Faster R-CNN, SSD and FCN built on VGG16.

RepVGG (Ding et al., 2021) is an updated version of the VGG architecture. It trains a multi-branch model and re-parameterises it into an inference body of nothing but 3×3 convolutions and ReLU. On an NVIDIA 1080Ti, RepVGG models ran 83% faster than ResNet-50 with higher accuracy. If the backbone choice is open, the comparison worth running is among residual CNNs, lightweight vision models and the vision transformer versus CNN detector trade-off, not VGG16 against any of them. TechnoLynx’s computer vision R&D team builds and benchmarks these backbone options for production vision systems.

Separating VGG16’s Weights from VGG’s Shape

Most VGG16 decisions get clearer once you split two things the name runs together. If you depend on the trained weights (a pipeline already validated on VGG16 features), keep the model and attack its cost where it actually sits: the convolutions for latency, the head for storage. If what you value is the shape (plain 3×3 stacks), RepVGG keeps it and ran faster than ResNet-50 with higher accuracy. If neither applies, ResNet-50 runs in about a third of VGG16’s CPU time in the 2021 robotics study, and VGG16 is simply the more expensive starting point.