I was writing a piece of code related to the GUI, trying to connect machine learning model with the interface using Tkinter. I have 4 class classification, what should I do with this error! [classes code]
classes = {
0:'its a Normal',
1:'its a Benign',
2:'its an InSitu',
3:'its an Invasive', }
[classify code]
def classify(filename)开发者_如何学编程:
global label_packed
image = Image.open(filename)
image = image.resize((128,128))
image = numpy.expand_dims(image, axis=0)
image = numpy.array(image)
image = image/255
pred = model.predict_classes([image])[0]
sign = classes[pred]
print(sign)
lb6 = tk.Label(page2, bg='white', width=40)
lb6.place(x=600, y=530)
lb6.configure(text=sign)
[error]
pred = model.predict_classes([image])[0]
AttributeError: 'Functional' object has no attribute 'predict_classes')
I want when I press the predict button, show what class the uploaded image is.
精彩评论