I tried to follow a tutorial about keras_ocr and straight from the beggining I get this problem that I cannot find any information on.
import pandas as pd
import numpy as np
from glob import glob
from tqdm.notebook import tqdm
import matplotlib.pyplot as plt
from PIL import Image
plt.style.use('ggplot')
import keras_ocr
pipeline = keras_ocr.pipeline.Pipeline()
Looking for C:Users{myusername}.keras-ocrcraft_mlt_25k.h5
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[65], line 3
1 import keras_ocr
----> 3 pipeline = keras_ocr.pipeline.Pipeline()
File c:Python312Libsite-packageskeras_ocrpipeline.py:22, in Pipeline.__init__(self, detector, recognizer, scale, max_size)
20 detector = detection.Detector()
21 if recognizer is None:
---> 22 recognizer = recognition.Recognizer()
23 self.scale = scale
24 self.detector = detector
File c:Python312Libsite-packageskeras_ocrrecognition.py:388, in Recognizer.__init__(self, alphabet, weights, build_params)
381 self.alphabet = alphabet
382 self.blank_label_idx = len(alphabet)
383 (
384 self.backbone,
385 self.model,
386 self.training_model,
387 self.prediction_model,
--> 388 ) = build_model(alphabet=alphabet, **build_params)
389 if weights is not None:
390 weights_dict = PRETRAINED_WEIGHTS[weights]
...
[0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0.]], dtype=float32), array([1., 0., 0., 0., 1., 0.], dtype=float32)]}
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
I tried installing and uninstalling keras using Anaconda Navigator Environments and tried installing and uninstalling keras-ocr using pip in a virtual environment in the project itself and also in a normal environment. Tried changing versions of Python, tensorflow and keras and absolutely nothing worked. I have also tried keras-orc without having tensorflow but still no luck.
Yanislav Yanakiev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.