# What is wrong with this CNN network, why are there hot pixels?

I'm building a CNN decoder, which mirrors (in reverse) the VGG network structure from Conv-4-1 layer.

The net seems to be working fine, however, the output looks broken. Please note that the colour distortion is fine, it's the the [255/0 RGB pixels] e.g. green that I'm worrying about.

I tried to overfit a single image, but even then I get these hot pixels. Does anyone know why they appear?

My net:

    activation = 'elu'

input_ = Input((None, None, 512))
x = Conv2D(filters=256, kernel_size=self.kernel_size, padding='same', bias_initializer='zeros', activation=activation)(input_)

x = UpSampling2D()(x)
for _ in range(3):
x = Conv2D(filters=256, kernel_size=self.kernel_size, padding='same', activation=activation)(x)
x = Conv2D(filters=128, kernel_size=self.kernel_size, padding='same', activation=activation)(x)

x = UpSampling2D()(x)
x = Conv2D(filters=128, kernel_size=self.kernel_size, padding='same', activation=activation)(x)
x = Conv2D(filters=64, kernel_size=self.kernel_size, padding='same', activation=activation)(x)

x = UpSampling2D()(x)
x = Conv2D(filters=64, kernel_size=self.kernel_size, padding='same', activation=activation)(x)

I've seen this too many times - it's not a problem with your network, it's a problem with matplotlib and how it displays the image. You are probably trying to display a float with range $$<0, 255>$$. When matplotlib sees float type as input, it assumes a range of $$<0, 1>$$, and thresholds everything outside of that range, and the results you can see.
• Before printing, I do y = np.clip(y, 0, 255) and assert y.dtype == np.uint8, 'Must be uint8', so these pixels correspond to [0, 0, 0] to [255, 255, 255] where 0/255 are sometimes interchanged to produce yellow/cian etc. – GRS Jun 6 '19 at 13:37