fenglf / Kaggle-dog-breed-classification

This is the baseline of Kaggle-dog-breed-classification on Python, Keras, and TensorFlow.
30 stars 12 forks source link

Dimension Error #3

Open osho-agyeya opened 5 years ago

osho-agyeya commented 5 years ago

Hi, I tried to apply this on my dataset which has 50 classes and folder structure is correct. But I got an error for

# we train our model again (this time fine-tuning the top 2 inception blocks
# alongside the top Dense layers
history_ft = model.fit_generator(
    train_generator,
    steps_per_epoch=len(train_generator.filenames) // batch_size,
    epochs=fit_epochs,
    validation_data=validation_generator,
    validation_steps=len(validation_generator.filenames) // batch_size,
    callbacks=[mc_fit, tb])

as ValueError: Error when checking target: expected dense_2 to have 4 dimensions, but got array with shape (16, 50)

ynsgnr commented 5 years ago

Solved by downgrading keras version to 2.1.2 pip install keras==2.1.2