I'm trying to build an inception and resnet model with my own image data. The dataset is 8000 images in total and has 6 labels. Everything goes fine while building the model. But the mentioned error occurs in the model.fit(). I'm really not sure what the problem after spending 14 hours.

I tried the following

  1. Changing the image dimension ordering

  2. Making changes to keras.json

  3. changing the input_tensor shape in the model

Image of the error : enter image description here

inception_model = InceptionV3(input_tensor = inception_model.input, include_top = True, weights = 'imagenet')
inception_last_layer = inception_model.get_layer('predictions').output
inception_out = Dense(num_classes, activation='softmax', name='output')(inception_last_layer)
custom_inception = Model(inception_model.input, inception_out)

for layer in custom_inception.layers[:-3]:
        layer.trainable = False

custom_inception.compile(loss='categorical_crossentropy',optimizer='adam',metrics=['accuracy', 'mse', 'mae', 'mape'])
train_inception = custom_inception.fit(X_train, y_train, batch_size=8, epochs=2)

I'm currently using keras 2.2.0 which I downgraded from latest version after going through some keras issues in github. It did solve some initial hiccups. I'm currently using inception and resnet from their respective python files which I made some changes include_top=include_top to require_flatten=include_top from this

Here are the inputs shapes
(1690, 220, 220, 1)  is the X_train shape
(1690, 6)  is the y_train 
(423, 220, 220, 1)  is the X_test shape
(423, 6)  is the y_test 
  • $\begingroup$ You don't give x = Input(shape=(img_height, img_width, img_channels)) as input to Model that is why technically your model has no inputs. And hence the error makes complete sense $\endgroup$
    – Aditya
    Commented May 2, 2019 at 14:04
  • 1
    $\begingroup$ Below link gives an pretty good explanation for this issue stackoverflow.com/questions/43899248/… $\endgroup$
    – sakeesh
    Commented Nov 27, 2019 at 0:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.