소소한 컴퓨터 이야기

Unveiling PDF Parsing: How to extract formulas from scientific pdf papers

by Cori

해당 포스트는 Medium 'Florian June'이 작성한 Advanced RAG 포스트 시리즈 중 두번째 포스트 (PDF Parsing) 관련 포스트 내용을 정리하며, 학술적 논문에서 공식 등을 추출하는 방법에 대해 다루고 있다.


학술지에서 공식을 추출하는 것은 여전히 도전적인 문제다. 

 

Nougat, Neural Optical Understanding for Academic Documents

Nougat는 문서 페이지를 마크업으로 변환하기 위한 종단 간 학습 가능한 인코더-디코더 트랜스포머 기반 모델으로, Donut에 기반하고 있다.

Simple End-to-End architecture of Donut, https://miro.medium.com/v2/resize:fit:786/format:webp/1*OLG8kibSTT8IUTUt-GZBOw.png

Nougat 패키지는 다음 명령어로 설치할 수 있다. 

pip install git+https://github.com/facebookresearch/nougat
# or 
pip install nougat-ocr

공식 추출 실험을 위해 다음 문서를 사용해보자. 해당 문서에는 2개의 공식이 포함되어 있다. 

The original 5th page in “Attention Is All You Need” paper

다음 명령어를 통해 공식 추출을 진행해보자

nougat path/to/file.pdf -o output_directory

추출한 결과를 렌더링하면 다음과 같이 출력되며, 높은 정확도로 인식하는 것을 볼 수 있다. 특정 숫자가 누락될 때도 있으나, 표에 포함된 공식을 잘 인식하는 등 꽤 괜찮은 성능을 보인다. 

https://miro.medium.com/v2/resize:fit:786/format:webp/1*wNZFcVnwlsx3taEIkRBYqQ.png
https://miro.medium.com/v2/resize:fit:786/format:webp/1*mTBytO0mk-e3FDkmI8Q87Q.png

이외에도 Grobid, Latex-OCR 같은 모델이 있으며, 이 두 모델은 Nougat 보다 좋은 성능을 보인다. 

accuracy of formula recognition, https://miro.medium.com/v2/resize:fit:786/format:webp/1*nSaFINNlZT879d7IxejC6g.png


Ref. 

https://medium.com/towards-artificial-intelligence/advanced-rag-02-unveiling-pdf-parsing-b84ae866344e

'AI > Natural Language Processing' 카테고리의 다른 글

Re-ranking (이론)  (0) 2024.06.11
Using RAGAs + LlamaIndex for RAG evaluation (이론)  (1) 2024.06.11
Unveiling PDF Parsing (이론)  (0) 2024.06.10
Problem of Naive RAG  (2) 2024.06.10
RAG (Retrieval-Augmented Generation)  (0) 2024.06.05

블로그의 정보

코딩하는 오리

Cori

활동하기