Saturation Artifacts Fast Neural Style / Super Resolution

I’m implementing fast neural style and super resolution in pytorch with pillow 4.3 and python 3.6 and am getting random green, red, and yellow pixels. I have tried pillow-simd and several versions of normal pillow and the problem persists. Has anyone else experienced something like this?

This is likely a bug in my implementation or a problem with the Image library but I thought this may be the best place to seek help, thanks in advance!

toilet

bike

Criterion here: https://github.com/A-Jacobson/paper_implementations/blob/master/Fast_Style_Transfer/criterion.py

4x Super resolution, same artifacts here: https://github.com/A-Jacobson/paper_implementations/blob/master/Super_Resolution/4x%20Super%20Resolution.ipynb

Can’t really help on this, have you checked the tutorial implementation to compare with your code ?

Wasn’t aware of that. Thanks! Just checked the main bits and they look pretty similar, only very minor differences like that one reflection pads res blocks instead of cropping the residual connection like mine and the original paper. Also it seems that I forgot to set affine=True on the instancenorm blocks but I’m not convinced either of these things could cause such strange artifacts. I’ll make the changes and run it again in the morning just to make sure. I suppose I should just swap out PIL as well. Trying to wrap by head around how those outliers could even happens with how the optimization is set up is giving me a headache