arbitrary_style_transfer icon indicating copy to clipboard operation
arbitrary_style_transfer copied to clipboard

Converting to BGR in style_transfer_net.py

Open Mypathissional opened this issue 5 years ago • 1 comments

Hey,

I was going through the code and I cant understand why you convert the inputs from RGB to BGR.

Would be grateful for any help,

Best

Mypathissional avatar Jul 13 '19 21:07 Mypathissional

The original VGG19 was trained on images loaded as BGR from OpenCV and so expects that channel order. See https://github.com/jcjohnson/neural-style/issues/207

The second key preprocessing step of the VGG nets is subtracting the mean pixel across ImageNet for each color channel. In this codebase that's performed here https://github.com/elleryqueenhomels/arbitrary_style_transfer/blob/c5730fa38624cf6ff9738b26b4c7340e96acd809/encoder.py#L79

eridgd avatar Jul 29 '19 03:07 eridgd