I'm working through the style transfer tutorial on tensorflow, see: style transfer
I made a few adjustments to my notebook, but it works fine for the base case:
[ content_image | transfer_image | style_image ] for all images:
However, I wanted to understand why the
tf.keras.applications.vgg19.preprocess_input() on each step. I modified the notebook to precalculate the VGG preprocessing below. Notice that the input for the
transfer_image is the same as the
content_image and both have been preprocessed to BGR pixel ordering and mean centered.
And here is the same result with
vgg19.preprocess_input() reversed. Note that the original
style_image reverse correctly, so I assume the same must be true for the
transfer_image that is optimized in the BGR+mean_centered domain is not the same as the one that was optimized in the normal RGB domain. I checked my code and the
train_step is not adding a 2nd preprocessing step to the BGR+mean_centered input.
Intuitively, can anyone tell why this is the case?