# How to do weight normalization in VGG network for style transfer?

We're doing a re-implementation of the style transfer algorithm in Gatys et al. Image Style Transfer Using Convolutional Neural Networks. There are many example implementations out there but except for the authors almost everyone goes with the standard network with pretrained weights. In section 2 - Deep Image Representations there is the following passage:

We normalized the network by scaling the weights such that the mean activation of each convolutional ﬁlter over images and positions is equal to one. Such re-scaling can be done for the VGG network without changing its output, because it contains only rectifying linear activation functions and no normalization or pooling over feature maps.

I'm wondering what that means in practice - is that capturing the activation maps for all images in imagenet (training set) and then adjust the relu weights based on those sums across all images, all positions for each filter element? Not sure how to interpret this if it's not related to training data at all.

• Why was this perfectly legitimate question downvoted?! +1. – amoeba Apr 26 '17 at 9:53
• For anyone who uses a different framework than caffe, here is an onnx model which you can convert to most other frameworks. P.S I used the weights (which I used to create the above file) from Korhan's answer and the activation maps average out to around 0.026 – DarQ Jun 4 '20 at 23:17
• I have implemented the code for weight normalization in tf.keras. The normalized VGG16 weights have been uploaded in a GitHub release too. The link for the GitHub repository. Note Beside: The normalized weights – Aritra Roy gosthipaty Sep 11 '20 at 13:19

"-is that capturing the activation maps for all images in imagenet (training set) and then adjust the relu weights based on those sums across all images, all positions for each filter element?"

I suppose your guess is correct. I've came across the normalised network that they used and inspected its activation matrices for several images. Their mean tends to be below 1. The normalised model is made publicly available by the authors: http://bethgelab.org/media/uploads/deeptextures/vgg_normalised.caffemodel