housecricket / How-did-I-write-an-own-OCR-program-using-Keras-and-TensorFlow-in-Python

How did I write an own OCR program using Keras and TensorFlow in Python
https://towardsdatascience.com/how-did-i-train-an-ocr-model-using-keras-and-tensorflow-7e10b241c22b
28 stars 14 forks source link

Returning "ValueError: Number of classes, 11, does not match size of target_names, 36. Try specifying the labels parameter" #6

Open alanchmiel opened 2 years ago

alanchmiel commented 2 years ago

When I run the code with

python train_model.py --az A_Z_Handwritten_Data.csv --model trained_ocr.model

It progresses through Epoch 50/50, but then returns

[INFO] evaluating network...
Traceback (most recent call last):
  File "C:\Users\achmiel\Downloads\How-did-I-write-an-own-OCR-program-using-Keras-and-TensorFlow-in-Python-master\How-did-I-write-an-own-OCR-program-using-Keras-and-TensorFlow-in-Python-master\train_model.py", line 113, in <module>
    print(classification_report(testY.argmax(axis=1),
  File "C:\Users\achmiel\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 63, in inner_f
    return f(*args, **kwargs)
  File "C:\Users\achmiel\Anaconda3\lib\site-packages\sklearn\metrics\_classification.py", line 1991, in classification_report
    raise ValueError(
ValueError: Number of classes, 11, does not match size of target_names, 36. Try specifying the labels parameter

I understand that this means I have more target names than classes, but I don't know what is the root o the problem.

housecricket commented 2 years ago

Please check your dataset or contact me to support you.

RamizJamall commented 2 years ago

Did you solve the problem ??

LapTQ commented 2 years ago

I run it very well!