Enterprise Document OCR

Document AI์˜ ์ผ๋ถ€๋กœ Enterprise Document OCR์„ ์‚ฌ์šฉํ•˜์—ฌ ๋‹ค์–‘ํ•œ ๋ฌธ์„œ์—์„œ ํ…์ŠคํŠธ์™€ ๋ ˆ์ด์•„์›ƒ ์ •๋ณด๋ฅผ ๊ฐ์ง€ํ•˜๊ณ  ์ถ”์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ตฌ์„ฑ ๊ฐ€๋Šฅํ•œ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ฉด ํŠน์ • ๋ฌธ์„œ ์ฒ˜๋ฆฌ ์š”๊ตฌ์‚ฌํ•ญ์„ ์ถฉ์กฑํ•˜๋„๋ก ์‹œ์Šคํ…œ์„ ๋งž์ถค์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ฐœ์š”

Enterprise Document OCR์„ ์‚ฌ์šฉํ•˜์—ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋˜๋Š” ๋จธ์‹ ๋Ÿฌ๋‹์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•œ ๋ฐ์ดํ„ฐ ์ž…๋ ฅ, ๋ฐ์ดํ„ฐ ์ •ํ™•๋„ ๊ฐœ์„  ๋ฐ ๊ฒ€์ฆ๊ณผ ๊ฐ™์€ ์ž‘์—…์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Enterprise Document OCR์„ ์‚ฌ์šฉํ•˜์—ฌ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ž‘์—…์„ ์ฒ˜๋ฆฌํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ํ…์ŠคํŠธ ๋””์ง€ํ„ธํ™”: ๊ฒ€์ƒ‰, ๊ทœ์น™ ๊ธฐ๋ฐ˜ ๋ฌธ์„œ ์ฒ˜๋ฆฌ ํŒŒ์ดํ”„๋ผ์ธ ๋˜๋Š” ๋งž์ถค ๋ชจ๋ธ ์ƒ์„ฑ์„ ์œ„ํ•ด ๋ฌธ์„œ์—์„œ ํ…์ŠคํŠธ ๋ฐ ๋ ˆ์ด์•„์›ƒ ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.
  • ๋Œ€๊ทœ๋ชจ ์–ธ์–ด ๋ชจ๋ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์‚ฌ์šฉ: LLM์˜ ๋งฅ๋ฝ ์ดํ•ด ๋ฐ OCR์˜ ํ…์ŠคํŠธ ๋ฐ ๋ ˆ์ด์•„์›ƒ ์ถ”์ถœ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜์—ฌ ์งˆ๋ฌธ๊ณผ ๋‹ต๋ณ€์„ ์ž๋™ํ™”ํ•ฉ๋‹ˆ๋‹ค. ๋ฐ์ดํ„ฐ์—์„œ ์œ ์šฉํ•œ ์ •๋ณด๋ฅผ ๋„์ถœํ•˜๊ณ  ์›Œํฌํ”Œ๋กœ๋ฅผ ๊ฐ„์†Œํ™”ํ•˜์„ธ์š”.
  • ๋ณด๊ด€: ์ข…์ด ๋ฌธ์„œ๋ฅผ ๊ธฐ๊ณ„๊ฐ€ ์ฝ์„ ์ˆ˜ ์žˆ๋Š” ํ…์ŠคํŠธ๋กœ ๋””์ง€ํ„ธํ™”ํ•˜์—ฌ ๋ฌธ์„œ ์ ‘๊ทผ์„ฑ์„ ๊ฐœ์„ ํ•ฉ๋‹ˆ๋‹ค.

์‚ฌ์šฉ ์‚ฌ๋ก€์— ๊ฐ€์žฅ ์ ํ•ฉํ•œ OCR ์„ ํƒ

ํ•ด๊ฒฐ์ฑ… ์ œํ’ˆ ์„ค๋ช… ์‚ฌ์šฉ ์‚ฌ๋ก€
Document AI Enterprise Document OCR ๋ฌธ์„œ ์‚ฌ์šฉ ์‚ฌ๋ก€๋ฅผ ์œ„ํ•œ ์ „๋ฌธ ๋ชจ๋ธ์ž…๋‹ˆ๋‹ค. ๊ณ ๊ธ‰ ๊ธฐ๋Šฅ์—๋Š” ์ด๋ฏธ์ง€ ํ’ˆ์งˆ ์ ์ˆ˜, ์–ธ์–ด ํžŒํŠธ, ํšŒ์ „ ๋ณด์ •์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค. ๋ฌธ์„œ์—์„œ ํ…์ŠคํŠธ๋ฅผ ์ถ”์ถœํ•  ๋•Œ ๊ถŒ์žฅ๋ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ ์‚ฌ๋ก€์—๋Š” PDF, ์ด๋ฏธ์ง€ ํ˜•ํƒœ์˜ ์Šค์บ”ํ•œ ๋ฌธ์„œ ๋˜๋Š” Microsoft DocX ํŒŒ์ผ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.
Document AI OCR ๋ถ€๊ฐ€๊ธฐ๋Šฅ ํŠน์ • ์š”๊ตฌ์‚ฌํ•ญ์„ ์œ„ํ•œ ํ”„๋ฆฌ๋ฏธ์—„ ๊ธฐ๋Šฅ Enterprise Document OCR ๋ฒ„์ „ 2.0 ์ด์ƒ๊ณผ๋งŒ ํ˜ธํ™˜๋ฉ๋‹ˆ๋‹ค. ์ˆ˜ํ•™ ๊ณต์‹์„ ๊ฐ์ง€ํ•˜๊ณ  ์ธ์‹ํ•˜๊ฑฐ๋‚˜, ๊ธ€๊ผด ์Šคํƒ€์ผ ์ •๋ณด๋ฅผ ์ˆ˜์‹ ํ•˜๊ฑฐ๋‚˜, ์ฒดํฌ๋ฐ•์Šค ์ถ”์ถœ์„ ์‚ฌ์šฉ ์„ค์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
Cloud Vision API ํ…์ŠคํŠธ ๊ฐ์ง€ Google Cloud ํ‘œ์ค€ OCR ๋ชจ๋ธ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์ „ ์„ธ๊ณ„์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” REST API ๋ถ„๋‹น ์š”์ฒญ 1,800๊ฐœ์˜ ๊ธฐ๋ณธ ํ• ๋‹น๋Ÿ‰ ์งง์€ ์ง€์—ฐ ์‹œ๊ฐ„๊ณผ ๋†’์€ ์šฉ๋Ÿ‰์ด ํ•„์š”ํ•œ ์ผ๋ฐ˜์ ์ธ ํ…์ŠคํŠธ ์ถ”์ถœ ์‚ฌ์šฉ ์‚ฌ๋ก€
Cloud Vision OCR Google Distributed Cloud (์ง€์› ์ค‘๋‹จ๋จ) GKE Enterprise๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ GKE ํด๋Ÿฌ์Šคํ„ฐ์— ์ปจํ…Œ์ด๋„ˆ๋กœ ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ๋Š” Google Cloud Marketplace ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ž…๋‹ˆ๋‹ค. ๋ฐ์ดํ„ฐ ์ƒ์ฃผ ๋˜๋Š” ๊ทœ์ • ์ค€์ˆ˜ ์š”๊ตฌ์‚ฌํ•ญ์„ ์ถฉ์กฑํ•˜๊ธฐ ์œ„ํ•ด

๊ฐ์ง€ ๋ฐ ์ถ”์ถœ

Enterprise Document OCR์€ PDF ๋ฐ ์ด๋ฏธ์ง€์—์„œ ๋ธ”๋ก, ๋‹จ๋ฝ, ํ–‰, ๋‹จ์–ด, ๊ธฐํ˜ธ๋ฅผ ๊ฐ์ง€ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ์ •ํ™•๋„๋ฅผ ๋†’์ด๊ธฐ ์œ„ํ•ด ๋ฌธ์„œ์˜ ๊ธฐ์šธ๊ธฐ๋ฅผ ๋ณด์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ง€์›๋˜๋Š” ๋ ˆ์ด์•„์›ƒ ๊ฐ์ง€ ๋ฐ ์ถ”์ถœ ์†์„ฑ:

์ธ์‡„๋œ ํ…์ŠคํŠธ ์†๊ธ€์”จ ๋‹จ๋ฝ ์ฐจ๋‹จ ์„  Word ๊ธฐํ˜ธ ์ˆ˜์ค€ ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ
๊ธฐ๋ณธ๊ฐ’ ๊ธฐ๋ณธ๊ฐ’ ๊ธฐ๋ณธ๊ฐ’ ๊ธฐ๋ณธ๊ฐ’ ๊ธฐ๋ณธ๊ฐ’ ๊ธฐ๋ณธ๊ฐ’ ๊ตฌ์„ฑ ๊ฐ€๋Šฅ ๊ธฐ๋ณธ๊ฐ’

๊ตฌ์„ฑ ๊ฐ€๋Šฅํ•œ Enterprise Document OCR ๊ธฐ๋Šฅ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  • ๋””์ง€ํ„ธ PDF์—์„œ ์‚ฝ์ž…๋œ ํ…์ŠคํŠธ ๋˜๋Š” ๊ธฐ๋ณธ ํ…์ŠคํŠธ ์ถ”์ถœ: ์ด ๊ธฐ๋Šฅ์€ ํšŒ์ „๋œ ํ…์ŠคํŠธ, ๊ทน๋‹จ์ ์ธ ๊ธ€๊ผด ํฌ๊ธฐ ๋˜๋Š” ์Šคํƒ€์ผ, ๋ถ€๋ถ„์ ์œผ๋กœ ์ˆจ๊ฒจ์ง„ ํ…์ŠคํŠธ์˜ ๊ฒฝ์šฐ์—๋„ ์†Œ์Šค ๋ฌธ์„œ์— ํ‘œ์‹œ๋œ ๋Œ€๋กœ ํ…์ŠคํŠธ์™€ ๊ธฐํ˜ธ๋ฅผ ์ •ํ™•ํ•˜๊ฒŒ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.

  • ํšŒ์ „ ์ˆ˜์ •: Enterprise Document OCR์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์„œ ์ด๋ฏธ์ง€๋ฅผ ์ „์ฒ˜๋ฆฌํ•˜์—ฌ ์ถ”์ถœ ํ’ˆ์งˆ์ด๋‚˜ ์ฒ˜๋ฆฌ์— ์˜ํ–ฅ์„ ์ค„ ์ˆ˜ ์žˆ๋Š” ํšŒ์ „ ๋ฌธ์ œ๋ฅผ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค.

  • ์ด๋ฏธ์ง€ ํ’ˆ์งˆ ์ ์ˆ˜: ๋ฌธ์„œ ๋ผ์šฐํŒ…์— ๋„์›€์ด ๋˜๋Š” ํ’ˆ์งˆ ์ธก์ •ํ•ญ๋ชฉ์„ ์ˆ˜์‹ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฏธ์ง€ ํ’ˆ์งˆ ์ ์ˆ˜๋Š” ํ๋ฆผ, ํ‰์†Œ๋ณด๋‹ค ์ž‘์€ ๊ธ€๊ผด์˜ ์กด์žฌ, ๋ˆˆ๋ถ€์‹ฌ ๋“ฑ 8๊ฐ€์ง€ ์ธก๋ฉด์—์„œ ํŽ˜์ด์ง€ ์ˆ˜์ค€ ํ’ˆ์งˆ ์ธก์ •ํ•ญ๋ชฉ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

  • ํŽ˜์ด์ง€ ๋ฒ”์œ„ ์ง€์ •: OCR์„ ์œ„ํ•ด ์ž…๋ ฅ ๋ฌธ์„œ์˜ ํŽ˜์ด์ง€ ๋ฒ”์œ„๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ถˆํ•„์š”ํ•œ ํŽ˜์ด์ง€์— ๋Œ€ํ•œ ์ง€์ถœ๊ณผ ์ฒ˜๋ฆฌ ์‹œ๊ฐ„์„ ์ ˆ์•ฝํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ์–ธ์–ด ๊ฐ์ง€: ์ถ”์ถœ๋œ ํ…์ŠคํŠธ์— ์‚ฌ์šฉ๋œ ์–ธ์–ด๋ฅผ ๊ฐ์ง€ํ•ฉ๋‹ˆ๋‹ค.

  • ์–ธ์–ด ๋ฐ ํ•„๊ธฐ ํžŒํŠธ: ๋ฐ์ดํ„ฐ ์„ธํŠธ์˜ ์•Œ๋ ค์ง„ ํŠน์„ฑ์„ ๊ธฐ๋ฐ˜์œผ๋กœ OCR ๋ชจ๋ธ์— ์–ธ์–ด ๋˜๋Š” ํ•„๊ธฐ ํžŒํŠธ๋ฅผ ์ œ๊ณตํ•˜์—ฌ ์ •ํ™•๋„๋ฅผ ๊ฐœ์„ ํ•ฉ๋‹ˆ๋‹ค.

OCR ๊ตฌ์„ฑ์„ ์‚ฌ์šฉ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด๋ ค๋ฉด OCR ๊ตฌ์„ฑ ์‚ฌ์šฉ ์„ค์ •์„ ์ฐธ๊ณ ํ•˜์„ธ์š”.

OCR ๋ถ€๊ฐ€๊ธฐ๋Šฅ

Enterprise Document OCR์€ ํ•„์š”์— ๋”ฐ๋ผ ๊ฐœ๋ณ„ ์ฒ˜๋ฆฌ ์š”์ฒญ์—์„œ ์‚ฌ์šฉ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š” ์„ ํƒ์  ๋ถ„์„ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

์•ˆ์ •ํ™” pretrained-ocr-v2.0-2023-06-02 ๋ฐ pretrained-ocr-v2.1-2024-08-07 ๋ฒ„์ „๊ณผ ์ถœ์‹œ ํ›„๋ณด pretrained-ocr-v2.1.1-2025-01-31 ๋ฒ„์ „์—์„œ๋Š” ๋‹ค์Œ ๋ถ€๊ฐ€๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ์ˆ˜ํ•™ OCR: ๋ฌธ์„œ์—์„œ LaTeX ํ˜•์‹์˜ ๊ณต์‹์„ ์‹๋ณ„ํ•˜๊ณ  ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.
  • ์ฒดํฌ๋ฐ•์Šค ์ถ”์ถœ: Enterprise Document OCR ์‘๋‹ต์—์„œ ์ฒดํฌ๋ฐ•์Šค๋ฅผ ๊ฐ์ง€ํ•˜๊ณ  ์ƒํƒœ(์„ ํƒ๋จ/์„ ํƒ ์•ˆ ๋จ)๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.
  • ๊ธ€๊ผด ์Šคํƒ€์ผ ๊ฐ์ง€: ๊ธ€๊ผด ์œ ํ˜•, ๊ธ€๊ผด ์Šคํƒ€์ผ, ํ•„๊ธฐ์ฒด, ๋‘๊ป˜, ์ƒ‰์ƒ ๋“ฑ ๋‹จ์–ด ์ˆ˜์ค€ ๊ธ€๊ผด ์†์„ฑ์„ ์‹๋ณ„ํ•ฉ๋‹ˆ๋‹ค.

๋‚˜์—ด๋œ ๋ถ€๊ฐ€๊ธฐ๋Šฅ์„ ์‚ฌ์šฉ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด๋ ค๋ฉด OCR ๋ถ€๊ฐ€๊ธฐ๋Šฅ ์‚ฌ์šฉ ์„ค์ •์„ ์ฐธ๊ณ ํ•˜์„ธ์š”.

์ง€์›๋˜๋Š” ํŒŒ์ผ ํ˜•์‹

์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ๋ฌธ์„œ OCR์€ PDF, GIF, TIFF, JPEG, PNG, BMP, WebP ํŒŒ์ผ ํ˜•์‹์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ์ง€์›๋˜๋Š” ํŒŒ์ผ์„ ์ฐธ๊ณ ํ•˜์„ธ์š”.

Enterprise Document OCR์€ ๋™๊ธฐ์‹์œผ๋กœ ์ตœ๋Œ€ 15ํŽ˜์ด์ง€, ๋น„๋™๊ธฐ์‹์œผ๋กœ ์ตœ๋Œ€ 30ํŽ˜์ด์ง€์˜ DocX ํŒŒ์ผ๋„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ํ• ๋‹น๋Ÿ‰ ์ฆ๊ฐ€ ์š”์ฒญ(QIR)์„ ํ•˜๋ ค๋ฉด ํ• ๋‹น๋Ÿ‰ ์กฐ์ • ์š”์ฒญ ๋‹จ๊ณ„๋ฅผ ๋”ฐ๋ฅด์„ธ์š”. DocX ์ง€์›์€ ๋น„๊ณต๊ฐœ ํ”„๋ฆฌ๋ทฐ ๋ฒ„์ „์ž…๋‹ˆ๋‹ค. ์•ก์„ธ์Šค๋ฅผ ์š”์ฒญํ•˜๋ ค๋ฉด Google ๊ณ„์ •ํŒ€์— ๋ฌธ์˜ํ•˜์„ธ์š”.

๊ณ ๊ธ‰ ๋ฒ„์ „ ๊ด€๋ฆฌ

๊ณ ๊ธ‰ ๋ฒ„์ „ ๊ด€๋ฆฌ๋Š” ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์ƒํƒœ์ž…๋‹ˆ๋‹ค. ๊ธฐ๋ณธ AI/ML OCR ๋ชจ๋ธ์„ ์—…๊ทธ๋ ˆ์ด๋“œํ•˜๋ฉด OCR ๋™์ž‘์ด ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—„๊ฒฉํ•œ ์ผ๊ด€์„ฑ์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ ๊ณ ์ •๋œ ๋ชจ๋ธ ๋ฒ„์ „์„ ์‚ฌ์šฉํ•˜์—ฌ ์ตœ๋Œ€ 18๊ฐœ์›” ๋™์•ˆ ๋™์ž‘์„ ๊ธฐ์กด OCR ๋ชจ๋ธ์— ๊ณ ์ •ํ•˜์„ธ์š”. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด OCR ๊ธฐ๋Šฅ ๊ฒฐ๊ณผ๊ฐ€ ๋™์ผํ•ด์ง‘๋‹ˆ๋‹ค. ํ”„๋กœ์„ธ์„œ ๋ฒ„์ „์— ๊ด€ํ•œ ํ‘œ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

ํ”„๋กœ์„ธ์„œ ๋ฒ„์ „

๋‹ค์Œ ํ”„๋กœ์„ธ์„œ ๋ฒ„์ „์€ ์ด ๊ธฐ๋Šฅ๊ณผ ํ˜ธํ™˜๋ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ํ”„๋กœ์„ธ์„œ ๋ฒ„์ „ ๊ด€๋ฆฌ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

๋ฒ„์ „ ID ์ถœ์‹œ ์ฑ„๋„ ์„ค๋ช…
pretrained-ocr-v1.2-2022-11-10 ์ •์‹ ๊ณ ์ •๋œ ๋ชจ๋ธ ๋ฒ„์ „ 1.0: ์ตœ๋Œ€ 18๊ฐœ์›” ๋™์•ˆ ์ปจํ…Œ์ด๋„ˆ ์ด๋ฏธ์ง€์— ๊ณ ์ •๋œ ๋ฒ„์ „ ์Šค๋ƒ…์ƒท์˜ ๋ชจ๋ธ ํŒŒ์ผ, ๊ตฌ์„ฑ, ๋ฐ”์ด๋„ˆ๋ฆฌ์ž…๋‹ˆ๋‹ค.
pretrained-ocr-v2.0-2023-06-02 ์ •์‹ ๋ฌธ์„œ ์‚ฌ์šฉ ์‚ฌ๋ก€์— ํŠนํ™”๋œ ํ”„๋กœ๋•์…˜ ์ง€์› ๋ชจ๋ธ์ž…๋‹ˆ๋‹ค. ๋ชจ๋“  OCR ๋ถ€๊ฐ€๊ธฐ๋Šฅ์— ๋Œ€ํ•œ ์•ก์„ธ์Šค๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.
pretrained-ocr-v2.1-2024-08-07 ์ •์‹ v2.1์˜ ์ฃผ์š” ๊ฐœ์„ ์‚ฌํ•ญ์€ ์ธ์‡„๋œ ํ…์ŠคํŠธ ์ธ์‹ ๊ฐœ์„ , ๋” ์ •ํ™•ํ•œ ์ฒดํฌ๋ฐ•์Šค ๊ฐ์ง€, ๋” ์ •ํ™•ํ•œ ์ฝ๊ธฐ ์ˆœ์„œ์ž…๋‹ˆ๋‹ค.
pretrained-ocr-v2.1.1-2025-01-31 ์ถœ์‹œ ํ›„๋ณด v2.1.1์€ v2.1๊ณผ ์œ ์‚ฌํ•˜๋ฉฐ US, EU, asia-southeast1๋ฅผ ์ œ์™ธํ•œ ๋ชจ๋“  ๋ฆฌ์ „์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Enterprise Document OCR์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์„œ ์ฒ˜๋ฆฌ

์ด ๋น ๋ฅธ ์‹œ์ž‘์—์„œ๋Š” Enterprise Document OCR์„ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ OCR ๊ตฌ์„ฑ์„ ์‚ฌ์šฉ ์„ค์ • ๋˜๋Š” ์‚ฌ์šฉ ์ค‘์ง€ํ•˜์—ฌ ์›Œํฌํ”Œ๋กœ์˜ ๋ฌธ์„œ OCR ๊ฒฐ๊ณผ๋ฅผ ์ตœ์ ํ™”ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

  1. Google Cloud ๊ณ„์ •์— ๋กœ๊ทธ์ธํ•ฉ๋‹ˆ๋‹ค. Google Cloud๋ฅผ ์ฒ˜์Œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ ๊ณ„์ •์„ ๋งŒ๋“ค๊ณ  Google ์ œํ’ˆ์˜ ์‹ค์ œ ์„ฑ๋Šฅ์„ ํ‰๊ฐ€ํ•ด ๋ณด์„ธ์š”. ์‹ ๊ทœ ๊ณ ๊ฐ์—๊ฒŒ๋Š” ์›Œํฌ๋กœ๋“œ๋ฅผ ์‹คํ–‰, ํ…Œ์ŠคํŠธ, ๋ฐฐํฌํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” $300์˜ ๋ฌด๋ฃŒ ํฌ๋ ˆ๋”ง์ด ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM roleโ€”you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Document AI API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM roleโ€”you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the Document AI API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

Enterprise Document OCR ํ”„๋กœ์„ธ์„œ ๋งŒ๋“ค๊ธฐ

๋จผ์ € Enterprise Document OCR ํ”„๋กœ์„ธ์„œ๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ํ”„๋กœ์„ธ์„œ ๋งŒ๋“ค๊ธฐ ๋ฐ ๊ด€๋ฆฌ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

OCR ๊ตฌ์„ฑ

๋ชจ๋“  OCR ๊ตฌ์„ฑ์€ ProcessDocumentRequest ๋˜๋Š” BatchProcessDocumentsRequest์˜ ProcessOptions.ocrConfig์—์„œ ํ•ด๋‹น ํ•„๋“œ๋ฅผ ์„ค์ •ํ•˜์—ฌ ์‚ฌ์šฉ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ž์„ธํ•œ ๋‚ด์šฉ์€ ์ฒ˜๋ฆฌ ์š”์ฒญ ๋ณด๋‚ด๊ธฐ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

์ด๋ฏธ์ง€ ํ’ˆ์งˆ ๋ถ„์„

์ง€๋Šฅํ˜• ๋ฌธ์„œ ํ’ˆ์งˆ ๋ถ„์„์€ ๋จธ์‹ ๋Ÿฌ๋‹์„ ์‚ฌ์šฉํ•˜์—ฌ ์ฝ˜ํ…์ธ ์˜ ๊ฐ€๋…์„ฑ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ๋ฌธ์„œ์˜ ํ’ˆ์งˆ์„ ํ‰๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ์ด ํ’ˆ์งˆ ํ‰๊ฐ€๋Š” ํ’ˆ์งˆํ‰๊ฐ€์ ์ˆ˜ [0, 1]๋กœ ๋ฐ˜ํ™˜๋˜๋ฉฐ 1๋Š” ์™„๋ฒฝํ•œ ํ’ˆ์งˆ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ์ธ์‹๋œ ํ’ˆ์งˆํ‰๊ฐ€์ ์ˆ˜๊ฐ€ 0.5 ๋ฏธ๋งŒ์ธ ๊ฒฝ์šฐ ๋ถ€์ •์ ์ธ ํ’ˆ์งˆ ์‚ฌ์œ  ๋ชฉ๋ก (๊ฐ€๋Šฅ์„ฑ ๊ธฐ์ค€์œผ๋กœ ์ •๋ ฌ)์ด ํ•จ๊ป˜ ๋ฐ˜ํ™˜๋ฉ๋‹ˆ๋‹ค. ๊ฐ€๋Šฅ์„ฑ์ด 0.5๋ณด๋‹ค ํฌ๋ฉด ์–‘์„ฑ ๊ฐ์ง€๋กœ ๊ฐ„์ฃผ๋ฉ๋‹ˆ๋‹ค.

๋ฌธ์„œ์— ๊ฒฐํ•จ์ด ์žˆ๋Š” ๊ฒƒ์œผ๋กœ ๊ฐ„์ฃผ๋˜๋ฉด API๋Š” ๋‹ค์Œ 8๊ฐ€์ง€ ๋ฌธ์„œ ๊ฒฐํ•จ ์œ ํ˜•์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

  • quality/defect_blurry
  • quality/defect_noisy
  • quality/defect_dark
  • quality/defect_faint
  • quality/defect_text_too_small
  • quality/defect_document_cutoff
  • quality/defect_text_cutoff
  • quality/defect_glare

ํ˜„์žฌ ๋ฌธ์„œ ํ’ˆ์งˆ ๋ถ„์„์—๋Š” ๋ช‡ ๊ฐ€์ง€ ์ œํ•œ์‚ฌํ•ญ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

  • ๊ฒฐํ•จ์ด ์—†๋Š” ๋””์ง€ํ„ธ ๋ฌธ์„œ์—์„œ ๊ฑฐ์ง“์–‘์„ฑ ๊ฐ์ง€๋ฅผ ๋ฐ˜ํ™˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ธฐ๋Šฅ์€ ์Šค์บ”ํ•˜๊ฑฐ๋‚˜ ์ดฌ์˜ํ•œ ๋ฌธ์„œ์— ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๊ฐ€์žฅ ์ข‹์Šต๋‹ˆ๋‹ค.
  • ๋ˆˆ๋ถ€์‹ฌ ๊ฒฐํ•จ์€ ๋กœ์ปฌ์ž…๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์š”์†Œ๊ฐ€ ์ „์ฒด ๋ฌธ์„œ์˜ ๊ฐ€๋…์„ฑ์„ ์ €ํ•ดํ•˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ž…๋ ฅ

์ฒ˜๋ฆฌ ์š”์ฒญ์—์„œ ProcessOptions.ocrConfig.enableImageQualityScores์„ true๋กœ ์„ค์ •ํ•˜์—ฌ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ด ์ถ”๊ฐ€ ๊ธฐ๋Šฅ์€ ํ”„๋กœ์„ธ์Šค ํ˜ธ์ถœ์— OCR ์ฒ˜๋ฆฌ์™€ ๋น„์Šทํ•œ ์ง€์—ฐ ์‹œ๊ฐ„์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

  {
    "rawDocument": {
      "mimeType": "MIME_TYPE",
      "content": "IMAGE_CONTENT"
    },
    "processOptions": {
      "ocrConfig": {
        "enableImageQualityScores": true
      }
    }
  }

์ถœ๋ ฅ

๊ฒฐํ•จ ๊ฐ์ง€ ๊ฒฐ๊ณผ๋Š” Document.pages[].imageQualityScores[]์— ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

  {
    "pages": [
      {
        "imageQualityScores": {
          "qualityScore": 0.7811847,
          "detectedDefects": [
            {
              "type": "quality/defect_document_cutoff",
              "confidence": 1.0
            },
            {
              "type": "quality/defect_glare",
              "confidence": 0.97849524
            },
            {
              "type": "quality/defect_text_cutoff",
              "confidence": 0.5
            }
          ]
        }
      }
    ]
  }

์ „์ฒด ์ถœ๋ ฅ ์˜ˆ์‹œ๋Š” ์ƒ˜ํ”Œ ํ”„๋กœ์„ธ์„œ ์ถœ๋ ฅ์„ ์ฐธ๊ณ ํ•˜์„ธ์š”.

์–ธ์–ด ํžŒํŠธ

OCR ํ”„๋กœ์„ธ์„œ๋Š” OCR ์—”์ง„ ์„ฑ๋Šฅ์„ ๊ฐœ์„ ํ•˜๊ธฐ ์œ„ํ•ด ์ •์˜ํ•œ ์–ธ์–ด ํžŒํŠธ๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ์–ธ์–ด ํžŒํŠธ๋ฅผ ์ ์šฉํ•˜๋ฉด OCR์ด ์ถ”๋ก ๋œ ์–ธ์–ด๊ฐ€ ์•„๋‹Œ ์„ ํƒ๋œ ์–ธ์–ด์— ๋งž๊ฒŒ ์ตœ์ ํ™”๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ž…๋ ฅ

BCP-47 ์–ธ์–ด ์ฝ”๋“œ ๋ชฉ๋ก์œผ๋กœ ProcessOptions.ocrConfig.hints[].languageHints[]์„ ์„ค์ •ํ•˜์—ฌ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

  {
    "rawDocument": {
      "mimeType": "MIME_TYPE",
      "content": "IMAGE_CONTENT"
    },
    "processOptions": {
      "ocrConfig": {
        "hints": {
          "languageHints": ["en", "es"]
        }
      }
    }
  }

์ „์ฒด ์ถœ๋ ฅ ์˜ˆ์‹œ๋Š” ์ƒ˜ํ”Œ ํ”„๋กœ์„ธ์„œ ์ถœ๋ ฅ์„ ์ฐธ๊ณ ํ•˜์„ธ์š”.

๊ธฐํ˜ธ ๊ฐ์ง€

๋ฌธ์„œ ์‘๋‹ต์—์„œ ๊ธฐํ˜ธ (๋˜๋Š” ๊ฐœ๋ณ„ ๊ธ€์ž) ์ˆ˜์ค€์œผ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ฑ„์›๋‹ˆ๋‹ค.

์ž…๋ ฅ

์ฒ˜๋ฆฌ ์š”์ฒญ์—์„œ ProcessOptions.ocrConfig.enableSymbol์„ true๋กœ ์„ค์ •ํ•˜์—ฌ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

  {
    "rawDocument": {
      "mimeType": "MIME_TYPE",
      "content": "IMAGE_CONTENT"
    },
    "processOptions": {
      "ocrConfig": {
        "enableSymbol": true
      }
    }
  }

์ถœ๋ ฅ

์ด ๊ธฐ๋Šฅ์ด ์‚ฌ์šฉ ์„ค์ •๋˜๋ฉด Document.pages[].symbols[] ํ•„๋“œ๊ฐ€ ์ฑ„์›Œ์ง‘๋‹ˆ๋‹ค.

์ „์ฒด ์ถœ๋ ฅ ์˜ˆ์‹œ๋Š” ์ƒ˜ํ”Œ ํ”„๋กœ์„ธ์„œ ์ถœ๋ ฅ์„ ์ฐธ๊ณ ํ•˜์„ธ์š”.

๊ธฐ๋ณธ ์ œ๊ณต PDF ํŒŒ์‹ฑ

๋””์ง€ํ„ธ PDF ํŒŒ์ผ์—์„œ ์‚ฝ์ž…๋œ ํ…์ŠคํŠธ๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ ์„ค์ •ํ•˜๋ฉด ๋””์ง€ํ„ธ ํ…์ŠคํŠธ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ ๋‚ด์žฅ ๋””์ง€ํ„ธ PDF ๋ชจ๋ธ์ด ์ž๋™์œผ๋กœ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๋””์ง€ํ„ธ์ด ์•„๋‹Œ ํ…์ŠคํŠธ๊ฐ€ ์žˆ์œผ๋ฉด ๊ด‘ํ•™ OCR ๋ชจ๋ธ์ด ์ž๋™์œผ๋กœ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๋Š” ๋ณ‘ํ•ฉ๋œ ํ…์ŠคํŠธ ๊ฒฐ๊ณผ๋ฅผ ๋ชจ๋‘ ์ˆ˜์‹ ํ•ฉ๋‹ˆ๋‹ค.

์ž…๋ ฅ

์ฒ˜๋ฆฌ ์š”์ฒญ์—์„œ ProcessOptions.ocrConfig.enableNativePdfParsing์„ true๋กœ ์„ค์ •ํ•˜์—ฌ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

  {
    "rawDocument": {
      "mimeType": "MIME_TYPE",
      "content": "IMAGE_CONTENT"
    },
    "processOptions": {
      "ocrConfig": {
        "enableNativePdfParsing": true
      }
    }
  }

Character-in-the-box ๊ฐ์ง€

๊ธฐ๋ณธ์ ์œผ๋กœ Enterprise Document OCR์—๋Š” ์ƒ์ž ์•ˆ์— ์žˆ๋Š” ๋ฌธ์ž์˜ ํ…์ŠคํŠธ ์ถ”์ถœ ํ’ˆ์งˆ์„ ๊ฐœ์„ ํ•˜๊ธฐ ์œ„ํ•ด ๊ฐ์ง€๊ธฐ๊ฐ€ ์‚ฌ์šฉ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

enterprise-document-ocr-1

์ƒ์ž ์•ˆ์˜ ๋ฌธ์ž์— OCR ํ’ˆ์งˆ ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ ์‚ฌ์šฉ ์ค‘์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ž…๋ ฅ

์ฒ˜๋ฆฌ ์š”์ฒญ์—์„œ ProcessOptions.ocrConfig.disableCharacterBoxesDetection์„ true๋กœ ์„ค์ •ํ•˜์—ฌ ์‚ฌ์šฉ ์ค‘์ง€ํ•ฉ๋‹ˆ๋‹ค.

  {
    "rawDocument": {
      "mimeType": "MIME_TYPE",
      "content": "IMAGE_CONTENT"
    },
    "processOptions": {
      "ocrConfig": {
        "disableCharacterBoxesDetection": true
      }
    }
  }

๊ธฐ์กด ๋ ˆ์ด์•„์›ƒ

ํœด๋ฆฌ์Šคํ‹ฑ ๋ ˆ์ด์•„์›ƒ ๊ฐ์ง€ ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ ํ˜„์žฌ ML ๊ธฐ๋ฐ˜ ๋ ˆ์ด์•„์›ƒ ๊ฐ์ง€ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ๋Œ€์•ˆ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ์กด ๋ ˆ์ด์•„์›ƒ์„ ์‚ฌ์šฉ ์„ค์ •ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ๊ถŒ์žฅ๋˜๋Š” ๊ตฌ์„ฑ์ด ์•„๋‹™๋‹ˆ๋‹ค. ๊ณ ๊ฐ์€ ๋ฌธ์„œ ์›Œํฌํ”Œ๋กœ์— ๋”ฐ๋ผ ๊ฐ€์žฅ ์ ํ•ฉํ•œ ๋ ˆ์ด์•„์›ƒ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์„ ํƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ž…๋ ฅ

์ฒ˜๋ฆฌ ์š”์ฒญ์—์„œ ProcessOptions.ocrConfig.advancedOcrOptions์„ ["legacy_layout"]๋กœ ์„ค์ •ํ•˜์—ฌ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

  {
    "rawDocument": {
      "mimeType": "MIME_TYPE",
      "content": "IMAGE_CONTENT"
    },
    "processOptions": {
      "ocrConfig": {
          "advancedOcrOptions": ["legacy_layout"]
      }
    }
  }

ํŽ˜์ด์ง€ ๋ฒ”์œ„ ์ง€์ •

๊ธฐ๋ณธ์ ์œผ๋กœ OCR์€ ๋ฌธ์„œ์˜ ๋ชจ๋“  ํŽ˜์ด์ง€์—์„œ ํ…์ŠคํŠธ์™€ ๋ ˆ์ด์•„์›ƒ ์ •๋ณด๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค. ํŠน์ • ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ ๋˜๋Š” ํŽ˜์ด์ง€ ๋ฒ”์œ„๋ฅผ ์„ ํƒํ•˜์—ฌ ํ•ด๋‹น ํŽ˜์ด์ง€์˜ ํ…์ŠคํŠธ๋งŒ ์ถ”์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ProcessOptions์—์„œ ์ด๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์„ธ ๊ฐ€์ง€์ž…๋‹ˆ๋‹ค.

  • ๋‘ ๋ฒˆ์งธ ํŽ˜์ด์ง€์™€ ๋‹ค์„ฏ ๋ฒˆ์งธ ํŽ˜์ด์ง€๋งŒ ์ฒ˜๋ฆฌํ•˜๋ ค๋ฉด ๋‹ค์Œ์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
  {
    "individualPageSelector": {"pages": [2, 5]}
  }
  • ์ฒ˜์Œ ์„ธ ํŽ˜์ด์ง€๋ฅผ ์ฒ˜๋ฆฌํ•˜๋ ค๋ฉด ๋‹ค์Œ์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
  {
    "fromStart": 3
  }
  • ๋งˆ์ง€๋ง‰ 4ํŽ˜์ด์ง€๋งŒ ์ฒ˜๋ฆฌํ•˜๋ ค๋ฉด ๋‹ค์Œ์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
  {
    "fromEnd": 4
  }

๋Œ€๋‹ต์—์„œ ๊ฐ Document.pages[].pageNumber์€ ์š”์ฒญ์— ์ง€์ •๋œ ๋™์ผํ•œ ํŽ˜์ด์ง€์— ํ•ด๋‹นํ•ฉ๋‹ˆ๋‹ค.

OCR ๋ถ€๊ฐ€๊ธฐ๋Šฅ ์‚ฌ์šฉ

์ด๋Ÿฌํ•œ Enterprise Document OCR ์„ ํƒ์  ๋ถ„์„ ๊ธฐ๋Šฅ์€ ํ•„์š”์— ๋”ฐ๋ผ ๊ฐœ๋ณ„ ์ฒ˜๋ฆฌ ์š”์ฒญ์—์„œ ์‚ฌ์šฉ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ˆ˜ํ•™ OCR

Math OCR์€ ๊ฒฝ๊ณ„ ์ƒ์ž ์ขŒํ‘œ์™€ ํ•จ๊ป˜ LaTeX์œผ๋กœ ํ‘œํ˜„๋œ ์ˆ˜ํ•™ ๋ฐฉ์ •์‹๊ณผ ๊ฐ™์€ ๊ณต์‹์„ ๊ฐ์ง€, ์ธ์‹, ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ์€ LaTeX ํ‘œํ˜„์˜ ์˜ˆ์ž…๋‹ˆ๋‹ค.

  • ์ด๋ฏธ์ง€ ๊ฐ์ง€๋จ

    enterprise-document-ocr-2

  • LaTeX๋กœ ๋ณ€ํ™˜

    enterprise-document-ocr-3

์ž…๋ ฅ

์ฒ˜๋ฆฌ ์š”์ฒญ์—์„œ ProcessOptions.ocrConfig.premiumFeatures.enableMathOcr์„ true๋กœ ์„ค์ •ํ•˜์—ฌ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

  {
    "rawDocument": {
      "mimeType": "MIME_TYPE",
      "content": "IMAGE_CONTENT"
    },
    "processOptions": {
      "ocrConfig": {
          "premiumFeatures": {
            "enableMathOcr": true
          }
      }
    }
  }

์ถœ๋ ฅ

์ˆ˜ํ•™ OCR ์ถœ๋ ฅ์€ "type": "math_formula"์™€ ํ•จ๊ป˜ Document.pages[].visualElements[]์— ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

"visualElements": [
  {
    "layout": {
      "textAnchor": {
        "textSegments": [
          {
            "endIndex": "46"
          }
        ]
      },
      "confidence": 1,
      "boundingPoly": {
        "normalizedVertices": [
          {
            "x": 0.14662756,
            "y": 0.27891156
          },
          {
            "x": 0.9032258,
            "y": 0.27891156
          },
          {
            "x": 0.9032258,
            "y": 0.8027211
          },
          {
            "x": 0.14662756,
            "y": 0.8027211
          }
        ]
      },
      "orientation": "PAGE_UP"
    },
    "type": "math_formula"
  }
]

์ด ๋งํฌ์—์„œ ์ „์ฒด Document JSON ์ถœ๋ ฅ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค .

์„ ํƒ ํ‘œ์‹œ ์ถ”์ถœ

์‚ฌ์šฉ ์„ค์ •๋œ ๊ฒฝ์šฐ ๋ชจ๋ธ์€ ๊ฒฝ๊ณ„ ์ƒ์ž ์ขŒํ‘œ์™€ ํ•จ๊ป˜ ๋ฌธ์„œ์˜ ๋ชจ๋“  ์ฒดํฌ๋ฐ•์Šค์™€ ๋ผ๋””์˜ค ๋ฒ„ํŠผ์„ ์ถ”์ถœํ•˜๋ ค๊ณ  ์‹œ๋„ํ•ฉ๋‹ˆ๋‹ค.

์ž…๋ ฅ

์ฒ˜๋ฆฌ ์š”์ฒญ์—์„œ ProcessOptions.ocrConfig.premiumFeatures.enableSelectionMarkDetection์„ true๋กœ ์„ค์ •ํ•˜์—ฌ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

  {
    "rawDocument": {
      "mimeType": "MIME_TYPE",
      "content": "IMAGE_CONTENT"
    },
    "processOptions": {
      "ocrConfig": {
          "premiumFeatures": {
            "enableSelectionMarkDetection": true
          }
      }
    }
  }

์ถœ๋ ฅ

์ฒดํฌ๋ฐ•์Šค ์ถœ๋ ฅ์€ "type": "unfilled_checkbox" ๋˜๋Š” "type": "filled_checkbox"์™€ ํ•จ๊ป˜ Document.pages[].visualElements[]์— ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

"visualElements": [
  {
    "layout": {
      "confidence": 0.89363575,
      "boundingPoly": {
        "vertices": [
          {
            "x": 11,
            "y": 24
          },
          {
            "x": 37,
            "y": 24
          },
          {
            "x": 37,
            "y": 56
          },
          {
            "x": 11,
            "y": 56
          }
        ],
        "normalizedVertices": [
          {
            "x": 0.017488075,
            "y": 0.38709676
          },
          {
            "x": 0.05882353,
            "y": 0.38709676
          },
          {
            "x": 0.05882353,
            "y": 0.9032258
          },
          {
            "x": 0.017488075,
            "y": 0.9032258
          }
        ]
      }
    },
    "type": "unfilled_checkbox"
  },
  {
    "layout": {
      "confidence": 0.9148201,
      "boundingPoly": ...
    },
    "type": "filled_checkbox"
  }
],

์ด ๋งํฌ์—์„œ ์ „์ฒด Document JSON ์ถœ๋ ฅ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค .

๊ธ€๊ผด ์Šคํƒ€์ผ ๊ฐ์ง€

๊ธ€๊ผด ์Šคํƒ€์ผ ๊ฐ์ง€๊ฐ€ ์‚ฌ์šฉ ์„ค์ •๋œ ๊ฒฝ์šฐ Enterprise Document OCR์€ ๊ธ€๊ผด ์†์„ฑ์„ ์ถ”์ถœํ•˜๋ฉฐ, ์ด๋Š” ๋” ๋‚˜์€ ํ›„์ฒ˜๋ฆฌ์— ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ† ํฐ (๋‹จ์–ด) ์ˆ˜์ค€์—์„œ๋Š” ๋‹ค์Œ ์†์„ฑ์ด ๊ฐ์ง€๋ฉ๋‹ˆ๋‹ค.

  • ํ•„๊ธฐ ๊ฐ์ง€
  • ๊ธ€๊ผด ์Šคํƒ€์ผ
  • ๊ธ€๊ผด ํฌ๊ธฐ
  • ๊ธ€๊ผด ์œ ํ˜•
  • ๊ธ€๊ผด ์ƒ‰์ƒ
  • ๊ธ€๊ผด ๋‘๊ป˜
  • ๋ฌธ์ž ๊ฐ„๊ฒฉ
  • ๊ตต๊ฒŒ
  • ๊ธฐ์šธ์ž„๊ผด
  • ๋ฐ‘์ค„ ํ‘œ์‹œ
  • ํ…์ŠคํŠธ ์ƒ‰์ƒ (RGBa)
  • ๋ฐฐ๊ฒฝ ์ƒ‰์ƒ (RGBa)

์ž…๋ ฅ

์ฒ˜๋ฆฌ ์š”์ฒญ์—์„œ ProcessOptions.ocrConfig.premiumFeatures.computeStyleInfo์„ true๋กœ ์„ค์ •ํ•˜์—ฌ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

  {
    "rawDocument": {
      "mimeType": "MIME_TYPE",
      "content": "IMAGE_CONTENT"
    },
    "processOptions": {
      "ocrConfig": {
          "premiumFeatures": {
            "computeStyleInfo": true
          }
      }
    }
  }

์ถœ๋ ฅ

๊ธ€๊ผด ์Šคํƒ€์ผ ์ถœ๋ ฅ์€ StyleInfo ์œ ํ˜•์˜ Document.pages[].tokens[].styleInfo์— ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

"tokens": [
  {
    "styleInfo": {
      "fontSize": 3,
      "pixelFontSize": 13,
      "fontType": "SANS_SERIF",
      "bold": true,
      "fontWeight": 564,
      "textColor": {
        "red": 0.16862746,
        "green": 0.16862746,
        "blue": 0.16862746
      },
      "backgroundColor": {
        "red": 0.98039216,
        "green": 0.9882353,
        "blue": 0.99215686
      }
    }
  },
  ...
]

์ด ๋งํฌ์—์„œ ์ „์ฒด Document JSON ์ถœ๋ ฅ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค .

๋ฌธ์„œ ๊ฐ์ฒด๋ฅผ Vision AI API ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜

Document AI ๋„๊ตฌ ์ƒ์ž์—๋Š” Document AI API Document ํ˜•์‹์„ Vision AI AnnotateFileResponse ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋„๊ตฌ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์–ด ์‚ฌ์šฉ์ž๊ฐ€ ๋ฌธ์„œ OCR ํ”„๋กœ์„ธ์„œ์™€ Vision AI API ๊ฐ„์˜ ์‘๋‹ต์„ ๋น„๊ตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ์ƒ˜ํ”Œ ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค.

Vision AI API ์‘๋‹ต๊ณผ Document AI API ์‘๋‹ต ๋ฐ ๋ณ€ํ™˜๊ธฐ ๊ฐ„์— ์•Œ๋ ค์ง„ ๋ถˆ์ผ์น˜:

  • Vision AI API ์‘๋‹ต์€ ์ด๋ฏธ์ง€ ์š”์ฒญ์˜ ๊ฒฝ์šฐ vertices๋งŒ ์ฑ„์šฐ๊ณ  PDF ์š”์ฒญ์˜ ๊ฒฝ์šฐ normalized_vertices๋งŒ ์ฑ„์›๋‹ˆ๋‹ค. Document AI ์‘๋‹ต๊ณผ ๋ณ€ํ™˜๊ธฐ๋Š” vertices์™€ normalized_vertices๋ฅผ ๋ชจ๋‘ ์ฑ„์›๋‹ˆ๋‹ค.
  • Vision AI API ์‘๋‹ต์€ ๋‹จ์–ด์˜ ๋งˆ์ง€๋ง‰ ๊ธฐํ˜ธ์— detected_break๋ฅผ ์ฑ„์›๋‹ˆ๋‹ค. Document AI API ์‘๋‹ต๊ณผ ๋ณ€ํ™˜๊ธฐ๋Š” ๋‹จ์–ด์™€ ๋‹จ์–ด์˜ ๋งˆ์ง€๋ง‰ ๊ธฐํ˜ธ์— detected_break๋ฅผ ์ฑ„์›๋‹ˆ๋‹ค.
  • Vision AI API ์‘๋‹ต์€ ํ•ญ์ƒ ๊ธฐํ˜ธ ํ•„๋“œ๋ฅผ ์ฑ„์›๋‹ˆ๋‹ค. ๊ธฐ๋ณธ์ ์œผ๋กœ Document AI ์‘๋‹ต์€ ๊ธฐํ˜ธ ํ•„๋“œ๋ฅผ ์ฑ„์šฐ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. Document AI ์‘๋‹ต๊ณผ ๋ณ€ํ™˜๊ธฐ์— ๊ธฐํ˜ธ ํ•„๋“œ๊ฐ€ ์ฑ„์›Œ์ง€๋„๋ก ํ•˜๋ ค๋ฉด enable_symbol ๊ธฐ๋Šฅ์„ ์ž์„ธํžˆ ์„ค์ •ํ•˜์„ธ์š”.

์ฝ”๋“œ ์ƒ˜ํ”Œ

๋‹ค์Œ ์ฝ”๋“œ ์ƒ˜ํ”Œ์€ OCR ๊ตฌ์„ฑ ๋ฐ ๋ถ€๊ฐ€๊ธฐ๋Šฅ์„ ์‚ฌ์šฉ ์„ค์ •ํ•˜๋Š” ์ฒ˜๋ฆฌ ์š”์ฒญ์„ ์ „์†กํ•œ ๋‹ค์Œ ํ•„๋“œ๋ฅผ ์ฝ๊ณ  ํ„ฐ๋ฏธ๋„์— ์ถœ๋ ฅํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

REST

์š”์ฒญ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์ „์— ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

  • LOCATION: ํ”„๋กœ์„ธ์„œ์˜ ์œ„์น˜์ž…๋‹ˆ๋‹ค(์˜ˆ:
      ).
    • us - ๋ฏธ๊ตญ
    • eu - ์œ ๋Ÿฝ ์—ฐํ•ฉ
  • PROJECT_ID: Google Cloud ํ”„๋กœ์ ํŠธ ID์ž…๋‹ˆ๋‹ค.
  • PROCESSOR_ID: ์ปค์Šคํ…€ ํ”„๋กœ์„ธ์„œ์˜ ID์ž…๋‹ˆ๋‹ค.
  • PROCESSOR_VERSION: ํ”„๋กœ์„ธ์„œ ๋ฒ„์ „ ์‹๋ณ„์ž์ž…๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ํ”„๋กœ์„ธ์„œ ๋ฒ„์ „ ์„ ํƒ์„ ์ฐธ๊ณ ํ•˜์„ธ์š”. ์˜ˆ๋ฅผ ๋“ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
    • pretrained-TYPE-vX.X-YYYY-MM-DD
    • stable
    • rc
  • skipHumanReview: ์‚ฌ๋žŒ์˜ ๊ฒ€ํ† ๋ฅผ ์‚ฌ์šฉ ์ค‘์ง€ํ•˜๋Š” ๋ถˆ๋ฆฌ์–ธ์ž…๋‹ˆ๋‹ค (์ธ๊ฐ„ ์ฐธ์—ฌํ˜• ํ”„๋กœ์„ธ์„œ์—์„œ๋งŒ ์ง€์›๋จ).
    • true - ์‚ฌ๋žŒ์˜ ๊ฒ€ํ† ๋ฅผ ๊ฑด๋„ˆ๋œ๋‹ˆ๋‹ค.
    • false - ์ˆ˜๋™ ๊ฒ€ํ† ๋ฅผ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค (๊ธฐ๋ณธ๊ฐ’).
  • MIME_TYPEโ€ : ์œ ํšจํ•œ MIME ์œ ํ˜• ์˜ต์…˜ ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค.
  • IMAGE_CONTENTโ€ : ์œ ํšจํ•œ ์ธ๋ผ์ธ ๋ฌธ์„œ ์ฝ˜ํ…์ธ  ์ค‘ ํ•˜๋‚˜๋กœ, ๋ฐ”์ดํŠธ ์ŠคํŠธ๋ฆผ์œผ๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. JSON ํ‘œํ˜„์˜ ๊ฒฝ์šฐ ๋ฐ”์ด๋„ˆ๋ฆฌ ์ด๋ฏธ์ง€ ๋ฐ์ดํ„ฐ์˜ base64 ์ธ์ฝ”๋”ฉ (ASCII ๋ฌธ์ž์—ด)์ž…๋‹ˆ๋‹ค. ์ด ๋ฌธ์ž์—ด์€ ๋‹ค์Œ ๋ฌธ์ž์—ด๊ณผ ๋น„์Šทํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
    • /9j/4QAYRXhpZgAA...9tAVx/zDQDlGxn//2Q==
    ์ž์„ธํ•œ ๋‚ด์šฉ์€ Base64 ์ธ์ฝ”๋”ฉ ์ฃผ์ œ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.
  • FIELD_MASK: Document ์ถœ๋ ฅ์— ํฌํ•จํ•  ํ•„๋“œ๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. FieldMask ํ˜•์‹์˜ ์ •๊ทœํ™”๋œ ํ•„๋“œ ์ด๋ฆ„์˜ ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„๋œ ๋ชฉ๋ก์ž…๋‹ˆ๋‹ค.
    • ์˜ˆ: text,entities,pages.pageNumber
  • OCR ๊ตฌ์„ฑ
    • ENABLE_NATIVE_PDF_PARSING: (๋ถˆ๋ฆฌ์–ธ) ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๊ฒฝ์šฐ PDF์—์„œ ์‚ฝ์ž…๋œ ํ…์ŠคํŠธ๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.
    • ENABLE_IMAGE_QUALITY_SCORES: (๋ถˆ๋ฆฌ์–ธ) ์ง€๋Šฅํ˜• ๋ฌธ์„œ ํ’ˆ์งˆ ์ ์ˆ˜๋ฅผ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
    • ENABLE_SYMBOL: (๋ถˆ๋ฆฌ์–ธ) ๊ธฐํ˜ธ (๊ธ€์ž) OCR ์ •๋ณด๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.
    • DISABLE_CHARACTER_BOXES_DETECTION: (๋ถˆ๋ฆฌ์–ธ) OCR ์—”์ง„์—์„œ ๋ฌธ์ž ์ƒ์ž ๊ฐ์ง€๊ธฐ๋ฅผ ์‚ฌ์šฉ ์ค‘์ง€ํ•ฉ๋‹ˆ๋‹ค.
    • LANGUAGE_HINTS: OCR์— ์‚ฌ์šฉํ•  BCP-47 ์–ธ์–ด ์ฝ”๋“œ ๋ชฉ๋ก์ž…๋‹ˆ๋‹ค.
    • ADVANCED_OCR_OPTIONS: OCR ๋™์ž‘์„ ์ถ”๊ฐ€๋กœ ๋ฏธ์„ธ ์กฐ์ •ํ•˜๊ธฐ ์œ„ํ•œ ๊ณ ๊ธ‰ OCR ์˜ต์…˜ ๋ชฉ๋ก์ž…๋‹ˆ๋‹ค. ํ˜„์žฌ ์œ ํšจํ•œ ๊ฐ’์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
      • legacy_layout: ํ˜„์žฌ ML ๊ธฐ๋ฐ˜ ๋ ˆ์ด์•„์›ƒ ๊ฐ์ง€ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ๋Œ€์•ˆ์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ํœด๋ฆฌ์Šคํ‹ฑ ๋ ˆ์ด์•„์›ƒ ๊ฐ์ง€ ์•Œ๊ณ ๋ฆฌ์ฆ˜
  • Premium OCR ๋ถ€๊ฐ€๊ธฐ๋Šฅ
    • ENABLE_SELECTION_MARK_DETECTION: (๋ถˆ๋ฆฌ์–ธ) OCR ์—”์ง„์—์„œ ์„ ํƒ ํ‘œ์‹œ ์ธ์‹๊ธฐ๋ฅผ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
    • COMPUTE_STYLE_INFO (๋ถˆ๋ฆฌ์–ธ) ๊ธ€๊ผด ์‹๋ณ„ ๋ชจ๋ธ์„ ์‚ฌ์šฉ ์„ค์ •ํ•˜๊ณ  ๊ธ€๊ผด ์Šคํƒ€์ผ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
    • ENABLE_MATH_OCR: (๋ถˆ๋ฆฌ์–ธ) LaTeX ์ˆ˜ํ•™ ๊ณต์‹์„ ์ถ”์ถœํ•  ์ˆ˜ ์žˆ๋Š” ๋ชจ๋ธ์„ ์‚ฌ์šฉ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
  • INDIVIDUAL_PAGES: ์ฒ˜๋ฆฌํ•  ๊ฐœ๋ณ„ ํŽ˜์ด์ง€ ๋ชฉ๋ก์ž…๋‹ˆ๋‹ค.
    • ๋˜๋Š” fromStart ๋˜๋Š” fromEnd ํ•„๋“œ๋ฅผ ์ œ๊ณตํ•˜์—ฌ ๋ฌธ์„œ์˜ ์‹œ์ž‘ ๋˜๋Š” ๋์—์„œ ํŠน์ • ์ˆ˜์˜ ํŽ˜์ด์ง€๋ฅผ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

โ€  ์ด ์ฝ˜ํ…์ธ ๋Š” inlineDocument ๊ฐ์ฒด์—์„œ base64๋กœ ์ธ์ฝ”๋”ฉ๋œ ์ฝ˜ํ…์ธ ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ง€์ •ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

HTTP ๋ฉ”์„œ๋“œ ๋ฐ URL:

POST https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION:process

JSON ์š”์ฒญ ๋ณธ๋ฌธ:

{
  "skipHumanReview": skipHumanReview,
  "rawDocument": {
    "mimeType": "MIME_TYPE",
    "content": "IMAGE_CONTENT"
  },
  "fieldMask": "FIELD_MASK",
  "processOptions": {
    "ocrConfig": {
      "enableNativePdfParsing": ENABLE_NATIVE_PDF_PARSING,
      "enableImageQualityScores": ENABLE_IMAGE_QUALITY_SCORES,
      "enableSymbol": ENABLE_SYMBOL,
      "disableCharacterBoxesDetection": DISABLE_CHARACTER_BOXES_DETECTION,
      "hints": {
        "languageHints": [
          "LANGUAGE_HINTS"
        ]
      },
      "advancedOcrOptions": ["ADVANCED_OCR_OPTIONS"],
      "premiumFeatures": {
        "enableSelectionMarkDetection": ENABLE_SELECTION_MARK_DETECTION,
        "computeStyleInfo": COMPUTE_STYLE_INFO,
        "enableMathOcr": ENABLE_MATH_OCR,
      }
    },
    "individualPageSelector" {
      "pages": [INDIVIDUAL_PAGES]
    }
  }
}

์š”์ฒญ์„ ๋ณด๋‚ด๋ ค๋ฉด ๋‹ค์Œ ์˜ต์…˜ ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

curl

์š”์ฒญ ๋ณธ๋ฌธ์„ request.json ํŒŒ์ผ์— ์ €์žฅํ•˜๊ณ  ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION:process"

PowerShell

์š”์ฒญ ๋ณธ๋ฌธ์„ request.json ํŒŒ์ผ์— ์ €์žฅํ•˜๊ณ  ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION:process" | Select-Object -Expand Content

์š”์ฒญ์ด ์„ฑ๊ณตํ•˜๋ฉด ์„œ๋ฒ„๊ฐ€ 200 OK HTTP ์ƒํƒœ ์ฝ”๋“œ์™€ ์‘๋‹ต์„ JSON ํ˜•์‹์œผ๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์‘๋‹ต ๋ณธ๋ฌธ์—๋Š” Document ์ธ์Šคํ„ด์Šค๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.

Python

์ž์„ธํ•œ ๋‚ด์šฉ์€ Document AI Python API ์ฐธ์กฐ ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

Document AI์— ์ธ์ฆํ•˜๋ ค๋ฉด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ธฐ๋ณธ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์˜ ์ธ์ฆ ์„ค์ •์„ ์ฐธ์กฐํ•˜์„ธ์š”.


from typing import Optional, Sequence

from google.api_core.client_options import ClientOptions
from google.cloud import documentai

# TODO(developer): Uncomment these variables before running the sample.
# project_id = "YOUR_PROJECT_ID"
# location = "YOUR_PROCESSOR_LOCATION" # Format is "us" or "eu"
# processor_id = "YOUR_PROCESSOR_ID" # Create processor before running sample
# processor_version = "rc" # Refer to https://cloud.google.com/document-ai/docs/manage-processor-versions for more information
# file_path = "/path/to/local/pdf"
# mime_type = "application/pdf" # Refer to https://cloud.google.com/document-ai/docs/file-types for supported file types


def process_document_ocr_sample(
    project_id: str,
    location: str,
    processor_id: str,
    processor_version: str,
    file_path: str,
    mime_type: str,
) -> None:
    # Optional: Additional configurations for Document OCR Processor.
    # For more information: https://cloud.google.com/document-ai/docs/enterprise-document-ocr
    process_options = documentai.ProcessOptions(
        ocr_config=documentai.OcrConfig(
            enable_native_pdf_parsing=True,
            enable_image_quality_scores=True,
            enable_symbol=True,
            # OCR Add Ons https://cloud.google.com/document-ai/docs/ocr-add-ons
            premium_features=documentai.OcrConfig.PremiumFeatures(
                compute_style_info=True,
                enable_math_ocr=False,  # Enable to use Math OCR Model
                enable_selection_mark_detection=True,
            ),
        )
    )
    # Online processing request to Document AI
    document = process_document(
        project_id,
        location,
        processor_id,
        processor_version,
        file_path,
        mime_type,
        process_options=process_options,
    )

    text = document.text
    print(f"Full document text: {text}\n")
    print(f"There are {len(document.pages)} page(s) in this document.\n")

    for page in document.pages:
        print(f"Page {page.page_number}:")
        print_page_dimensions(page.dimension)
        print_detected_languages(page.detected_languages)

        print_blocks(page.blocks, text)
        print_paragraphs(page.paragraphs, text)
        print_lines(page.lines, text)
        print_tokens(page.tokens, text)

        if page.symbols:
            print_symbols(page.symbols, text)

        if page.image_quality_scores:
            print_image_quality_scores(page.image_quality_scores)

        if page.visual_elements:
            print_visual_elements(page.visual_elements, text)


def print_page_dimensions(dimension: documentai.Document.Page.Dimension) -> None:
    print(f"    Width: {str(dimension.width)}")
    print(f"    Height: {str(dimension.height)}")


def print_detected_languages(
    detected_languages: Sequence[documentai.Document.Page.DetectedLanguage],
) -> None:
    print("    Detected languages:")
    for lang in detected_languages:
        print(f"        {lang.language_code} ({lang.confidence:.1%} confidence)")


def print_blocks(blocks: Sequence[documentai.Document.Page.Block], text: str) -> None:
    print(f"    {len(blocks)} blocks detected:")
    first_block_text = layout_to_text(blocks[0].layout, text)
    print(f"        First text block: {repr(first_block_text)}")
    last_block_text = layout_to_text(blocks[-1].layout, text)
    print(f"        Last text block: {repr(last_block_text)}")


def print_paragraphs(
    paragraphs: Sequence[documentai.Document.Page.Paragraph], text: str
) -> None:
    print(f"    {len(paragraphs)} paragraphs detected:")
    first_paragraph_text = layout_to_text(paragraphs[0].layout, text)
    print(f"        First paragraph text: {repr(first_paragraph_text)}")
    last_paragraph_text = layout_to_text(paragraphs[-1].layout, text)
    print(f"        Last paragraph text: {repr(last_paragraph_text)}")


def print_lines(lines: Sequence[documentai.Document.Page.Line], text: str) -> None:
    print(f"    {len(lines)} lines detected:")
    first_line_text = layout_to_text(lines[0].layout, text)
    print(f"        First line text: {repr(first_line_text)}")
    last_line_text = layout_to_text(lines[-1].layout, text)
    print(f"        Last line text: {repr(last_line_text)}")


def print_tokens(tokens: Sequence[documentai.Document.Page.Token], text: str) -> None:
    print(f"    {len(tokens)} tokens detected:")
    first_token_text = layout_to_text(tokens[0].layout, text)
    first_token_break_type = tokens[0].detected_break.type_.name
    print(f"        First token text: {repr(first_token_text)}")
    print(f"        First token break type: {repr(first_token_break_type)}")
    if tokens[0].style_info:
        print_style_info(tokens[0].style_info)

    last_token_text = layout_to_text(tokens[-1].layout, text)
    last_token_break_type = tokens[-1].detected_break.type_.name
    print(f"        Last token text: {repr(last_token_text)}")
    print(f"        Last token break type: {repr(last_token_break_type)}")
    if tokens[-1].style_info:
        print_style_info(tokens[-1].style_info)


def print_symbols(
    symbols: Sequence[documentai.Document.Page.Symbol], text: str
) -> None:
    print(f"    {len(symbols)} symbols detected:")
    first_symbol_text = layout_to_text(symbols[0].layout, text)
    print(f"        First symbol text: {repr(first_symbol_text)}")
    last_symbol_text = layout_to_text(symbols[-1].layout, text)
    print(f"        Last symbol text: {repr(last_symbol_text)}")


def print_image_quality_scores(
    image_quality_scores: documentai.Document.Page.ImageQualityScores,
) -> None:
    print(f"    Quality score: {image_quality_scores.quality_score:.1%}")
    print("    Detected defects:")

    for detected_defect in image_quality_scores.detected_defects:
        print(f"        {detected_defect.type_}: {detected_defect.confidence:.1%}")


def print_style_info(style_info: documentai.Document.Page.Token.StyleInfo) -> None:
    """
    Only supported in version `pretrained-ocr-v2.0-2023-06-02`
    """
    print(f"           Font Size: {style_info.font_size}pt")
    print(f"           Font Type: {style_info.font_type}")
    print(f"           Bold: {style_info.bold}")
    print(f"           Italic: {style_info.italic}")
    print(f"           Underlined: {style_info.underlined}")
    print(f"           Handwritten: {style_info.handwritten}")
    print(
        f"           Text Color (RGBa): {style_info.text_color.red}, {style_info.text_color.green}, {style_info.text_color.blue}, {style_info.text_color.alpha}"
    )


def print_visual_elements(
    visual_elements: Sequence[documentai.Document.Page.VisualElement], text: str
) -> None:
    """
    Only supported in version `pretrained-ocr-v2.0-2023-06-02`
    """
    checkboxes = [x for x in visual_elements if "checkbox" in x.type]
    math_symbols = [x for x in visual_elements if x.type == "math_formula"]

    if checkboxes:
        print(f"    {len(checkboxes)} checkboxes detected:")
        print(f"        First checkbox: {repr(checkboxes[0].type)}")
        print(f"        Last checkbox: {repr(checkboxes[-1].type)}")

    if math_symbols:
        print(f"    {len(math_symbols)} math symbols detected:")
        first_math_symbol_text = layout_to_text(math_symbols[0].layout, text)
        print(f"        First math symbol: {repr(first_math_symbol_text)}")




def process_document(
    project_id: str,
    location: str,
    processor_id: str,
    processor_version: str,
    file_path: str,
    mime_type: str,
    process_options: Optional[documentai.ProcessOptions] = None,
) -> documentai.Document:
    # You must set the `api_endpoint` if you use a location other than "us".
    client = documentai.DocumentProcessorServiceClient(
        client_options=ClientOptions(
            api_endpoint=f"{location}-documentai.googleapis.com"
        )
    )

    # The full resource name of the processor version, e.g.:
    # `projects/{project_id}/locations/{location}/processors/{processor_id}/processorVersions/{processor_version_id}`
    # You must create a processor before running this sample.
    name = client.processor_version_path(
        project_id, location, processor_id, processor_version
    )

    # Read the file into memory
    with open(file_path, "rb") as image:
        image_content = image.read()

    # Configure the process request
    request = documentai.ProcessRequest(
        name=name,
        raw_document=documentai.RawDocument(content=image_content, mime_type=mime_type),
        # Only supported for Document OCR processor
        process_options=process_options,
    )

    result = client.process_document(request=request)

    # For a full list of `Document` object attributes, reference this page:
    # https://cloud.google.com/document-ai/docs/reference/rest/v1/Document
    return result.document




def layout_to_text(layout: documentai.Document.Page.Layout, text: str) -> str:
    """
    Document AI identifies text in different parts of the document by their
    offsets in the entirety of the document"s text. This function converts
    offsets to a string.
    """
    # If a text segment spans several lines, it will
    # be stored in different text segments.
    return "".join(
        text[int(segment.start_index) : int(segment.end_index)]
        for segment in layout.text_anchor.text_segments
    )

๋‹ค์Œ ๋‹จ๊ณ„