Hey experts,
I've been trying to run the basic example in keras-ocr, but the model doesn't seem to run. It would terminate with this log:
cd /home/tuan/ocr ; /usr/bin/env /usr/bin/python3 /home/tuan/.vscode/extensions/ms-python.python-2021.12.1559732655/pythonFiles/lib/python/debugpy/launcher 35765 -- /home/tuan/ocr/scratchpad.py
Looking for /home/tuan/.keras-ocr/craft_mlt_25k.h5
2022-02-03 15:52:34.835207: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-02-03 15:52:34.838700: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcufft.so.10'; dlerror: libcufft.so.10: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.8/dist-packages/cv2/../../lib64::/usr/local/cuda/extras/CUPTI/lib64
2022-02-03 15:52:34.838803: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcurand.so.10'; dlerror: libcurand.so.10: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.8/dist-packages/cv2/../../lib64::/usr/local/cuda/extras/CUPTI/lib64
2022-02-03 15:52:34.838907: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcusolver.so.11'; dlerror: libcusolver.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.8/dist-packages/cv2/../../lib64::/usr/local/cuda/extras/CUPTI/lib64
2022-02-03 15:52:34.838983: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcusparse.so.11'; dlerror: libcusparse.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.8/dist-packages/cv2/../../lib64::/usr/local/cuda/extras/CUPTI/lib64
2022-02-03 15:52:34.839155: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1835] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2022-02-03 15:52:34.839916: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Looking for /home/tuan/.keras-ocr/crnn_kurapan.h5
2022-02-03 15:52:41.126983: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:185] None of the MLIR Optimization Passes are enabled (registered 2)
2022-02-03 15:52:41.676977: W tensorflow/core/framework/cpu_allocator_impl.cc:80] Allocation of 989331456 exceeds 10% of free system memory.
2022-02-03 15:52:41.830090: W tensorflow/core/framework/cpu_allocator_impl.cc:80] Allocation of 989331456 exceeds 10% of free system memory.
2022-02-03 15:52:42.177844: W tensorflow/core/framework/cpu_allocator_impl.cc:80] Allocation of 989331456 exceeds 10% of free system memory.
2022-02-03 15:52:42.753353: W tensorflow/core/framework/cpu_allocator_impl.cc:80] Allocation of 989331456 exceeds 10% of free system memory.
2022-02-03 15:52:43.312433: W tensorflow/core/framework/cpu_allocator_impl.cc:80] Allocation of 494403584 exceeds 10% of free system memory.
Here's my requirements.txt file:
keras==2.6.0
keras-ocr
tensorflow-gpu==2.6.0
Here's the code to run the pre-trained model:
import matplotlib.pyplot as plt
import keras_ocr
# keras-ocr will automatically download pretrained
# weights for the detector and recognizer.
pipeline = keras_ocr.pipeline.Pipeline()
# Get a set of three example images
images = [
keras_ocr.tools.read(url) for url in [
'https://upload.wikimedia.org/wikipedia/commons/b/bd/Army_Reserves_Recruitment_Banner_MOD_45156284.jpg'
]
]
# Each list of predictions in prediction_groups is a list of
# (word, box) tuples.
prediction_groups = pipeline.recognize(images)
# Plot the predictions
fig, axs = plt.subplots(nrows=len(images), figsize=(20, 20))
for ax, image, predictions in zip(axs, images, prediction_groups):
keras_ocr.tools.drawAnnotations(image=image, predictions=predictions, ax=ax)
Hey experts, I've been trying to run the basic example in keras-ocr, but the model doesn't seem to run. It would terminate with this log:
Here's my
requirements.txt
file:Here's the code to run the pre-trained model:
PTAL cc @faustomorales