Yash Sharma
Yash Sharma

Reputation: 112

AttributeError: 'Sequential' object has no attribute 'predict_classes'

I've built a CNN that can classify images from two different classes. However, I keep on getting this error when I try to run classification code:

AttributeError: 'Sequential' object has no attribute 'predict_classes'

This is the part of the code that is causing the error:

 images = np.vstack([x])
 classes = model.predict_classes(images, batch_size=10)

Upvotes: 0

Views: 5271

Answers (1)

Antoine Redier
Antoine Redier

Reputation: 485

predict_classes method is from an old version of keras (before version 2 so 2017 and older) and was removed since.

you can get the probabilities of your classes with model.predict and get your classes from there.

Upvotes: 1

Related Questions