{"notes":[{"id":"classic-cnns/zfnet","category":"classic-cnns","legacyPath":"","legacySlug":"","legacyPaths":[],"title":"ZFNet","subtitle":"The View Inside the Black Box","author":"Z. Yuan","paperDate":"2013-11-12","publishedOn":"2025-09-06","world":"external/zfnet","paperTitle":"Visualizing and Understanding Convolutional Networks","paperUrl":"https://arxiv.org/abs/1311.2901","bibliography":{"title":"Visualizing and Understanding Convolutional Networks","authors":["Matthew D Zeiler","Rob Fergus"],"url":"https://arxiv.org/abs/1311.2901","pdfUrl":"https://arxiv.org/pdf/1311.2901v3","codeUrl":null,"preprint":{"id":"1311.2901","submittedOn":"2013-11-12","url":"https://arxiv.org/abs/1311.2901"},"publication":null,"citation":"@misc{classiccnnszfnet2013,\n  title = {{Visualizing and Understanding Convolutional Networks}},\n  author = {Matthew D Zeiler and Rob Fergus},\n  year = {2013},\n  eprint = {1311.2901},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1311.2901}\n}\n","citationPath":"/content/papers/citations/classic-cnns/zfnet.6d4dd35e9f91.bib"},"thumbnail":{"src":"/content/papers/assets/6c45d745e8a2f4b60cc45bea1029353e303d5e3bbee1e62f438c71874fddf883.png","width":1200,"height":1329},"locale":"en","path":"/content/papers/en/classic-cnns/zfnet.a0c5a08699b9.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"walking-backward-through-a-convolutional-network","text":"Walking Backward Through a Convolutional Network","depth":3},{"id":"unpooling-has-to-remember-where-the-max-was","text":"Unpooling Has to Remember Where the Max Was","depth":3},{"id":"the-model-under-observation","text":"The Model Under Observation","depth":3},{"id":"what-each-layer-sees","text":"What Each Layer Sees","depth":3},{"id":"fixing-the-architecture-with-what-you-see","text":"Fixing the Architecture with What You See","depth":3},{"id":"cover-a-patch-and-watch-the-classifier","text":"Cover a Patch and Watch the Classifier","depth":3},{"id":"correspondence-across-images","text":"Correspondence Across Images","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"imagenet-2012","text":"ImageNet 2012","depth":3},{"id":"which-layers-hurt-most-when-removed","text":"Which Layers Hurt Most When Removed?","depth":3},{"id":"switching-datasets","text":"Switching Datasets","depth":3},{"id":"are-higher-layers-more-useful","text":"Are Higher Layers More Useful?","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"classic-cnns/alexnet","relation":"referenced","topic":""},{"id":"classic-cnns/vgg","relation":"referenced","topic":""},{"id":"classic-cnns/resnet","relation":"referenced","topic":""}]},{"id":"classic-cnns/alexnet","category":"classic-cnns","legacyPath":"classic-cnns/1209-alexnet","legacySlug":"1209-alexnet","legacyPaths":[],"title":"AlexNet","subtitle":"The Rise of Convolutional Networks","author":"Z. Yuan","paperDate":"2012","publishedOn":"2024-06-30","paperTitle":"ImageNet Classification with Deep Convolutional Neural Networks","paperUrl":"https://proceedings.neurips.cc/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html","bibliography":{"title":"ImageNet Classification with Deep Convolutional Neural Networks","authors":["Alex Krizhevsky","Ilya Sutskever","Geoffrey E. Hinton"],"url":"https://proceedings.neurips.cc/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html","pdfUrl":"https://proceedings.neurips.cc/paper_files/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf","codeUrl":null,"preprint":null,"publication":{"venue":"NeurIPS (NIPS)","year":2012,"kind":"conference","url":"https://proceedings.neurips.cc/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html"},"citation":"@inproceedings{classiccnnsalexnet2012,\n  title = {{ImageNet Classification with Deep Convolutional Neural Networks}},\n  author = {Alex Krizhevsky and Ilya Sutskever and Geoffrey E. Hinton},\n  year = {2012},\n  booktitle = {NeurIPS (NIPS)},\n  url = {https://proceedings.neurips.cc/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html}\n}\n","citationPath":"/content/papers/citations/classic-cnns/alexnet.b38d2879f7bc.bib"},"thumbnail":{"src":"/content/papers/assets/87a5a48ff82989d4d78cc4d47a083f292fd7e249c1880c00ac4b31d8a042650d.jpg","width":1630,"height":570},"locale":"en","path":"/content/papers/en/classic-cnns/alexnet.c7dee680f897.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"relu-activation-function","text":"ReLU Activation Function","depth":3},{"id":"multi-gpu-training","text":"Multi-GPU Training","depth":3},{"id":"local-response-normalization","text":"Local Response Normalization","depth":3},{"id":"overlapping-max-pooling","text":"Overlapping Max Pooling","depth":3},{"id":"dropout","text":"Dropout","depth":3},{"id":"model-implementation","text":"Model Implementation","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"what-did-the-convolutional-network-learn","text":"What Did the Convolutional Network Learn?","depth":3},{"id":"ilsvrc-2010-results","text":"ILSVRC-2010 Results","depth":3},{"id":"ilsvrc-2012-results","text":"ILSVRC-2012 Results","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"classic-cnns/vgg","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/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"}]}],"text":"In the 2012 ImageNet competition, AlexNet pushed the top-5 error rate down to 16.4%. Second place was at 26.2%.\n\nThat's a gap of nearly ten percentage points. Overnight, convolutional networks went from a niche technique to something every lab wanted to try.\n\nThen everyone noticed something awkward: the model was accurate, but nobody could say why. To improve it, all you could do was change the number of layers, tweak a filter size, train for a week or two, and see whether the score went up.\n\nMatthew Zeiler and Rob Fergus of New York University released this paper in November 2013, and in the introduction they bluntly call this state of affairs trial-and-error. They wanted to understand the model first, then fix it based on the problems they saw.\n\n\n> [!TIP]\n> \n> This paper is often called ZFNet, after the initials of the two authors' surnames. If you haven't read AlexNet yet, you can start with our note:\n> \n> - **[[12.09] AlexNet: The Rise of Convolutional Networks](/blog/papers/classic-cnns/alexnet)**\n\n\n## Defining the Problem\n\nUnderstanding the first layer of a convolutional network isn't hard. First-layer filters act directly on pixels, so if you draw the weights as small images, you can see what they're looking for: horizontal lines, diagonal lines, blobs of a certain color.\n\nFrom the second layer on, that stops working. Second-layer filters act on the output of the first layer, so drawing their weights just gives you a pile of numbers with no visible meaning. The higher you go, the more abstract what each unit sees, and the harder it is to trace back to the original image.\n\nA few approaches already existed. Erhan et al. ran gradient ascent in image space to find the input that maximizes a unit's activation, but the result depended on initialization and said nothing about which variations the unit tolerates. Le et al. computed the Hessian numerically around the optimal input to estimate invariances, but higher-layer invariances are complex, and a quadratic approximation can't capture them. Donahue et al. simply found the image patches that strongly activate higher layers, but you still couldn't tell which structures within a patch were the ones that mattered.\n\nThe authors wanted something different: given a real image and an activation in an intermediate layer, project it back into pixel space and see clearly **which structures in this image** make it light up.\n\n## Solving the Problem\n\n### Walking Backward Through a Convolutional Network\n\nThe authors borrowed the Deconvolutional Network (deconvnet) they had proposed in 2011. The original deconvnet was an unsupervised learning model; here it isn't trained at all. It serves only as a probe, attached alongside a convolutional network that has already been trained.\n\n[![The top half shows two side-by-side pipelines. On the right is one convolutional network layer, running bottom to top: the pooled input from the layer below goes through convolutional filtering F, ReLU, and max pooling, with the locations of the maxima recorded as switches. On the left is a deconvnet layer, running top to bottom: the reconstruction from the layer above goes through unpooling, ReLU, and filtering with the transpose of F, giving the reconstruction for the layer below. The bottom half illustrates unpooling: pooling records where the maximum sits in each colored region, and unpooling puts the values from the layer above back in those locations](/content/papers/assets/e846238b05c91faf3e65cc41d18380f105ef60fd65ec5ceaef64d428b9897b31.png)](/content/papers/assets/e846238b05c91faf3e65cc41d18380f105ef60fd65ec5ceaef64d428b9897b31.png)\n\n*Figure 1 from the paper, excerpted from [**page 3 of the v3 PDF**](https://arxiv.org/pdf/1311.2901v3#page=3). In the top half, the right side is one convolutional network layer and the left side is the deconvnet layer attached to it; the bottom half illustrates unpooling.*\n\nStart with the right side of the top half: one layer of the convolutional network runs bottom to top, through filtering ($F$), ReLU, and max pooling in that order. The deconvnet on the left runs top to bottom and reverses these three steps: unpooling, ReLU, and filtering with the transposed filters ($F^T$).\n\nHere's how it's used:\n\n1. Feed an image into the convolutional network and compute the feature maps at every layer.\n2. Pick one activation in some layer and set every other activation in that layer to zero.\n3. Hand this feature map, now holding a single activation, to the deconvnet and reconstruct downward layer by layer until you reach pixel space.\n\nOf the three backward steps, unpooling is the one that needs the most explanation.\n\n### Unpooling Has to Remember Where the Max Was\n\nMax pooling throws information away: a $2\\times2$ block keeps only its maximum, and the other three numbers are gone. The operation has no inverse.\n\nThe authors' fix is to note, on the way up, which cell holds each block's maximum. These records are called switches. Let's try it on a $4\\times4$ feature map:\n\n```python\nimport numpy as np\n\nx = np.array([[1, 3, 2, 0],\n              [4, 2, 1, 5],\n              [0, 1, 7, 2],\n              [2, 6, 3, 1]])\n\npooled = np.zeros((2, 2), dtype=int)\nswitches = {}\nfor i in range(2):\n    for j in range(2):\n        block = x[2*i:2*i+2, 2*j:2*j+2]\n        r, c = np.unravel_index(block.argmax(), block.shape)\n        pooled[i, j] = block[r, c]\n        switches[(i, j)] = (2*i + r, 2*j + c)\n\nprint(pooled)\nprint(switches)\n```\n\n```text\n[[4 5]\n [6 7]]\n{(0, 0): (1, 0), (0, 1): (1, 3), (1, 0): (3, 1), (1, 1): (2, 2)}\n```\n\nAfter pooling, a $2\\times2$ map is left. `switches` records which original cell each output came from; the 7 in the bottom-right corner, for example, came from `(2, 2)`.\n\nSuppose the activation we want to trace is the one in the bottom-right corner. Set the other three to zero, then put the values back in place according to the switches:\n\n```python\nreconstruction = np.array([[0, 0],\n                           [0, 9]])   # keep only the activation we're tracing from the layer above\nunpooled = np.zeros((4, 4), dtype=int)\nfor (i, j), (r, c) in switches.items():\n    unpooled[r, c] = reconstruction[i, j]\nprint(unpooled)\n```\n\n```text\n[[0 0 0 0]\n [0 0 0 0]\n [0 0 9 0]\n [0 0 0 0]]\n```\n\nThe 9 reconstructed by the layer above lands where the 7 originally was; every other position is zero.\n\nThat's unpooling: use the positions recorded on the way up to put the upper layer's reconstruction back in the right place. The switches belong to this particular input image, so as the reconstruction continues downward, the result looks like a small piece of the original image and keeps the structures that made this activation light up.\n\nThe other two steps are more direct:\n\n- **ReLU**: feature maps in the convolutional network are always non-negative after ReLU, so each layer's reconstruction also goes through ReLU again to stay non-negative.\n- **Filtering**: use the transpose of the same filters, which in practice means flipping each filter vertically and horizontally. It's applied to the rectified reconstruction, not to the original output of the layer below.\n\n\n> [!NOTE]\n> \n> The deconvnet here isn't solving deconvolution in the mathematical sense; it just applies the same filters again, transposed. `ConvTranspose2d` in today's deep learning frameworks is also often called deconvolution, and it likewise performs a transposed convolution.\n\n\nThe authors also point out that these projections aren't samples generated by the model; no generative model is involved anywhere. They answer just one question: which parts of this input contribute to the chosen activation.\n\n### The Model Under Observation\n\nThe model the authors observe closely resembles AlexNet. It has eight layers: five convolutional layers and two fully connected layers, followed by a softmax. To split across two GPUs, AlexNet had several convolutional layers connect only to the feature maps on the same GPU; here those layers connect to all the feature maps, and the model is trained on a single GTX 580 for 70 epochs, which takes about 12 days.\n\nVisualization was already useful during training: a few first-layer filters had especially large values and dominated the whole layer ((a) in Figure 6, later on). The authors' remedy is to cap the filters' magnitude: whenever a convolutional filter's RMS exceeds $10^{-1}$, it's scaled back to that radius. The authors say this matters especially in the first layer, because input pixels fall roughly in $[-128, 128]$.\n\n### What Each Layer Sees\n\n[![Layer 1 shows several groups of filter patterns; layers 2 to 5 each have many 3×3 grids, with gray deconvnet projections on the left and the corresponding color patches from the original images on the right. Layer 2 is mostly edges and color blobs, layer 3 shows textures such as meshes and text, layer 4 has dog faces and bird legs, and layer 5 shows whole objects such as keyboards and dogs](/content/papers/assets/6c45d745e8a2f4b60cc45bea1029353e303d5e3bbee1e62f438c71874fddf883.png)](/content/papers/assets/6c45d745e8a2f4b60cc45bea1029353e303d5e3bbee1e62f438c71874fddf883.png)\n\n*Figure 2 from the paper, excerpted from [**page 4 of the v3 PDF**](https://arxiv.org/pdf/1311.2901v3#page=4). For each feature map in layers 2 to 5, the 9 strongest activations across the validation set are shown; the small gray images are deconvnet projections, and the small color images beside them are the corresponding original image patches.*\n\nRead this figure in pairs: the gray projections draw only the structures that make the activation light up, while the image patches next to them show the original image.\n\nHere's how the authors describe each layer:\n\n- **Layer 2**: corners, plus combinations of edges and colors.\n- **Layer 3**: more complex invariances, picking up similar textures such as mesh patterns and text.\n- **Layer 4**: starts to be class-specific, such as dog faces and bird legs.\n- **Layer 5**: entire objects, tolerating large variations in pose, such as keyboards and dogs.\n\nThe benefit of reading in pairs is clearest at layer 5, row 1, column 2: the 9 image patches seem to have nothing in common, yet the projections show that this feature map is actually looking at the grass in the background, not the foreground objects. From the image patches alone, you'd think this unit was looking at random things.\n\nThe authors also tracked how features change during training: lower layers converge within a few epochs, while upper layers only take shape around epoch 40 or 50. Their conclusion is that the model needs to be trained until it fully converges.\n\nAnother set of experiments measured how translation, scaling, and rotation affect the features. Small transformations change the layer 1 feature vectors dramatically; by layer 7 the effect is much smaller, and roughly linear for translation and scaling. The final output is stable under translation and scaling but not under rotation, unless the object itself is rotationally symmetric.\n\n### Fixing the Architecture with What You See\n\nThis is where visualization is most practical. The authors pull out AlexNet's layers 1 and 2 for a look:\n\n[![Five sets of filter visualizations. (a) is layer 1 without the cap on filter magnitude, with one especially bright square; (b) is AlexNet's layer 1, (c) is the modified layer 1; (d) is the projection of AlexNet's layer 2, (e) is the projection of the modified layer 2](/content/papers/assets/416e3ce07fbed24c5bda83322fd60820ab4098de4d461a714d914793f63f41a4.png)](/content/papers/assets/416e3ce07fbed24c5bda83322fd60820ab4098de4d461a714d914793f63f41a4.png)\n\n*Figure 6 from the paper, excerpted from [**page 7 of the v3 PDF**](https://arxiv.org/pdf/1311.2901v3#page=7). (a) Layer 1 without the cap on filter magnitude; (b) AlexNet's layer 1; (c) the modified layer 1; (d) AlexNet's layer 2; (e) the modified layer 2.*\n\nFirst compare (b) and (c). AlexNet's first-layer filters mix extremely high- and extremely low-frequency patterns, with very little in the mid frequencies, plus some “dead” filters that do almost nothing. Then compare (d) and (e): the projections of AlexNet's layer 2 show traces of aliasing.\n\nThe authors trace the problem to the first layer: AlexNet uses $11\\times11$ filters with stride 4, which they change to $7\\times7$ with stride 2.\n\nHow can stride cause aliasing? Stride is simply the sampling interval. Let's try it on a one-dimensional stripe: a pattern that repeats every 5 pixels, sampled once every 2 pixels and once every 4 pixels:\n\n```python\nimport numpy as np\n\nx = np.arange(40)\nstripe = np.round(np.cos(2 * np.pi * x / 5), 1)   # a stripe that repeats every 5 pixels\n\nprint(\"Stride 2:\", stripe[::2][:10])\nprint(\"Stride 4:\", stripe[::4][:10])\n```\n\n```text\nStride 2: [ 1.  -0.8  0.3  0.3 -0.8  1.  -0.8  0.3  0.3 -0.8]\nStride 4: [ 1.   0.3 -0.8 -0.8  0.3  1.   0.3 -0.8 -0.8  0.3]\n```\n\nWith stride 2, the values flip up and down every sample or two, so this fast variation survives. With stride 4, the result turns into a smooth rise and fall that completes one cycle every 5 samples, which is a wide stripe with one cycle every 20 pixels. The original has no such stripe; it's a false pattern created by sampling too sparsely.\n\nAlexNet's first-layer filters already carry a good deal of high-frequency content. When the resulting feature maps are then sampled at stride 4, the high-frequency parts can fold into false low-frequency patterns that get passed on to the next layer. This one-dimensional example is our own illustration; the paper itself points out the phenomenon through the projections, and the second layer after the architecture change, (e), is much cleaner, with no visible traces of aliasing.\n\nMore importantly, classification performance improves as well; we'll see the numbers in the discussion.\n\n\n> [!TIP]\n> \n> In the years that followed, first-layer settings never went back to AlexNet's large filters with a large stride. VGG switched to $3\\times3$ throughout, starting from the first layer; ResNet's first layer is $7\\times7$ with stride 2, exactly the same as here.\n> \n> - **[[14.09] VGG: Deep and More Deep](/blog/papers/classic-cnns/vgg)**\n> - **[[15.12] ResNet: Convolutional with 100 Layers](/blog/papers/classic-cnns/resnet)**\n\n\n### Cover a Patch and Watch the Classifier\n\nProjections answer “what is this feature looking at?” The authors also wanted to answer a different question: is the classifier really finding the object, or just guessing from the background?\n\nThey take a gray square and slide it across the image step by step, covering different positions. At each position they record two things: the total activation of the strongest layer 5 feature map, and the classifier's output.\n\n[![A row of five panels. (a) is a Pomeranian with a tennis ball in its mouth, with a gray occluding square on the image; (b) is a heat map of how occluder position affects the total activation of the strongest layer 5 feature map, blue over the dog's face; (c) is the projection of this feature map; (d) is a heat map of the correct-class probability, lowest over the dog's face; (e) is the most probable class at each occluder position, mostly Pomeranian, with a few cells near the dog's face switching to tennis ball, Pekinese, or Keeshond](/content/papers/assets/a17219e0ee699c0d36ceeb892c3a304fe106143afa91432c0caaaaf91fefbb8b.png)](/content/papers/assets/a17219e0ee699c0d36ceeb892c3a304fe106143afa91432c0caaaaf91fefbb8b.png)\n\n*Figure 7 from the paper (first row), excerpted from [**page 7 of the v3 PDF**](https://arxiv.org/pdf/1311.2901v3#page=7). (a) The input image and the gray occluding square; (b) the effect of occluder position on the total activation of the strongest layer 5 feature map; (c) the projection of this feature map; (d) the probability of the correct class; (e) the most probable class at each occluder position.*\n\nThis is a Pomeranian holding a tennis ball in its mouth. The blue regions in (b) and (d) both fall on the dog's face: cover the face, and the strongest layer 5 feature weakens and the probability of “Pomeranian” drops sharply. (e) is more interesting: at most positions the prediction is Pomeranian, but when the dog's face is covered while the tennis ball is still visible, the model changes its answer to “tennis ball.”\n\nThe other two rows of the same figure remind us that the strongest feature and what the classifier relies on aren't necessarily in the same place. The second row is a race car: the strongest layer 5 feature falls on the text on its body, but the classifier is most sensitive to the wheel. The third row contains several objects: the strongest feature picks out the faces, but the classifier is most sensitive to the dog, which the authors explain by the classifier using many feature maps at once.\n\n### Correspondence Across Images\n\nThe last analysis gets mentioned less often. Traditional recognition methods often have an explicit correspondence mechanism, such as knowing the relative positions of the eyes and nose on a face. Deep models have no such design, and the authors wanted to know whether they build correspondence implicitly.\n\nThey take 5 frontal images of dogs, cover the same part in each one (say, the left eye in all of them), compute the change in features before and after occlusion, and then check whether the signs of these changes agree across the 5 images. The metric is the Hamming distance between the sign patterns of each pair; lower means covering the same part produces more consistent changes:\n\n| Occluded part | Layer 5 | Layer 7 |\n| --- | ---: | ---: |\n| Right eye | 0.067 ± 0.007 | 0.069 ± 0.015 |\n| Left eye | 0.069 ± 0.007 | 0.068 ± 0.013 |\n| Nose | 0.079 ± 0.017 | 0.069 ± 0.011 |\n| Random location | 0.107 ± 0.017 | 0.073 ± 0.014 |\n\n*Table: Numbers excerpted from Table 1 of the paper.*\n\nAt layer 5, the scores for the eyes and nose are all lower than for random locations, which the authors take to mean that the model establishes some degree of part correspondence at this layer. At layer 7 the scores are close to one another; the authors speculate that the upper layers are busy telling different dog breeds apart.\n\n## Discussion\n\n### ImageNet 2012\n\nThe authors first reproduce AlexNet with its original architecture, landing within 0.1% of the original paper's validation error. Then they switch to the modified architecture:\n\n| Model | Val top-1 | Val top-5 | Test top-5 |\n| --- | ---: | ---: | ---: |\n| AlexNet, 1 model | 40.7 | 18.2 | — |\n| AlexNet, 5 models | 38.1 | 16.4 | 16.4 |\n| This paper, 1 model | 38.4 | 16.5 | — |\n| This paper, 5 models | 36.7 | 15.3 | 15.3 |\n| This paper, 6 models (including the version with widened middle layers) | 36.0 | 14.7 | 14.8 |\n\n*Table: Error rates (%) excerpted from Table 2 of the paper, omitting the AlexNet entries trained on both the 2011 and 2012 training data.*\n\nFor a single model, validation top-5 error drops from 18.2% to 16.5%; combining 6 models gives a test top-5 error of 14.8%. The authors also note in a footnote that this result had already been surpassed by entries in that year's ILSVRC 2013.\n\n### Which Layers Hurt Most When Removed?\n\nNext, working on AlexNet's architecture, the authors remove some layers entirely and retrain from scratch:\n\n| Change | Train top-1 | Val top-1 | Val top-5 |\n| --- | ---: | ---: | ---: |\n| Original architecture (reproduced) | 35.1 | 40.5 | 18.1 |\n| Remove layers 3 and 4 | 41.8 | 45.4 | 22.1 |\n| Remove layer 7 | 27.4 | 40.0 | 18.4 |\n| Remove layers 6 and 7 | 27.4 | 44.8 | 22.4 |\n| Remove layers 3, 4, 6, and 7 | 71.1 | 71.3 | 50.1 |\n\n*Table: Error rates (%) excerpted from the top half of Table 3 of the paper.*\n\nThe fully connected layers 6 and 7 hold most of the model's parameters; removing them raises val top-1 error from 40.5% to 44.8%, and removing the two middle convolutional layers raises it to 45.4%. Taken separately, both costs are smaller than you'd expect. Remove both groups together, leaving the network with only 4 layers, and the error jumps all the way to 71.3%. The authors therefore conclude that what matters is a certain minimum depth, not any one particular section of layers.\n\nRunning the same experiments on ZFNet's own architecture: making the fully connected layers larger or smaller has little effect. Widening layers 3, 4, and 5 to 512, 1024, and 512 feature maps lowers val top-1 from 38.4% to 37.5%. If the fully connected layers are also enlarged to 8192 units at the same time, training error falls to 10.0% but validation error climbs back to 38.3%; the model starts to overfit.\n\n### Switching Datasets\n\nThe authors also wanted to know whether features learned on ImageNet carry over to other datasets. They freeze layers 1 through 7 and retrain only the final softmax on the new dataset. To keep test data from leaking into training, they first found the 44 images Caltech-101 shares with ImageNet and the 243 that Caltech-256 shares, removed them from the ImageNet training set, and retrained the ImageNet model.\n\n- **Caltech-101** (30 training images per class): 86.5%, against 81.4% for the best previous result, by Bo et al. The same network trained from scratch on Caltech-101 gets only 46.5%.\n- **Caltech-256** (60 per class): 74.2% versus 55.2%. With just 6 training images per class, it already beats Bo et al.'s result with 60.\n- **PASCAL VOC 2012**: a mean of 79.0%, 3.2 percentage points below the best method at the time, though it beats that method on 5 classes. PASCAL images are mostly full scenes containing several objects, while the model can output only one class; the authors see this as one reason it falls behind.\n\nAround the same time, work by Donahue et al. was also exploring how well convolutional features generalize. On this basis, the authors raise a question: can benchmarks with training sets of fewer than ten thousand images still compare methods properly?\n\n### Are Higher Layers More Useful?\n\nTable 7 of the paper cuts the pretrained model off at different layers and puts a linear SVM, or a softmax, on top:\n\n- **Caltech-101**: 44.8% using only layer 1, then 66.2%, 72.3%, and 76.6% in turn, reaching 86.2% at layer 5 and 85.5% at layer 7.\n- **Caltech-256**: rising steadily from 24.6% at layer 1 to 71.7% at layer 7.\n\nBroadly, the higher the layer, the better. On Caltech-101, layers 5 and 7 are close; on Caltech-256, accuracy keeps improving all the way to layer 7.\n\n## Conclusion\n\nThis paper did two things: it used a deconvnet to project intermediate-layer activations back to pixels, then used those images to diagnose AlexNet. The first-layer aliasing and the dead filters were both spotted in the images first, and after the fixes, classification performance improved too. Here, visualization became a tool for adjusting the architecture.\n\nIn the ILSVRC 2013 classification challenge that same year, Zeiler and Fergus entered under the name “ZF” with a top-5 error of 13.5%, placing third; the winner was Clarifai, led by Zeiler, at 11.7% without extra data.\n\nThe visualization method itself was later put to the test. In 2014, Springenberg et al. combined the deconvnet with ordinary backpropagation into guided backpropagation in [Striving for Simplicity](https://arxiv.org/abs/1412.6806). In 2018, Adebayo et al.'s [Sanity Checks for Saliency Maps](https://arxiv.org/abs/1810.03292) found that after the model's weights were randomized, the maps produced by guided backpropagation barely changed and looked a lot like plain edge detection. However clear a projection looks, you still need to check separately that it actually changes with the model.\n\nLooking back at this paper, the effect of the architecture changes is backed by classification results. How faithful each projection really is was left for later research to answer.\n","imageSizes":{"/content/papers/assets/e846238b05c91faf3e65cc41d18380f105ef60fd65ec5ceaef64d428b9897b31.png":{"width":696,"height":677},"/content/papers/assets/6c45d745e8a2f4b60cc45bea1029353e303d5e3bbee1e62f438c71874fddf883.png":{"width":1200,"height":1329},"/content/papers/assets/416e3ce07fbed24c5bda83322fd60820ab4098de4d461a714d914793f63f41a4.png":{"width":1280,"height":400},"/content/papers/assets/a17219e0ee699c0d36ceeb892c3a304fe106143afa91432c0caaaaf91fefbb8b.png":{"width":1397,"height":292}}}
