Answers.Body: <p>Learning the identity function is not trivial at all.</p>
  <p>The main reason is that the identity function is linear, and a neural network try to approximate it in a non linear fashion. Non linear activations in particular compress and expand values that linearly would have the same distance, so they are not suitable to approximate something like the identity function. I see you used a linear activation but the network still learn in a non linear fashion.</p>
  <p>Residual Neural Networks (ResNet) were suggested precisely to help a neural network learning the identity function. The skip connection simply does the job of making the output equal to the input, forcing the network to focus on residuals (output - identity), so for a one layer ResNet learning the identity function become trivial cause the network simply has to learn to push all weights to 0.</p>
  <p>But without this trick, approximating the identity is simply very hard, this is why your UNet experiment was not successful, even with a single training image.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-10T06:31:57.647Z
Answers.LastActivityDate: 2022-08-14T23:18:00.837Z
Answers.LastEditDate: 2022-08-14T23:18:00.837Z
Answers.UserDisplayName: Edoardo Guerriero
Body: <p>I am trying to train networks to achieve what I expected to be a trivial task: learn the identity mapping. However, this is very hard to achieve, and the optimization is hard.
  Moreover, I don't want to learn <span class="math-container">$f_\theta(x)=x\;\;\forall x$</span>, but only <span class="math-container">$f_\theta(x_1)=x_1$</span> for one particular example (I am trying to overfit!).</p>
  <p>Any ideas why this optimization is so hard? The learning curves oscillate and most of the points are not visually satisfactory.</p>
  <p>Code is here: <a href="https://colab.research.google.com/drive/1umys2gxJ8arodQ0PhLf5TFicfPx0mh74?usp=sharing" rel="nofollow noreferrer">https://colab.research.google.com/drive/1umys2gxJ8arodQ0PhLf5TFicfPx0mh74?usp=sharing</a></p>
  
Tags: <convolutional-neural-networks><convergence><u-net>
Title: Learning an identity function with convolutional networks
UserDisplayName: Franco Marchesoni
ThreadText: # Learning an identity function with convolutional networks
  
  (Asked by: username_0 on 2022-08-10)
  
  I am trying to train networks to achieve what I expected to be a trivial task: learn the identity mapping. However, this is very hard to achieve, and the optimization is hard.
  Moreover, I don't want to learn $f\_\theta(x)=x\;\;\forall x$, but only $f\_\theta(x\_1)=x\_1$ for one particular example (I am trying to overfit!).
  
  Any ideas why this optimization is so hard? The learning curves oscillate and most of the points are not visually satisfactory.
  
  Code is here: <https://colab.research.google.com/drive/1umys2gxJ8arodQ0PhLf5TFicfPx0mh74?usp=sharing>
  
  **Tags:** convolutional-neural-networks, convergence, u-net
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-08-10. Score: 4
  
  Learning the identity function is not trivial at all.
  
  The main reason is that the identity function is linear, and a neural network try to approximate it in a non linear fashion. Non linear activations in particular compress and expand values that linearly would have the same distance, so they are not suitable to approximate something like the identity function. I see you used a linear activation but the network still learn in a non linear fashion.
  
  Residual Neural Networks (ResNet) were suggested precisely to help a neural network learning the identity function. The skip connection simply does the job of making the output equal to the input, forcing the network to focus on residuals (output - identity), so for a one layer ResNet learning the identity function become trivial cause the network simply has to learn to push all weights to 0.
  
  But without this trick, approximating the identity is simply very hard, this is why your UNet experiment was not successful, even with a single training image.
  
  
  ---
  
  