Unknown C++ exception from OpenCV code


>>> result = reader.readtext('2.png')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\xuyic\Anaconda3\envs\pytorch2\lib\site-packages\easyocr\easyocr.py", line 390, in readtext
add_margin, False)
File "C:\Users\xuyic\Anaconda3\envs\pytorch2\lib\site-packages\easyocr\easyocr.py", line 277, in detect
False, self.device, optimal_num_chars)
File "C:\Users\xuyic\Anaconda3\envs\pytorch2\lib\site-packages\easyocr\detection.py", line 98, in get_textbox
device, estimate_num_chars)
File "C:\Users\xuyic\Anaconda3\envs\pytorch2\lib\site-packages\easyocr\detection.py", line 56, in test_net
score_text, score_link, text_threshold, link_threshold, low_text, poly, estimate_num_chars)
File "C:\Users\xuyic\Anaconda3\envs\pytorch2\lib\site-packages\easyocr\craft_utils.py", line 236, in getDetBoxes
boxes, labels, mapper = getDetBoxes_core(textmap, linkmap, text_threshold, link_threshold, low_text, estimate_num_chars)
File "C:\Users\xuyic\Anaconda3\envs\pytorch2\lib\site-packages\easyocr\craft_utils.py", line 31, in getDetBoxes_core
nLabels, labels, stats, centroids = cv2.connectedComponentsWithStats(text_score_comb.astype(np.uint8), connectivity=4)
cv2.error: Unknown C++ exception from OpenCV code

部署easyocr的時候出現問題

問題:

Unknown C++ exception from OpenCV code

思路:

Python與CUDA版本不對應,導致Python安裝的OpenCV版本與CUDA版本不照應

解決方法:

CUDA版本由11.3降級為10.2

對於我部署的easyocr還有另一種解決辦法,opencv-python-headless降級到4.5.1.48

小結:

easyocr搭建配置:Python 3.7 CUDA 10.2 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM