Code Monkey home page Code Monkey logo

Comments (5)

MrXu avatar MrXu commented on June 10, 2024 17

I solved the problem after reading through source code for Resnet50.py. If anyone encounter the same problem, please add the input_shape parameter when you call Resnet50():

model = ResNet50(include_top=False, weights='imagenet', input_tensor=Input(shape=(224,224,3)))

If you are using Keras ImageDataGenerator, the input shape will be automatically inferred.

from deep-learning-models.

alonalj avatar alonalj commented on June 10, 2024 3

Regarding the error:

input size must be at least 197x197,

Had the same issue, but disappeared after upgrading keras to 2.2.4 (with backend tensorflow 1.12.0 in case it matters).

from deep-learning-models.

alyato avatar alyato commented on June 10, 2024 2

@MrXu
hi, i also use the resnet50, and i want set input_size=(48,48,3) but it show me an error.

valueerror input size must be at least 197x197,

i check the doc, it show me ,

width and height should be no smaller than 32. E.g. (200, 200, 3) would be one valid value.,

It's so weird.

from deep-learning-models.

AntreasAntoniou avatar AntreasAntoniou commented on June 10, 2024

You should use the functional API. So for example try:

  if K.image_dim_ordering() == 'tf':
    inp = Input(shape=(224, 224, 3), name='input_image')
else:
    inp = Input(shape=(3, 224, 224), name='input_image')


main_model = Resnet50(include_top=False)(inp)

main_out = Dropout(0.5)(main_model)
main_out = Dense(512, activation='relu', name='fcc_0')(main_out)
main_out = Dropout(0.5)(main_model)
main_out = Dense(output_classes, activation='softmax', name='class_id')(main_out)

model = Model(input=inp, output=artist_out)

from deep-learning-models.

MrXu avatar MrXu commented on June 10, 2024

@AntreasAntoniou Thanks, but I need to load weights for the Sequential model. Also, when I try to use main_model = Resnet50(include_top=False)(inp), it complains Exception: You are attempting to share a same BatchNormalization layer across different data flows.

from deep-learning-models.

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.