Gradients are calculated in DeepDream by following the steps given below:
- Choose a specific layer in the network to focus on
- After the image has been processed by the neural network, the degree to which the selected layer activates
- Compute the gradient to see how much each pixel in the image influences the layer's activation
- Modify the image's pixels according to the gradient to emphasize patterns that the network deems intriguing
- Repeat this several times to intensify those patterns and produce the surreal feeling.