Model works on TF 2.3 but not on 2.6 ( model.predict_classes removed?)

I am writing a project that classifies the date codes on a pack, I have developed a pipeline that works as intended on my PC, I trained the model on my computer and ran the classification script (tf2.3). Works well.

I copied the files over to my raspberry pi 4, its 64 bit runs tf2.6, the script runs ok but I am not getting the same output in fact it is returning the same character for each contour.

[ '[','[','[','[','[','[','[','[','[','[']

instead of (ignore 7s they represent /)

['1', '1', '7', '1', '1', '7', '2', '0', '2', '2']

I cannot understand were the model is getting the '[' from as I have not labled a folder in my training model to represent this.

I chnaged the line in my code

label = str(classifier.predict_classes(image, batch_size = 10))[1]

to

label = str(classifier.predict(image, batch_size = 10))[1]

But I am sure this is not correct. I am using the softmax activation.

from this thread it is suggested that I replace

predictions = model.predict_classess(x_test)

With this one:

predictions = (model.predict(x_test) 0.5).astype(int32)

https://stackoverflow.com/questions/68836551/keras-attributeerror-sequential-object-has-no-attribute-predict-classes

But I am getting error as syntax is incorrect I think.

the easiest solution would be to install Tf 2.3 on my pi but I am thinking I can solve this issue and run 2.6

Topic tensorflow model-selection

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.