{"id":26728,"date":"2025-02-24T13:03:25","date_gmt":"2025-02-24T05:03:25","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=26728"},"modified":"2025-08-25T00:18:22","modified_gmt":"2025-08-24T16:18:22","slug":"pdf-extract-kit","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/de\/pdf-extract-kit\/","title":{"rendered":"PDF-Extract-Kit\uff1a\u63d0\u53d6\u590d\u6742\u7ed3\u6784PDF\u5185\u5bb9\u7684\u5f00\u6e90\u5de5\u5177"},"content":{"rendered":"<p>PDF-Extract-Kit \u662f\u4e00\u4e2a\u7531 OpenDataLab \u56e2\u961f\u5f00\u53d1\u7684\u5f00\u6e90\u9879\u76ee\uff0c\u4e13\u6ce8\u4e8e\u4ece\u590d\u6742\u591a\u6837\u7684 PDF \u6587\u6863\u4e2d\u9ad8\u6548\u63d0\u53d6\u9ad8\u8d28\u91cf\u5185\u5bb9\u3002\u5b83\u96c6\u6210\u4e86\u5148\u8fdb\u7684\u6587\u6863\u89e3\u6790\u6280\u672f\uff0c\u652f\u6301\u5e03\u5c40\u68c0\u6d4b\u3001\u516c\u5f0f\u8bc6\u522b\u3001\u8868\u683c\u63d0\u53d6\u548c OCR \u7b49\u529f\u80fd\uff0c\u9002\u7528\u4e8e\u5b66\u672f\u8bba\u6587\u3001\u7814\u7a76\u62a5\u544a\u3001\u91d1\u878d\u6587\u6863\u7b49\u591a\u79cd\u573a\u666f\u3002\u8be5\u5de5\u5177\u91c7\u7528\u6a21\u5757\u5316\u8bbe\u8ba1\uff0c\u7528\u6237\u53ef\u6839\u636e\u9700\u6c42\u7075\u6d3b\u914d\u7f6e\uff0c\u8f7b\u677e\u6784\u5efa\u5b9a\u5236\u5316\u7684\u6587\u6863\u5904\u7406\u5e94\u7528\u3002PDF-Extract-Kit \u63d0\u4f9b\u5168\u9762\u7684\u8bc4\u4f30\u57fa\u51c6\uff0c\u5e2e\u52a9\u7528\u6237\u9009\u62e9\u6700\u9002\u5408\u7684\u6a21\u578b\uff0c\u540c\u65f6\u4e0d\u65ad\u66f4\u65b0\u4f18\u5316\uff0c\u5982\u8fd1\u671f\u52a0\u5165\u4e86\u66f4\u5feb\u901f\u7684 DocLayout-YOLO \u548c\u652f\u6301\u591a\u79cd\u683c\u5f0f\u8f93\u51fa\u7684 StructTable-InternVL2-1B\u3002\u65e0\u8bba\u662f\u5f00\u53d1\u8005\u8fd8\u662f\u7814\u7a76\u4eba\u5458\uff0c\u90fd\u80fd\u901a\u8fc7\u5b83\u5b9e\u73b0\u9ad8\u6548\u7684\u6587\u6863\u5185\u5bb9\u63d0\u53d6\u3002<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" title=\"PDF-Extract-Kit\uff1a\u63d0\u53d6\u590d\u6742\u7ed3\u6784PDF\u5185\u5bb9\u7684\u5f00\u6e90\u5de5\u5177-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/ec69541ea9f87e6.png\" alt=\"PDF-Extract-Kit\uff1a\u63d0\u53d6\u590d\u6742\u7ed3\u6784PDF\u5185\u5bb9\u7684\u5f00\u6e90\u5de5\u5177-1\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li><strong>\u5e03\u5c40\u68c0\u6d4b<\/strong>\uff1a\u8bc6\u522b PDF \u4e2d\u7684\u9875\u9762\u5e03\u5c40\uff0c\u5305\u62ec\u6807\u9898\u3001\u6bb5\u843d\u3001\u56fe\u50cf\u548c\u8868\u683c\u7b49\u533a\u57df\uff0c\u652f\u6301 DocLayout-YOLO \u7b49\u9ad8\u6548\u6a21\u578b\u3002<\/li>\n<li><strong>\u516c\u5f0f\u8bc6\u522b<\/strong>\uff1a\u63d0\u53d6\u5e76\u89e3\u6790\u6587\u6863\u4e2d\u7684\u6570\u5b66\u516c\u5f0f\uff0c\u8f6c\u6362\u4e3a LaTeX \u683c\u5f0f\uff0c\u4f9d\u6258 UniMERNet \u7b49\u5148\u8fdb\u6280\u672f\u3002<\/li>\n<li><strong>\u8868\u683c\u63d0\u53d6<\/strong>\uff1a\u652f\u6301\u590d\u6742\u8868\u683c\u5185\u5bb9\u7684\u8bc6\u522b\u4e0e\u63d0\u53d6\uff0c\u53ef\u8f93\u51fa LaTeX\u3001HTML \u548c Markdown \u683c\u5f0f\u3002<\/li>\n<li><strong>OCR \u5904\u7406<\/strong>\uff1a\u901a\u8fc7 PaddleOCR \u7b49\u6280\u672f\uff0c\u5c06\u626b\u63cf\u6587\u6863\u6216\u56fe\u50cf\u4e2d\u7684\u6587\u5b57\u8f6c\u5316\u4e3a\u53ef\u7f16\u8f91\u6587\u672c\u3002<\/li>\n<li><strong>\u6a21\u5757\u5316\u914d\u7f6e<\/strong>\uff1a\u63d0\u4f9b\u7075\u6d3b\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u7528\u6237\u53ef\u7ec4\u5408\u4e0d\u540c\u6a21\u578b\uff0c\u5feb\u901f\u642d\u5efa\u5e94\u7528\u3002<\/li>\n<li><strong>\u5185\u5bb9\u8bc4\u4f30<\/strong>\uff1a\u5185\u7f6e\u591a\u6837\u5316\u7684 PDF \u89e3\u6790\u57fa\u51c6\uff0c\u5e2e\u52a9\u7528\u6237\u8bc4\u4f30\u4e0d\u540c\u6a21\u578b\u7684\u6548\u679c\u3002<\/li>\n<li><strong>\u56fe\u50cf\u4e0e\u6587\u672c\u63d0\u53d6<\/strong>\uff1a\u652f\u6301\u4ece PDF \u4e2d\u63d0\u53d6\u56fe\u50cf\u5e76\u8bc6\u522b\u5176\u4e2d\u7684\u6587\u5b57\u5185\u5bb9\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<h3>\u5b89\u88c5\u6d41\u7a0b<\/h3>\n<p>PDF-Extract-Kit \u652f\u6301\u5728\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fd0\u884c\uff08\u5982 Ubuntu\u3001Windows \u6216 macOS\uff09\uff0c\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u5b89\u88c5\u6b65\u9aa4\uff08\u4ee5 Ubuntu 20.04 \u4e3a\u4f8b\uff09\uff1a<\/p>\n<h4>1. \u73af\u5883\u51c6\u5907<\/h4>\n<ul>\n<li>\u786e\u4fdd\u7cfb\u7edf\u5b89\u88c5\u4e86 Python 3.10\uff1a\n<pre><code>sudo apt update\r\nsudo apt install python3.10 python3.10-dev python3-pip<\/code><\/pre>\n<\/li>\n<\/ul>\n<ul>\n<li>\u521b\u5efa\u5e76\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a\n<pre><code>conda create -n pdf-extract-kit python=3.10\r\nconda activate pdf-extract-kit\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<h4>2. \u5b89\u88c5\u4f9d\u8d56<\/h4>\n<ul>\n<li>\u514b\u9686\u4ee3\u7801\u4ed3\u5e93\uff1a\n<pre><code>git clone https:\/\/github.com\/opendatalab\/PDF-Extract-Kit.git\r\ncd PDF-Extract-Kit\r\n<\/code><\/pre>\n<\/li>\n<li>\u5b89\u88c5\u6838\u5fc3\u4f9d\u8d56\uff08\u82e5\u65e0 GPU\uff0c\u53ef\u7528\u00a0<code>requirements-cpu.txt<\/code>\uff09\uff1a\n<pre><code>pip install -r requirements.txt\r\n<\/code><\/pre>\n<p><strong>\u6ce8\u610f<\/strong>\uff1a\u82e5\u9047\u5230\u00a0<code>doclayout-yolo<\/code>\u00a0\u5b89\u88c5\u5931\u8d25\uff0c\u53ef\u624b\u52a8\u5b89\u88c5\uff1a<\/p>\n<pre><code>pip3 install doclayout-yolo==0.0.2 --extra-index-url=https:\/\/pypi.org\/simple\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<h4>3. \u4e0b\u8f7d\u6a21\u578b\u6743\u91cd<\/h4>\n<ul>\n<li>\u53c2\u8003\u5b98\u65b9\u6559\u7a0b\u4e0b\u8f7d\u6a21\u578b\u6587\u4ef6\uff08\u652f\u6301\u5168\u90e8\u6216\u90e8\u5206\u4e0b\u8f7d\uff09\uff1a\n<ul>\n<li>\u4f7f\u7528 Python \u811a\u672c\u81ea\u52a8\u4e0b\u8f7d\uff1a\n<pre><code>python scripts\/download_models_hf.py\r\n<\/code><\/pre>\n<\/li>\n<li>\u6216\u4ece Hugging Face \u624b\u52a8\u4e0b\u8f7d\uff1a\n<pre><code>git lfs install\r\ngit clone https:\/\/huggingface.co\/opendatalab\/PDF-Extract-Kit-1.0\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u5c06\u6a21\u578b\u6587\u4ef6\u653e\u7f6e\u4e8e\u9879\u76ee\u76ee\u5f55\u4e0b\u7684\u6307\u5b9a\u8def\u5f84\uff08\u53c2\u8003\u00a0<code>configs\/model_configs.yaml<\/code>\uff09\u3002<\/li>\n<\/ul>\n<h4>4. \u9a8c\u8bc1\u5b89\u88c5<\/h4>\n<ul>\n<li>\u8fd0\u884c\u793a\u4f8b\u811a\u672c\uff0c\u6d4b\u8bd5\u73af\u5883\u662f\u5426\u6b63\u5e38\uff1a\n<pre><code>python pdf_extract.py --pdf assets\/examples\/example.pdf\r\n<\/code><\/pre>\n<p>\u8f93\u51fa\u7ed3\u679c\u5c06\u4fdd\u5b58\u5728\u00a0<code>outputs<\/code>\u00a0\u6587\u4ef6\u5939\u4e2d\u3002<\/li>\n<\/ul>\n<h3>\u529f\u80fd\u64cd\u4f5c\u6d41\u7a0b<\/h3>\n<h4>\u5e03\u5c40\u68c0\u6d4b<\/h4>\n<ol>\n<li><strong>\u51c6\u5907 PDF \u6587\u4ef6<\/strong>\uff1a\u5c06\u9700\u8981\u5904\u7406\u7684 PDF \u653e\u5165\u9879\u76ee\u76ee\u5f55\uff08\u5982\u00a0<code>assets\/examples\/<\/code>\uff09\u3002<\/li>\n<li><strong>\u8fd0\u884c\u5e03\u5c40\u68c0\u6d4b<\/strong>\uff1a\n<ul>\n<li>\u4fee\u6539\u00a0<code>configs\/layout_detection.yaml<\/code>\u00a0\u4e2d\u7684\u8f93\u5165\u8def\u5f84\uff1a\n<pre><code>pdf_path: \"assets\/examples\/example.pdf\"\r\noutput_dir: \"outputs\/layout_detection\"\r\n<\/code><\/pre>\n<\/li>\n<li>\u6267\u884c\u547d\u4ee4\uff1a\n<pre><code>python scripts\/layout_detection.py --config=configs\/layout_detection.yaml\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u67e5\u770b\u7ed3\u679c<\/strong>\uff1a\u5728\u00a0<code>outputs\/layout_detection<\/code>\u00a0\u6587\u4ef6\u5939\u4e2d\uff0c\u751f\u6210\u6807\u6ce8\u4e86\u5e03\u5c40\u533a\u57df\u7684\u56fe\u50cf\u548c JSON \u6587\u4ef6\u3002<\/li>\n<\/ol>\n<h4>\u516c\u5f0f\u8bc6\u522b<\/h4>\n<ol>\n<li><strong>\u8fd0\u884c\u516c\u5f0f\u63d0\u53d6<\/strong>\uff1a\n<ul>\n<li>\u4f7f\u7528\u9ed8\u8ba4\u914d\u7f6e\uff1a\n<pre><code>python pdf_extract.py --pdf your_file.pdf --render\r\n<\/code><\/pre>\n<\/li>\n<li><code>--render<\/code>\u00a0\u53c2\u6570\u5c06\u516c\u5f0f\u6e32\u67d3\u4e3a\u56fe\u50cf\uff0c\u4fbf\u4e8e\u9a8c\u8bc1\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u67e5\u770b\u8f93\u51fa<\/strong>\uff1a\u516c\u5f0f\u4ee5 LaTeX \u683c\u5f0f\u5b58\u50a8\u5728\u8f93\u51fa JSON \u4e2d\uff0c\u53ef\u76f4\u63a5\u7528\u4e8e\u5b66\u672f\u5199\u4f5c\u6216\u8fdb\u4e00\u6b65\u5904\u7406\u3002<\/li>\n<\/ol>\n<h4>\u8868\u683c\u63d0\u53d6<\/h4>\n<ol>\n<li><strong>\u6267\u884c\u8868\u683c\u8bc6\u522b<\/strong>\uff1a\n<ul>\n<li>\u786e\u4fdd\u5df2\u4e0b\u8f7d\u00a0<code>StructTable-InternVL2-1B<\/code>\u00a0\u6a21\u578b\u3002<\/li>\n<li>\u8fd0\u884c\u5b8c\u6574\u63d0\u53d6\uff1a\n<pre><code>python pdf_extract.py --pdf your_file.pdf\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u8f93\u51fa\u683c\u5f0f\u9009\u62e9<\/strong>\uff1a\n<ul>\n<li>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u00a0<code>configs\/model_configs.yaml<\/code>\uff0c\u8bbe\u7f6e\u00a0<code>table_format<\/code>\u00a0\u4e3a\u00a0<code>latex<\/code>\u3001<code>html<\/code>\u00a0\u6216\u00a0<code>markdown<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u7ed3\u679c\u67e5\u770b<\/strong>\uff1a\u8868\u683c\u5185\u5bb9\u5c06\u4ee5\u6307\u5b9a\u683c\u5f0f\u4fdd\u5b58\u81f3\u8f93\u51fa\u76ee\u5f55\u3002<\/li>\n<\/ol>\n<h4>OCR \u5904\u7406<\/h4>\n<ol>\n<li><strong>\u5904\u7406\u626b\u63cf PDF<\/strong>\uff1a\n<ul>\n<li>\u5bf9\u4e8e\u56fe\u50cf\u5316\u7684 PDF\uff0c\u786e\u4fdd\u542f\u7528 OCR\uff1a\n<pre><code>python pdf_extract.py --pdf scan_file.pdf --vis\r\n<\/code><\/pre>\n<\/li>\n<li><code>--vis<\/code>\u00a0\u53c2\u6570\u751f\u6210\u53ef\u89c6\u5316\u7ed3\u679c\uff0c\u6807\u6ce8\u8bc6\u522b\u6587\u672c\u533a\u57df\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u68c0\u67e5\u8f93\u51fa<\/strong>\uff1a\u6587\u672c\u5185\u5bb9\u4fdd\u5b58\u4e3a\u53ef\u7f16\u8f91\u683c\u5f0f\uff0c\u56fe\u50cf\u6587\u672c\u8bc6\u522b\u7ed3\u679c\u4e00\u76ee\u4e86\u7136\u3002<\/li>\n<\/ol>\n<h3>\u7279\u8272\u529f\u80fd\u64cd\u4f5c<\/h3>\n<h4>\u6a21\u5757\u5316\u914d\u7f6e<\/h4>\n<ul>\n<li>\u7f16\u8f91\u00a0<code>configs\/model_configs.yaml<\/code>\uff0c\u8c03\u6574\u53c2\u6570\uff1a\n<ul>\n<li><code>img_size<\/code>\uff1a\u56fe\u50cf\u5206\u8fa8\u7387\u3002<\/li>\n<li><code>conf_thres<\/code>\uff1a\u7f6e\u4fe1\u5ea6\u9608\u503c\u3002<\/li>\n<li><code>device<\/code>\uff1a\u9009\u62e9\u00a0<code>cuda<\/code>\uff08GPU\uff09\u6216\u00a0<code>cpu<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u793a\u4f8b\uff1a\n<pre><code>model_args:\r\nimg_size: 1024\r\nconf_thres: 0.5\r\ndevice: \"cuda\"\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<h4>\u9ad8\u6027\u80fd\u4f18\u5316<\/h4>\n<ul>\n<li>\u5bf9\u4e8e\u9ad8\u914d\u8bbe\u5907\uff08\u226516GB \u663e\u5b58\uff09\uff0c\u53ef\u542f\u7528\u6279\u5904\u7406\uff1a\n<pre><code>python pdf_extract.py --pdf your_file.pdf --batch-size 128\r\n<\/code><\/pre>\n<\/li>\n<li>\u63d0\u9ad8\u89e3\u6790\u901f\u5ea6 50% \u4ee5\u4e0a\uff0c\u9002\u5408\u6279\u91cf\u5904\u7406\u3002<\/li>\n<\/ul>\n<h4>\u591a\u8bed\u8a00\u652f\u6301<\/h4>\n<ul>\n<li>\u8bbe\u7f6e\u00a0<code>lang<\/code>\u00a0\u4e3a\u00a0<code>auto<\/code>\uff0c\u81ea\u52a8\u8bc6\u522b\u6587\u6863\u8bed\u8a00\u5e76\u9009\u7528\u5408\u9002\u7684 OCR \u6a21\u578b\uff1a\n<pre><code>ocr_args:\r\nlang: \"auto\"\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>\u6ce8\u610f\u4e8b\u9879<\/h3>\n<ul>\n<li><strong>\u786c\u4ef6\u9700\u6c42<\/strong>\uff1aGPU\uff08\u5982 NVIDIA \u663e\u5361\uff09\u53ef\u5927\u5e45\u63d0\u5347\u5904\u7406\u901f\u5ea6\uff0c\u5efa\u8bae\u663e\u5b58 \u22658GB\u3002<\/li>\n<li><strong>\u5e38\u89c1\u95ee\u9898<\/strong>\uff1a\n<ul>\n<li>\u82e5\u63d0\u793a\u7f3a\u5c11\u00a0<code>cv2<\/code>\uff0c\u8fd0\u884c\u00a0<code>pip install opencv-python<\/code>\u3002<\/li>\n<li>\u6a21\u578b\u4e0b\u8f7d\u4e0d\u5b8c\u6574\u65f6\uff0c\u68c0\u67e5\u7f51\u7edc\u6216\u66f4\u6362\u4e0b\u8f7d\u65b9\u5f0f\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u793e\u533a\u652f\u6301<\/strong>\uff1a\u5982\u9047\u95ee\u9898\uff0c\u53ef\u5728 GitHub \u7684 Discussions \u6216 Issues \u677f\u5757\u63d0\u95ee\u3002<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u7528\u6237\u53ef\u8f7b\u677e\u4e0a\u624b PDF-Extract-Kit\uff0c\u9ad8\u6548\u5b8c\u6210\u590d\u6742 PDF \u7684\u5185\u5bb9\u63d0\u53d6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PDF-Extract-Kit \u662f\u4e00\u4e2a\u7531 OpenDataLab \u56e2\u961f\u5f00\u53d1\u7684\u5f00\u6e90\u9879\u76ee\uff0c\u4e13\u6ce8\u4e8e\u4ece\u590d\u6742\u591a\u6837\u7684 PDF \u6587\u6863\u4e2d\u9ad8\u6548\u63d0\u53d6\u9ad8\u8d28\u91cf\u5185\u5bb9\u3002\u5b83\u96c6\u6210\u4e86\u5148\u8fdb\u7684\u6587\u6863\u89e3\u6790\u6280\u672f\uff0c\u652f\u6301\u5e03\u5c40\u68c0\u6d4b\u3001\u516c\u5f0f\u8bc6\u522b\u3001\u8868\u683c\u63d0\u53d6\u548c OCR \u7b49\u529f\u80fd\uff0c\u9002\u7528\u4e8e\u5b66\u672f\u8bba\u6587\u3001\u7814\u7a76&#8230;<\/p>\n","protected":false},"author":1,"featured_media":32782,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,499],"tags":[230,252],"class_list":["post-26728","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tool","category-document-extraction","tag-aikaiyuanxiangmu","tag-markdown"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts\/26728","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/comments?post=26728"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts\/26728\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/media\/32782"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/media?parent=26728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/categories?post=26728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/tags?post=26728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}