https://github.com/JaidedAI/EasyOCR
GitHub - JaidedAI/EasyOCR: Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chines
Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc. - GitHub - JaidedAI/EasyOCR: Ready-to-use OCR with 80+ ...
github.com
영어와 한글을 텍스트로 변환해주는 파일이다.
1. 설치 방법
pip install easyocr
2. gpu사용을 위한 pytorch설치
1
2
3
4
5
|
import easyocr
reader = easyocr.Reader(['ko','en'], gpu=True) # need to run only once to load model into memory
result = reader.readtext('test.jpg')
print(result)
|
cs |


위와 같이 gpu를 설정해도 cpu가 돌아간다. 왜냐하면 딥러닝 프레임 워크인 tensorflw나 pytorch 둘 중 하나가 CUDA버전에 맞게 설치되어 있어야 한다. 그래서 easyOCR이 pytorch프레임워크로 작성 되어 있었기 때문에 필자의 CUDA 10.2버전에 맞는 pytorch버전을 설치해주었다.
https://pytorch.org/get-started/previous-versions
PyTorch
An open source machine learning framework that accelerates the path from research prototyping to production deployment.
pytorch.org
필자는 CUDA버전이 10.2여서 이에 맞는 pytorch버전을 설치함.
conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=10.2 -c pytorch


그러면 이와 같이 GPU로 easyocr을 실행시킬 수 있다. 속도를 비교해보니 cpu는 13초, gpu는 5초가 걸렸다. 훨씬 빨라졋다!
댓글