| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
- linux도커
- 우분투22.04
- ppocrexportmodel
- 도커이미지
- 리눅스docker
- python
- nvidiadocker
- docker사용법
- 우분투도커재설치
- PyTorch
- nvidiadocker2설치
- paddleocr
- 우분투
- 우분투docker재설치
- 도커우분투
- 리눅스도커
- docker설치오류
- docker container
- dockergpu오류
- 도커
- 우분투도커
- docker재설치
- nvidiadocker설치
- 도커재설치
- vscodesshkey
- ppocr한국어비교
- paddlepaddleocr한국어
- ppocr한국어
- Docker
- dockergpu설치
- Today
- Total
D_ontory : 개발스토리
[OCR] EasyOCR vs Paddle OCR 한국어 인식 비교하기 (1 - PaddleOCR) 본문
OCR 이란? (Optical Character Recognition)
OCR이란 광학 문자 인식 이라고 부르며, 이미지 속 문자를 기계가 해독할 수 있도록 하는 모델이다.
OCR Process에 대해 간단하게 설명하자면, OCR은 크게 두가지 모델이 사용된다.
1. Text Detection (어디쯤에 글자가 있는지 찾음)
2. Text Recognition (찾은 영역 내 글자가 어떤 글자인지 인식함)
결론부터 말하자면, EasyOCR 과 PaddleOCR 을 비교해본 결과, 한국어의 경우는 PaddleOCR 의 인식률이 더 좋았다.
PaddleOCR 실험 결과
PaddleOCR 은 중국 Baidu PaddlePaddle 에서 개발한 OCR 라이브러리다.
성능도 향상시키고, 경량화도 진행하여 CPU 환경에서도 테스트가 수월하게 가능하다.
테스트 데이터는 AIHUB에서 제공하는 책표지 데이터셋을 사용하였다.
추후 학습 데이터로도 사용할 수 있을 것 같다.
< paddle ocr git >
https://github.com/PaddlePaddle/PaddleOCR/blob/main/doc/doc_en/multi_languages_en.md
PaddleOCR/doc/doc_en/multi_languages_en.md at main · PaddlePaddle/PaddleOCR
Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and...
github.com
해당 git 에서 가져온 코드를 조금 수정하여 바로 테스트를 진행 할 수 있다.
from paddleocr import PaddleOCR, draw_ocr
ocr = PaddleOCR(lang="korean") ## 한국어 사용시 korean, 영어사용시 en
# 이미지 경로
img_path ='/workspace/test_tiny/책표지_총류_000014.jpg'
result = ocr.ocr(img_path)
# 추가
result = result[0]
# Recognition and detection can be performed separately through parameter control
# result = ocr.ocr(img_path, det=False) Only perform recognition
# result = ocr.ocr(img_path, rec=False) Only perform detection
# Print detection frame and recognition result
for line in result:
print(line)
# Visualization
from PIL import Image
image = Image.open(img_path).convert('RGB')
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
im_show = draw_ocr(image, boxes, txts, scores, font_path='/workspace/PaddleOCR/doc/fonts/korean.ttf')
im_show = Image.fromarray(im_show)
im_show.save('/workspace/test_result.jpg')
git 코드를 그대로 가져와 사용하다보면 아래와 같은 오류를 만나게 된다.
TypeError: '<' not supported between instances of 'tuple' and 'float'
이를 해결하기 위해서는,
result = result[0]
부분을 추가해 주었다.
< PaddleOCR 한국어 책표지 Test 결과 >



어디를 text로 detection 했는지, 그리고 detection 한 bbox 영역의 글자를 어떤 글자로 인식했는지 시각화까지 손쉽게 해볼 수 있다.
finetuning도 해볼 수 있기 때문에 한국어 데이터셋을 추가하여 한국어에 특화된 데이터셋으로 개발하는 것도 좋은 시도일 것 같다.
'Project > OCR' 카테고리의 다른 글
| PaddleOCR export_model.py : TypeError: can only concatenate list (not "NoneType") to list (0) | 2024.07.22 |
|---|---|
| [paddleOCR] paddleOCR fine-tuning gpu error ValueError: substring not found (0) | 2024.05.29 |