cszn / DnCNN

Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising (TIP, 2017)
https://cszn.github.io/
1.47k stars 539 forks source link

Incompatible Image shape error #69

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hi @cszn -

I have been trying to use the DnCNN architecture - I am encountering the below error at Subtract layer. Can you suggest where I am heading wrong?

**InvalidArgumentError: Incompatible shapes: [2,300,300,1] vs. [2,2] [[node gradients/loss/subtract13_loss/sum_squared_error/sub_grad/BroadcastGradientArgs (defined at /opt/conda/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1751) ]] [Op:__inference_keras_scratch_graph_3338]

Function call stack: keras_scratch_graph**

Thanks

betty97 commented 5 years ago

Apparently you changed the batch and patch sizes to be 2 and 300x300 respectively, instead of 128 and 40x40 as the original implementation. Check that as you may have created some mismatches between shapes of y_true and y_pred when the loss is computed.

ghost commented 5 years ago

Thanks, I have found an alternative.