I have been meaning to learn some ML and I came upon this reference notebook which basically implements a handwriting OCR model using CNN/RNN and CTC loss.
https://keras.io/examples/vision/handwriting_recognition/#evaluation-metric
The above is the link to that notebook, my main issue is that I am not able to run inferences on my own images with it. Like images other than the ones from the dataset itself.
It seems there is some issue when it comes to preprocessing the image first before running the predictions and I keep running into some errors.
I basically first tried to run this but it seems I need to do some preprocessing of the image first, can anyone help me with this? Would be really appreciated!
from PIL import Image
image_path = '/content/drive/MyDrive/stuff/test.png'
image = Image.open(image_path).convert('L')
pred = model2.predict(preprocessed_image)
pred_texts = decode_batch_predictions(pred)
# Display the result
plt.figure(figsize=(8, 8))
plt.imshow(image, cmap='gray')
plt.title(f'Prediction: {pred_texts[0]}') # Assuming only one prediction for simplicity
plt.axis('off')
plt.show()
saumza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.