Coder Social home page Coder Social logo

ValueError: Error when checking input: expected input_1 to have 4 dimensions, but got array with shape (250, 250, 3) about keras-fcn HOT 3 CLOSED

jihongju avatar jihongju commented on July 17, 2024
ValueError: Error when checking input: expected input_1 to have 4 dimensions, but got array with shape (250, 250, 3)

from keras-fcn.

Comments (3)

theladyjaye avatar theladyjaye commented on July 17, 2024

Ok I refactored my generator after looking at your for voc2011:

    img_input = img_to_array(load_img(path_input))
    img_target = img_to_array(load_img(path_target))
    batch_input = np.zeros((1,) + (250, 250, 3), dtype=K.floatx())
    batch_target = np.zeros((1,) + (250, 250, 3), dtype=K.floatx())

    batch_input[0] = img_input
    batch_target[0] = img_target

    yield (batch_input, batch_target)

And that did the trick.

Also, question for my own ignorance:

https://github.com/JihongJu/keras-fcn/blob/master/keras_fcn/models.py#L61
https://github.com/JihongJu/keras-fcn/blob/master/keras_fcn/models.py#L98

On those 2 lines the classes are hard coded against 21 instead of taking the classes value from the passed in args. Is that intentional? I know there are default 21 classes, but in the case where you are doing something custom, wouldn't it make sense to allow that to be configured?

from keras-fcn.

JihongJu avatar JihongJu commented on July 17, 2024

Hi @aventurella , thank you for the suggestion! Those two places indeed should be classes passed from the argument instead of hard coded 21.

from keras-fcn.

JihongJu avatar JihongJu commented on July 17, 2024

It is now fixed. Thank you! @aventurella

from keras-fcn.

Related Issues (20)

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.