diff --git a/images/posts/.DS_Store b/images/posts/.DS_Store index a312fe1c..40cfd7e8 100644 Binary files a/images/posts/.DS_Store and b/images/posts/.DS_Store differ diff --git a/images/posts/logo.png b/images/posts/logo.png new file mode 100644 index 00000000..ef1ed21a Binary files /dev/null and b/images/posts/logo.png differ diff --git a/pagefind/fragment/en_18a828d.pf_fragment b/pagefind/fragment/en_18a828d.pf_fragment new file mode 100644 index 00000000..5b5b2e6a Binary files /dev/null and b/pagefind/fragment/en_18a828d.pf_fragment differ diff --git a/pagefind/fragment/en_3f35bfe.pf_fragment b/pagefind/fragment/en_3f35bfe.pf_fragment deleted file mode 100644 index 92329966..00000000 Binary files a/pagefind/fragment/en_3f35bfe.pf_fragment and /dev/null differ diff --git a/pagefind/index/en_1099864.pf_index b/pagefind/index/en_1099864.pf_index deleted file mode 100644 index f486528e..00000000 Binary files a/pagefind/index/en_1099864.pf_index and /dev/null differ diff --git a/pagefind/index/en_12099c8.pf_index b/pagefind/index/en_12099c8.pf_index deleted file mode 100644 index 675fe6f0..00000000 Binary files a/pagefind/index/en_12099c8.pf_index and /dev/null differ diff --git a/pagefind/index/en_1e60ada.pf_index b/pagefind/index/en_1e60ada.pf_index new file mode 100644 index 00000000..2c5372af Binary files /dev/null and b/pagefind/index/en_1e60ada.pf_index differ diff --git a/pagefind/index/en_2b75c21.pf_index b/pagefind/index/en_2b75c21.pf_index new file mode 100644 index 00000000..8e052926 Binary files /dev/null and b/pagefind/index/en_2b75c21.pf_index differ diff --git a/pagefind/index/en_2e618b8.pf_index b/pagefind/index/en_2e618b8.pf_index new file mode 100644 index 00000000..f8e8202e Binary files /dev/null and b/pagefind/index/en_2e618b8.pf_index differ diff --git a/pagefind/index/en_3615aae.pf_index b/pagefind/index/en_3615aae.pf_index new file mode 100644 index 00000000..ce405392 Binary files /dev/null and b/pagefind/index/en_3615aae.pf_index differ diff --git a/pagefind/index/en_36faabc.pf_index b/pagefind/index/en_36faabc.pf_index deleted file mode 100644 index d5f94f13..00000000 Binary files a/pagefind/index/en_36faabc.pf_index and /dev/null differ diff --git a/pagefind/index/en_382f7d6.pf_index b/pagefind/index/en_382f7d6.pf_index deleted file mode 100644 index 51756559..00000000 Binary files a/pagefind/index/en_382f7d6.pf_index and /dev/null differ diff --git a/pagefind/index/en_628b1e7.pf_index b/pagefind/index/en_628b1e7.pf_index deleted file mode 100644 index 3852b66d..00000000 Binary files a/pagefind/index/en_628b1e7.pf_index and /dev/null differ diff --git a/pagefind/index/en_7bd861a.pf_index b/pagefind/index/en_7bd861a.pf_index deleted file mode 100644 index 5f4bf32c..00000000 Binary files a/pagefind/index/en_7bd861a.pf_index and /dev/null differ diff --git a/pagefind/index/en_89cfce9.pf_index b/pagefind/index/en_89cfce9.pf_index new file mode 100644 index 00000000..614f644c Binary files /dev/null and b/pagefind/index/en_89cfce9.pf_index differ diff --git a/pagefind/index/en_8e2ace3.pf_index b/pagefind/index/en_8e2ace3.pf_index deleted file mode 100644 index 5577381d..00000000 Binary files a/pagefind/index/en_8e2ace3.pf_index and /dev/null differ diff --git a/pagefind/index/en_901c3c8.pf_index b/pagefind/index/en_901c3c8.pf_index deleted file mode 100644 index 0e598d3d..00000000 Binary files a/pagefind/index/en_901c3c8.pf_index and /dev/null differ diff --git a/pagefind/index/en_92155d6.pf_index b/pagefind/index/en_92155d6.pf_index deleted file mode 100644 index 365fe24f..00000000 Binary files a/pagefind/index/en_92155d6.pf_index and /dev/null differ diff --git a/pagefind/index/en_92218c9.pf_index b/pagefind/index/en_92218c9.pf_index new file mode 100644 index 00000000..5dde7ecb Binary files /dev/null and b/pagefind/index/en_92218c9.pf_index differ diff --git a/pagefind/index/en_93299e5.pf_index b/pagefind/index/en_93299e5.pf_index new file mode 100644 index 00000000..e45cb2e6 Binary files /dev/null and b/pagefind/index/en_93299e5.pf_index differ diff --git a/pagefind/index/en_9442a21.pf_index b/pagefind/index/en_9442a21.pf_index new file mode 100644 index 00000000..2a6d8d53 Binary files /dev/null and b/pagefind/index/en_9442a21.pf_index differ diff --git a/pagefind/index/en_9e5573d.pf_index b/pagefind/index/en_9e5573d.pf_index deleted file mode 100644 index 2df5b100..00000000 Binary files a/pagefind/index/en_9e5573d.pf_index and /dev/null differ diff --git a/pagefind/index/en_a9fd1df.pf_index b/pagefind/index/en_a9fd1df.pf_index new file mode 100644 index 00000000..0824a1fe Binary files /dev/null and b/pagefind/index/en_a9fd1df.pf_index differ diff --git a/pagefind/index/en_ac3088b.pf_index b/pagefind/index/en_ac3088b.pf_index deleted file mode 100644 index 65b128c7..00000000 Binary files a/pagefind/index/en_ac3088b.pf_index and /dev/null differ diff --git a/pagefind/index/en_b28167a.pf_index b/pagefind/index/en_b28167a.pf_index deleted file mode 100644 index 55009f36..00000000 Binary files a/pagefind/index/en_b28167a.pf_index and /dev/null differ diff --git a/pagefind/index/en_b2cc636.pf_index b/pagefind/index/en_b2cc636.pf_index new file mode 100644 index 00000000..b426d234 Binary files /dev/null and b/pagefind/index/en_b2cc636.pf_index differ diff --git a/pagefind/index/en_b8bceea.pf_index b/pagefind/index/en_b8bceea.pf_index deleted file mode 100644 index 71b20c14..00000000 Binary files a/pagefind/index/en_b8bceea.pf_index and /dev/null differ diff --git a/pagefind/index/en_ba9f2c3.pf_index b/pagefind/index/en_ba9f2c3.pf_index new file mode 100644 index 00000000..860b8eb6 Binary files /dev/null and b/pagefind/index/en_ba9f2c3.pf_index differ diff --git a/pagefind/index/en_c59611b.pf_index b/pagefind/index/en_c59611b.pf_index deleted file mode 100644 index 9b1a21f4..00000000 Binary files a/pagefind/index/en_c59611b.pf_index and /dev/null differ diff --git a/pagefind/index/en_c675468.pf_index b/pagefind/index/en_c675468.pf_index deleted file mode 100644 index 81befd72..00000000 Binary files a/pagefind/index/en_c675468.pf_index and /dev/null differ diff --git a/pagefind/index/en_d44e7fe.pf_index b/pagefind/index/en_d44e7fe.pf_index new file mode 100644 index 00000000..0fec5e10 Binary files /dev/null and b/pagefind/index/en_d44e7fe.pf_index differ diff --git a/pagefind/index/en_d931eb4.pf_index b/pagefind/index/en_d931eb4.pf_index new file mode 100644 index 00000000..f4fdfefc Binary files /dev/null and b/pagefind/index/en_d931eb4.pf_index differ diff --git a/pagefind/index/en_dbe272b.pf_index b/pagefind/index/en_dbe272b.pf_index new file mode 100644 index 00000000..0e40ca87 Binary files /dev/null and b/pagefind/index/en_dbe272b.pf_index differ diff --git a/pagefind/index/en_e20f421.pf_index b/pagefind/index/en_e20f421.pf_index new file mode 100644 index 00000000..23b3c67c Binary files /dev/null and b/pagefind/index/en_e20f421.pf_index differ diff --git a/pagefind/index/en_e3f7bd2.pf_index b/pagefind/index/en_e3f7bd2.pf_index new file mode 100644 index 00000000..995ddda6 Binary files /dev/null and b/pagefind/index/en_e3f7bd2.pf_index differ diff --git a/pagefind/index/en_eb8a40c.pf_index b/pagefind/index/en_eb8a40c.pf_index deleted file mode 100644 index c4f1f82e..00000000 Binary files a/pagefind/index/en_eb8a40c.pf_index and /dev/null differ diff --git a/pagefind/index/en_f93b8ca.pf_index b/pagefind/index/en_f93b8ca.pf_index deleted file mode 100644 index b64b4cd8..00000000 Binary files a/pagefind/index/en_f93b8ca.pf_index and /dev/null differ diff --git a/pagefind/index/en_fc577b8.pf_index b/pagefind/index/en_fc577b8.pf_index new file mode 100644 index 00000000..7663ac1f Binary files /dev/null and b/pagefind/index/en_fc577b8.pf_index differ diff --git a/pagefind/pagefind-entry.json b/pagefind/pagefind-entry.json index e72628b1..5b42f6ec 100644 --- a/pagefind/pagefind-entry.json +++ b/pagefind/pagefind-entry.json @@ -1 +1 @@ -{"version":"1.3.0","languages":{"en":{"hash":"en_fe283df5ce","wasm":"en","page_count":183}}} \ No newline at end of file +{"version":"1.3.0","languages":{"en":{"hash":"en_820103acfc","wasm":"en","page_count":183}}} \ No newline at end of file diff --git a/pagefind/pagefind.en_820103acfc.pf_meta b/pagefind/pagefind.en_820103acfc.pf_meta new file mode 100644 index 00000000..336b5114 Binary files /dev/null and b/pagefind/pagefind.en_820103acfc.pf_meta differ diff --git a/pagefind/pagefind.en_fe283df5ce.pf_meta b/pagefind/pagefind.en_fe283df5ce.pf_meta deleted file mode 100644 index e2ac7de1..00000000 Binary files a/pagefind/pagefind.en_fe283df5ce.pf_meta and /dev/null differ diff --git a/posts/claudeslens/index.html b/posts/claudeslens/index.html index 27946ea6..741444c0 100644 --- a/posts/claudeslens/index.html +++ b/posts/claudeslens/index.html @@ -222,9 +222,12 @@  Search
• -
14 min read

My BSc Thesis, ClaudesLens

Table of Contents

Introduction

-

I have finally finished my undergrad and would like to make a blog post about what I have been working on these past ~6 months.

-

The tile of our thesis is:

+
14 min read

My BSc Thesis, ClaudesLens

Table of Contents

+

ClaudesLens

+

Dubitatio dictat animas nostras

+

Introduction

+

I finally finished my undergrad and would like to make a blog post about what I have been working on these past ~6 months.

+

The title of our thesis is:

ClaudesLens: Uncertainty Quantification in Computer Vision Models

@@ -236,12 +239,12 @@

BayesLens

Even more ambitiously, apply this to self-driving cars.

Needless to say, this was a bit too ambitious for a BSc thesis, so we had to scale down our project a bit. We didn’t have the prerequisite knowledge or the compute to do such a task within that time frame.

-

So about ~1/3 into the project, when our supervisor wanted us to explore the entropy of predictions and got really excited about our results, we got ClaudesLens.

+

Enough about what we wanted to do and what we did.

+

So about ~1/3 into the project, our supervisor wanted us to explore the entropy of predictions, and we got promising results right from the start.

+

This was the start of ClaudesLens.

ClaudesLens

-

From the results using entropy as a measure of uncertainty — which in itself is nothing new — we decided to focus on this instead. -I’ll go into more detail and motivate how this approach works.

-

Enough about what we wanted to do and what we did. -Let’s start what lies at the heart of this project: Neural Networks.

+

From the results of using entropy as a measure of uncertainty — which in itself is nothing new — we decided to explore this further.

+

Let’s start what lies at the heart of this project: Neural Networks.

Neural Networks

There are many ways to explain neural networks, in this post I will use a mathematical approach which will let us view the entire network as a single function.

The Neuron

@@ -524,22 +527,28 @@

The Neuron

The Network

-

Lets build upon what we now have learned and see how we can extend this.

+

Let’s write the equation for a single neuron in a more compact form.

We can represent the inputs of a neuron as a vector, $$ +\begin{equation} \mathbf{x} = \left[x_1, x_2, \ldots, x_n\right], +\end{equation} $$

where each element corresponds to an input to the neuron.

Similarly, we can represent the associated weights as a vector, $$ +\begin{equation} \mathbf{w} = \left[w_1, w_2, \ldots, w_n\right], +\end{equation} $$

with this the summation can be simplified to a dot product, $$ +\begin{equation} z = \mathbf{w} \cdot \mathbf{x} + b. +\end{equation} $$

But only using one neuron will only get us so far, if we instead have multiple neurons and try to mimic the structure of the brain, we can get something more powerful.

-

A layer is a collection of neurons, stacked on top of each other. +

A layer is a collection of neurons, stacked on top of each other. Very often when we are referring to a layer, are we referring to a fully connected layer, where each neuron in the layer is connected to all the neurons in the previous layer.

In the case of a network, we can now talk about the input layer and the output layer.

@@ -854,24 +863,30 @@

The Network

Figure 2: A simple neural network with one hidden layer.

-

As we see in the picture, we now have multiple neurons with numerous inter-neuron connections, along with multiple outputs.

+

As we see in Figure 2, we now have multiple neurons with numerous inter-neuron connections, along with multiple outputs.

The matrix-vector equation, $$ +\begin{equation} \mathbf{a} = \mathbf{W_1} \mathbf{x} + \mathbf{b_1} = [a_1, a_2, \ldots, a_m], +\end{equation} $$

yields each output of each neuron in the hidden layer (intermediate layers between the input and output layers).

Note, I’m explicitly leaving out the required transpose operations out of the equations, in reality we need our matrix and vectors to match dimension, but our theory and intuition will still hold.

-

$\mathbf{W_1}$ is the weight matrix with rows $\mathbf{w_i} = [w_{i, 1}, w_{i, 2}, \ldots, w_{i, n}]$ corresponding to the weights of the $i$-th neuron in the hidden layer. -The bias values are represented by $\mathbf{b_1} = [b_1, b_2, \ldots, b_m]$.

+

$\mathbf{W_1}$ is the weight matrix with rows $\mathbf{w_i} = [w_{i, 1}, w_{i, 2}, \ldots, w_{i, n}]$ corresponding to the weights of the $i$-th neuron in the hidden layer.

+

The bias values are represented by $\mathbf{b_1} = [b_1, b_2, \ldots, b_m]$.

In the case of several layers, we work with multiple weight matrices and bias vectors, which we index as $\mathbf{W_j}$ and $\mathbf{b_j}$, respectively.

So, given an input $\mathbf{x}$, the output of the hidden layer (i.e., Figure 2) is given by, $$ +\begin{equation} \mathbf{a} = f.(\mathbf{W_1} \mathbf{x} + \mathbf{b_1}), +\end{equation} $$

where the dot indicates that the activation function $f$ is applied element-wise.

So the final output is therefore, $$ +\begin{equation} \mathbf{y} = f.(\mathbf{W_2} \mathbf{a} + \mathbf{b_2}). = f.(\mathbf{W_2} f.(\mathbf{W_1} \mathbf{x} + \mathbf{b_1}) + \mathbf{b_2}). +\end{equation} $$

Exercise: Is it necessary to apply the same activation function to all layers in a neural network?

@@ -902,7 +917,9 @@

Uncertainty in Information Theory

5

The entropy of a random variable $X$ is defined as, $$ +\begin{equation} H(X) = -\sum_{x \in \chi} p(x) \log p(x), +\end{equation} $$

where $p(x) = P(X = x)$.

If I were to explain Shannon-Entropy in an intuitive way. @@ -953,8 +970,8 @@

Entropy-based Uncert

So, let us introduce some uncertainty, let’s make our network stochastic.

To make the network stochastic, we need to introduce some randomness somewhere in the network.

I want to emphasize that you can do this in a lot of different ways and “inject” the randomness at different stages in a neural network. -We chose the most straightforward and primitive ways, adding image on the input image and adding noise to the weights.

-

So, the perturbed weight matrix is given by,

+We chose the most straightforward and primitive ways, adding random noise to the input image or all weights.

+

So, the perturbed weight matrix is given by,

$$ \begin{equation} \mathbf{W}_{\sigma} = \mathbf{W} + \sigma \mathbf{N}, @@ -1060,14 +1077,17 @@

Mapping entropy categorically

A very important part of this framework is that the input $\mathbf{x}$ is fixed. Do images (given same perturbation level) with the same entropy yield similar predictions?

$$ +\begin{equation} p_{\sigma} = P(\hat{y_{\sigma}} = Y | H_{\sigma}(\mathbf{x}) = h), \quad \text{ where } h = H(\mathbf{x}). +\end{equation} $$

-

The function mapping $\mathbf{x}$ to $h$ can be understood as the probability of making a correct prediciton within all draws from the data, which have the same entropy as $\mathbf{x}$.

-

TO BE CONTINUED…

+

The function mapping $\mathbf{x} \mapsto h$ can be understood as the probability of making a correct prediction within all draws from the data, which have the same entropy as $\mathbf{x}$. +This means we can categorize images based on their entropy and gain insight into the model’s predictions without seeing the ground truth label.

Conclusion

-

This is a very brief overview of what we did in our thesis, and I hope that I have motivated why we did what we did. -I thought it was a very challenging but fun project, and I learned a lot from it.

-

Read the paper as well, we basically died writing it.

+

I hope you’ve understood this framework of quantifying uncertainty in neural networks.

+

I’ve started to see a lot more people talk about uncertainty quantification 6 this year. +Which makes me happy, it is an interesting field.

+

My closing statement is that, don’t forget that statistics is an exact science making sense of an uncertain and inexact world 7.

Footnotes

  1. @@ -1085,6 +1105,12 @@

    Conclusion

  2. Claude E. Shannon, “A mathematical theory of communication.”

  3. +
  4. +

    Entropix

    +
  5. +
  6. +

    Original Tweet

    +