Open Dobiasd opened 2 years ago
With the debugger, I found the crash happens in the call to cv2.connectedComponentsWithStats
in the getBoxes
function.
I've created a minimal example to reproduce this OpenCV crash without keras-ocr
, and opened an issue in the opencv-python
repository: https://github.com/opencv/opencv-python/issues/604
Thanks @Dobiasd ! This helped me. It would be good to add a note on this.
It seems the OpenCV devs have fixed it (https://github.com/opencv/opencv/issues/21366) already. Maybe it's just not yet released.
I had the latest version of opencv-python, and it was crashing. I guess it has not been released, as you say.
Thank you!
On Tue, Feb 8, 2022, 14:42 Tobias Hermann @.***> wrote:
It seems the OpenCV devs have fixed it (opencv/opencv#21366 https://github.com/opencv/opencv/issues/21366) already. Maybe it's just not yet released.
— Reply to this email directly, view it on GitHub https://github.com/faustomorales/keras-ocr/issues/189#issuecomment-1032623344, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACDJO3LMZOS2NMI7AWO5E5LU2EMVXANCNFSM5LFMQ5JA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
Smalll update:
Using opencv-python==4.5.5.64
(released two days ago, i.e., on 2022-03-09) instead of opencv-python==4.5.5.62
, it still produces the segfault.
FROM python:3.9.9
# libGL is needed to avoid "ImportError: libGL.so.1" in OpenCV
# libglib2.0-0 is needed to avoid "ImportError: libgthread-2.0.so.0" in OpenCV
RUN apt-get update && apt-get install -y \
libglib2.0-0 \
libgl1-mesa-glx \
build-essential \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir tensorflow==2.7.0 keras-ocr==0.8.9
# Tested using different versions here.
RUN pip install --no-cache-dir opencv-python==4.5.5.64
RUN echo "import keras_ocr" > main.py
RUN echo "pipeline = keras_ocr.pipeline.Pipeline()" >> main.py
RUN echo "image = keras_ocr.tools.read('https://i.imgur.com/NpJdN6R.png')" >> main.py
RUN echo "pipeline.recognize([image])" >> main.py
RUN python main.py
Segmentation fault (core dumped)
Results with different versions:
opencv-python==4.5.5.64
: segfaultopencv-python==4.5.5.62
: segfaultopencv-python==4.5.4.60
: okopencv-python==4.5.4.58
: okopencv-python==4.5.3.56
: okopencv-python==4.5.2.54
: okSo let's hope for the next version, I guess. :shrug:
Recognition attempts end with exit code 139 (interrupted by signal 11: SIGSEGV). Minimal example:
The following Dockerfile can be used to reproduce the error:
Result: