marker icon indicating copy to clipboard operation
marker copied to clipboard

OCR issues ----- cv2.error: OpenCV(4.11.0) :-1: error: (-5:Bad argument) in function 'fillPoly'

Open YYH211 opened this issue 9 months ago • 2 comments

Traceback (most recent call last): File "/opt/conda/envs/marker2/bin/marker_single", line 8, in sys.exit(convert_single_cli()) File "/opt/conda/envs/marker2/lib/python3.10/site-packages/click/core.py", line 1161, in call return self.main(*args, **kwargs) File "/opt/conda/envs/marker2/lib/python3.10/site-packages/click/core.py", line 1082, in main rv = self.invoke(ctx) File "/opt/conda/envs/marker2/lib/python3.10/site-packages/click/core.py", line 1443, in invoke return ctx.invoke(self.callback, **ctx.params) File "/opt/conda/envs/marker2/lib/python3.10/site-packages/click/core.py", line 788, in invoke return __callback(*args, **kwargs) File "/opt/conda/envs/marker2/lib/python3.10/site-packages/marker/scripts/convert_single.py", line 35, in convert_single_cli rendered = converter(fpath) File "/opt/conda/envs/marker2/lib/python3.10/site-packages/marker/converters/pdf.py", line 154, in call document = self.build_document(filepath) File "/opt/conda/envs/marker2/lib/python3.10/site-packages/marker/converters/pdf.py", line 149, in build_document processor(document) File "/opt/conda/envs/marker2/lib/python3.10/site-packages/marker/processors/table.py", line 99, in call self.assign_ocr_lines(ocr_blocks) # Handle tables where OCR is needed File "/opt/conda/envs/marker2/lib/python3.10/site-packages/marker/processors/table.py", line 382, in assign_ocr_lines ocr_results: List[OCRResult] = self.recognition_model( File "/opt/conda/envs/marker2/lib/python3.10/site-packages/surya/recognition/init.py", line 55, in call flat = self.detect_and_slice_bboxes( File "/opt/conda/envs/marker2/lib/python3.10/site-packages/surya/recognition/init.py", line 132, in detect_and_slice_bboxes slices = slice_polys_from_image(image, polygons) File "/opt/conda/envs/marker2/lib/python3.10/site-packages/surya/input/processing.py", line 43, in slice_polys_from_image lines.append(slice_and_pad_poly(image_array, poly)) File "/opt/conda/envs/marker2/lib/python3.10/site-packages/surya/input/processing.py", line 58, in slice_and_pad_poly cv2.fillPoly(mask, [np.int32(coordinates)], 1) cv2.error: OpenCV(4.11.0) :-1: error: (-5:Bad argument) in function 'fillPoly'

Overload resolution failed:

  • Layout of the output array img is incompatible with cv::Mat
  • Expected Ptrcv::UMat for argument 'img'

i use this script: marker_single ../maker-master/file/ocr_test.pdf --output_dir ./marker2-result --strip_existing_ocr --languages "zh"

here is the file:ocr_test.pdf

YYH211 avatar Mar 04 '25 03:03 YYH211

same issue

hanruiyao163 avatar Mar 05 '25 15:03 hanruiyao163

I'm also facing the same issue as well. I've tried Python 3.11 and Python 3.12, no difference. Using version 1.6.

mzanm avatar Mar 06 '25 06:03 mzanm

I'm also facing the same issue as well. I've tried Python 3.11 and Python 3.12, no difference. Using version 1.6.

hello ,what is mean 1.6? python 3.16?

YYH211 avatar Mar 10 '25 09:03 YYH211

I'm also facing the same issue as well. I've tried Python 3.11 and Python 3.12, no difference. Using version 1.6.

hello ,what is mean 1.6? python 3.16?

Hello. No, I meant version 1.6.0 or 1.6.1 of marker-pdf itself.

I've found a fix, you can install version 1.5.5 and it doesn't have this issue via pip install marker-pdf==1.5.5

I hope that helps until it's resolved.

mzanm avatar Mar 10 '25 10:03 mzanm

@YYH211 @mzanm @hanruiyao163 This issue is now fixed in the new release (https://github.com/VikParuchuri/marker/releases/tag/v1.6.2). Thanks for the issue report that helped us find the bug!

tarun-menta avatar Mar 26 '25 22:03 tarun-menta