Skip to content

Commit

Permalink
add maco notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayukhdeb committed Feb 25, 2024
1 parent 31844f2 commit 8293454
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
23 changes: 22 additions & 1 deletion content/post/2024-02-23-magnitude-constrained-featurevis.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
The primary drawback of feature visualization has been it's inability generate interpretable features in deeper networks. In my own experience, I've seen that feature vis basically stops working once we go past the 3rd resnet block in a resnet18.

This paper somehow fixes this issue by optimizing the images in the phase spectrum while keeping the magnitude constant. I have explained the concept of a phase spectrum in this [other post](https://mayukhdeb.github.io/notes/posts/2024-02-24-phase-spectrum.html).
This paper somehow fixes this issue by optimizing the images in the phase spectrum while keeping the magnitude constant. I have explained the concept of a phase spectrum in this [other post](https://mayukhdeb.github.io/notes/posts/2024-02-24-phase-spectrum.html).

There are 2 main approaches for feature visualization:

1. Gradient ascent with a penalty for high frequencies in the fourier domain. Combined with data augmentation.
2. Gradient ascent on a subspace parameterized by a generative model.

The first method fails on large/deep models. The 2nd method is not very useful since it's dependent on the generative model's own biases.

The proposed method is motivated by psychophysics experiments that have shown that humans are more sensitive to differences in phase than in magnitude.

Unlike shallow models like VGG etc, running featurevis on deeper models yield higher frequency components which are impossible to interpret by humans. To illustrate this, they ran featurevis on the logits of a ViT trained on imagenet and compared it's mean power spectrum (left) with that of the Imagenet dataset's power spectrum (right).

<img src = "https://github.com/Mayukhdeb/notes/assets/53133634/c2c0133f-4e60-4eea-ace6-cad344176aaf" width = "80%">

# Method

The first thing that they do is that they break down the fourier spectrum into magnitude and [phase spectrum](https://mayukhdeb.github.io/notes/posts/2024-02-24-phase-spectrum.html). They optimize the phase spectrum of the image while keeping the magnitude spectrum to a constant at an average value computed over a set of natural images.

<img src = "https://github.com/Mayukhdeb/notes/assets/53133634/4419c6be-da5a-474d-95ae-9aaa9a6b82ab" width = "100%">

On a side note, this also reduces the number of parameters by half.
13 changes: 13 additions & 0 deletions posts/2024-02-23-magnitude-constrained-featurevis.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,18 @@ <h1 class="title">MaCo - feature visualization for deeper networks</h1>
</header>
<p>The primary drawback of feature visualization has been it’s inability generate interpretable features in deeper networks. In my own experience, I’ve seen that feature vis basically stops working once we go past the 3rd resnet block in a resnet18.</p>
<p>This paper somehow fixes this issue by optimizing the images in the phase spectrum while keeping the magnitude constant. I have explained the concept of a phase spectrum in this <a href="https://mayukhdeb.github.io/notes/posts/2024-02-24-phase-spectrum.html">other post</a>.</p>
<p>There are 2 main approaches for feature visualization:</p>
<ol type="1">
<li>Gradient ascent with a penalty for high frequencies in the fourier domain. Combined with data augmentation.</li>
<li>Gradient ascent on a subspace parameterized by a generative model.</li>
</ol>
<p>The first method fails on large/deep models. The 2nd method is not very useful since it’s dependent on the generative model’s own biases.</p>
<p>The proposed method is motivated by psychophysics experiments that have shown that humans are more sensitive to differences in phase than in magnitude.</p>
<p>Unlike shallow models like VGG etc, running featurevis on deeper models yield higher frequency components which are impossible to interpret by humans. To illustrate this, they ran featurevis on the logits of a ViT trained on imagenet and compared it’s mean power spectrum (left) with that of the Imagenet dataset’s power spectrum (right).</p>
<p><img src = "https://github.com/Mayukhdeb/notes/assets/53133634/c2c0133f-4e60-4eea-ace6-cad344176aaf" width = "80%"></p>
<h1 id="method">Method</h1>
<p>The first thing that they do is that they break down the fourier spectrum into magnitude and <a href="https://mayukhdeb.github.io/notes/posts/2024-02-24-phase-spectrum.html">phase spectrum</a>. They optimize the phase spectrum of the image while keeping the magnitude spectrum to a constant at an average value computed over a set of natural images.</p>
<p><img src = "https://github.com/Mayukhdeb/notes/assets/53133634/4419c6be-da5a-474d-95ae-9aaa9a6b82ab" width = "100%"></p>
<p>On a side note, this also reduces the number of parameters by half.</p>
</body>
</html>

0 comments on commit 8293454

Please sign in to comment.