Nikronic / CoarseNet

Modified version of U-net based on "Convolutional Networks for Biomedical Image Segmentation (Ronneberger et al., 2015)" paper.
https://arxiv.org/abs/1505.04597
MIT License
25 stars 2 forks source link

Noisy output #5

Closed Nikronic closed 5 years ago

Nikronic commented 5 years ago

I tried to overfit model on a simple and small dataset, but I got very noisy output. I tried to change target to edge detection using Canny edges as ground truth, but I sill have noisy output.

I am stuck right now and I tried to debug using TensorboardX but it has issues (I made one in their repository). So plan is to implement my model using Tensorflow and try to debug it using tensorboard and convert the final model to Pytorch.

Note: I also tried Visdom by FacebookResearch but they do not provide any API to demonstrate graph states.

Nikronic commented 5 years ago

Tensorboad graph visualization is same as the provided shape in U-Net paper. Gradients are not checked yet.

Nikronic commented 5 years ago

RandomNoise layer is making images too noisy! Here is an example:

out_noise_normalization


Normalization makes images noisy a little bit. Here is an example:

out_normalization


And here is an example without normalization and random noise:

out-simple

Nikronic commented 5 years ago

Here are trained outputs with default parameters for 20 epochs: Without Normalization and RandomNoise:

out-simple

Without Normalization and with RandomNoise:

out_normalization

With Normalization and RandomNoise:

out_noise_normalization

Nikronic commented 5 years ago

Note: Halftone effects applied randomly, so with every run we get different images.

Nikronic commented 5 years ago

RandomNoise implementation is wrong. Check implementation in DeepHalftone repository.' Please see commit https://github.com/Nikronic/CoarseNet/commit/2be8962eddccfb35ef9c04589f67958777753651

Nikronic commented 5 years ago

std = 0.007 has been chosen RandomNoise class. You can achieve it by 0.1/128 division. 0.1 is the value proposed in the paper and 128 is the normalization term. Actually, 0.1 is a std value for images in range [0, 255], but in Pytorch, images are between [0,1] and then we standardizing them between [-1, 1], So we have to divide it by 128.

Nikronic commented 5 years ago

Normalization is the reason we see creepy images even after loading images from the dataset, So the outputs should be more creepy!

You can see the abstract solution in this post: https://discuss.pytorch.org/t/understanding-transform-normalize/21730/18 And the similar question posted here: https://discuss.pytorch.org/t/understanding-transform-normalize/21730/17

Nikronic commented 5 years ago

std = 0.007 has been chosen RandomNoise class. You can achieve it by 0.1/128 division. 0.1 is the value proposed in the paper and 128 is the normalization term. Actually, 0.1 is a std value for images in range [0, 255], but in Pytorch, images are between [0,1] and then we standardizing them between [-1, 1], So we have to divide it by 128.

std=0.1 is THE CORRECT ONE. Unnormalization can solve the issue.

Nikronic commented 5 years ago

After unnormalizing, here is the sample output:

unnorm

It no longer genrates noise but still far from desired output because it is not working effectively as described as a low-pass filter. Obviously we can see halftone patterns in image.

We track this issue in a separate issue #10