GithubHelp home page GithubHelp logo

Comments (6)

pietz avatar pietz commented on June 20, 2024

Truth be told I only tested this with the tensorflow backend and now that theano has reached its end of life there's another reason to use tf.

Try changing both concatenations in the code to axis=1. There's one in the convblock and another in the levelblock.

Also, residual connections are usually an addition and not a concatenation, but this will lead to similar shape problems on the first convblock. The difference should be minor.

from unet-keras.

bernardohenz avatar bernardohenz commented on June 20, 2024

I already tested this and the problem was similar. But I changed to tensorflow backend and it worked.
I think the shape mismatch may be a combination of matching errors among input, convs and concatenate channel-axis, but now it is working perfectly.

Btw, nice code, very clean and easy to use. I would suggest to add the possibility of choosing Batch/Instance Normalization, but Keras does not have Instance normalization yet (only keras-contrib).

Congrats for the work.

from unet-keras.

pietz avatar pietz commented on June 20, 2024

Thanks for the nice words!

from unet-keras.

dscarmo avatar dscarmo commented on June 20, 2024

Hello, i have the same problem with the code as is on the repository, except it occurs anytime i use a input_shape not multiple of 2.

(128, 128, 1) works, (512, 512, 1) works, but other shapes, even the one used on the original paper (572, 572, 1) will output the same error.

For 181, 181, 1, i have the following output:

ValueError: A Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 45, 45, 256), (None, 44, 44, 256)]

I tried using axis=1 in concatenates, the error changes to:

I also tried changing start_ch, depth and inc_rate to no avail. output:

ValueError: A Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 45, 45, 256), (None, 44, 44, 256)]

The code is very nice and clean, good work!

For now i will try using center patches of 128x128.

from unet-keras.

sakvaua avatar sakvaua commented on June 20, 2024

@dscarmo Original paper uses valid convolutions while this implementation uses same. With your shapes
572/2=286/2=143 which is not divisible by two. And that's why it gives you an error. Your images should have shapes that divide by two as many times as the depth of your network.

from unet-keras.

karanpathak avatar karanpathak commented on June 20, 2024

Very well written code!

from unet-keras.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.