Commit 7859c73b authored by xu rui's avatar xu rui
Browse files

feat: complete en docs

parent 5f794533
...@@ -75,12 +75,10 @@ ...@@ -75,12 +75,10 @@
<ul> <ul>
<li><a href="#online-demo">Online Demo</a></li> <li><a href="#online-demo">Online Demo</a></li>
<li><a href="#quick-cpu-demo">Quick CPU Demo</a></li> <li><a href="#quick-cpu-demo">Quick CPU Demo</a></li>
<li><a href="#using-gpu">Using GPU</a></li>
</ul> </ul>
</li> </li>
<li><a href="#usage">Usage</a> <li><a href="#usage">Usage</a>
<ul> <ul>
<li><a href="#command-line">Command Line</a></li>
<li><a href="#api">API</a></li> <li><a href="#api">API</a></li>
<li><a href="#deploy-derived-projects">Deploy Derived Projects</a></li> <li><a href="#deploy-derived-projects">Deploy Derived Projects</a></li>
<li><a href="#development-guide">Development Guide</a></li> <li><a href="#development-guide">Development Guide</a></li>
...@@ -89,8 +87,6 @@ ...@@ -89,8 +87,6 @@
</ul> </ul>
</li> </li>
<li><a href="#todo">TODO</a></li> <li><a href="#todo">TODO</a></li>
<li><a href="#known-issues">Known Issues</a></li>
<li><a href="#faq">FAQ</a></li>
<li><a href="#all-thanks-to-our-contributors">All Thanks To Our Contributors</a></li> <li><a href="#all-thanks-to-our-contributors">All Thanks To Our Contributors</a></li>
<li><a href="#license-information">License Information</a></li> <li><a href="#license-information">License Information</a></li>
<li><a href="#acknowledgments">Acknowledgments</a></li> <li><a href="#acknowledgments">Acknowledgments</a></li>
...@@ -112,21 +108,6 @@ Compared to well-known commercial products, MinerU is still young. If you encoun ...@@ -112,21 +108,6 @@ Compared to well-known commercial products, MinerU is still young. If you encoun
https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c
## Key Features
- Remove headers, footers, footnotes, page numbers, etc., to ensure semantic coherence.
- Output text in human-readable order, suitable for single-column, multi-column, and complex layouts.
- Preserve the structure of the original document, including headings, paragraphs, lists, etc.
- Extract images, image descriptions, tables, table titles, and footnotes.
- Automatically recognize and convert formulas in the document to LaTeX format.
- Automatically recognize and convert tables in the document to LaTeX or HTML format.
- Automatically detect scanned PDFs and garbled PDFs and enable OCR functionality.
- OCR supports detection and recognition of 84 languages.
- Supports multiple output formats, such as multimodal and NLP Markdown, JSON sorted by reading order, and rich intermediate formats.
- Supports various visualization results, including layout visualization and span visualization, for efficient confirmation of output quality.
- Supports both CPU and GPU environments.
- Compatible with Windows, Linux, and Mac platforms.
## Quick Start ## Quick Start
If you encounter any installation issues, please first consult the <a href="#faq">FAQ</a>. </br> If you encounter any installation issues, please first consult the <a href="#faq">FAQ</a>. </br>
...@@ -135,66 +116,6 @@ There are three different ways to experience MinerU: ...@@ -135,66 +116,6 @@ There are three different ways to experience MinerU:
- [Online Demo (No Installation Required)](#online-demo) - [Online Demo (No Installation Required)](#online-demo)
- [Quick CPU Demo (Windows, Linux, Mac)](#quick-cpu-demo) - [Quick CPU Demo (Windows, Linux, Mac)](#quick-cpu-demo)
- [Linux/Windows + CUDA](#Using-GPU)
> [!WARNING]
> **Pre-installation Notice—Hardware and Software Environment Support**
>
> To ensure the stability and reliability of the project, we only optimize and test for specific hardware and software environments during development. This ensures that users deploying and running the project on recommended system configurations will get the best performance with the fewest compatibility issues.
>
> By focusing resources on the mainline environment, our team can more efficiently resolve potential bugs and develop new features.
>
> In non-mainline environments, due to the diversity of hardware and software configurations, as well as third-party dependency compatibility issues, we cannot guarantee 100% project availability. Therefore, for users who wish to use this project in non-recommended environments, we suggest carefully reading the documentation and FAQ first. Most issues already have corresponding solutions in the FAQ. We also encourage community feedback to help us gradually expand support.
<table>
<tr>
<td colspan="3" rowspan="2">Operating System</td>
</tr>
<tr>
<td>Ubuntu 22.04 LTS</td>
<td>Windows 10 / 11</td>
<td>macOS 11+</td>
</tr>
<tr>
<td colspan="3">CPU</td>
<td>x86_64(unsupported ARM Linux)</td>
<td>x86_64(unsupported ARM Windows)</td>
<td>x86_64 / arm64</td>
</tr>
<tr>
<td colspan="3">Memory</td>
<td colspan="3">16GB or more, recommended 32GB+</td>
</tr>
<tr>
<td colspan="3">Python Version</td>
<td colspan="3">3.10(Please make sure to create a Python 3.10 virtual environment using conda)</td>
</tr>
<tr>
<td colspan="3">Nvidia Driver Version</td>
<td>latest (Proprietary Driver)</td>
<td>latest</td>
<td>None</td>
</tr>
<tr>
<td colspan="3">CUDA Environment</td>
<td>Automatic installation [12.1 (pytorch) + 11.8 (paddle)]</td>
<td>11.8 (manual installation) + cuDNN v8.7.0 (manual installation)</td>
<td>None</td>
</tr>
<tr>
<td rowspan="2">GPU Hardware Support List</td>
<td colspan="2">Minimum Requirement 8G+ VRAM</td>
<td colspan="2">3060ti/3070/4060<br>
8G VRAM enables layout, formula recognition acceleration and OCR acceleration</td>
<td rowspan="2">None</td>
</tr>
<tr>
<td colspan="2">Recommended Configuration 10G+ VRAM</td>
<td colspan="2">3080/3080ti/3090/3090ti/4070/4070ti/4070tisuper/4080/4090<br>
10G VRAM or more can enable layout, formula recognition, OCR acceleration and table recognition acceleration simultaneously
</td>
</tr>
</table>
### Online Demo ### Online Demo
...@@ -251,85 +172,9 @@ You can modify certain configurations in this file to enable or disable features ...@@ -251,85 +172,9 @@ You can modify certain configurations in this file to enable or disable features
} }
``` ```
### Using GPU
If your device supports CUDA and meets the GPU requirements of the mainline environment, you can use GPU acceleration. Please select the appropriate guide based on your system:
- [Ubuntu 22.04 LTS + GPU](docs/README_Ubuntu_CUDA_Acceleration_en_US.md)
- [Windows 10/11 + GPU](docs/README_Windows_CUDA_Acceleration_en_US.md)
- Quick Deployment with Docker
> [!IMPORTANT]
> Docker requires a GPU with at least 16GB of VRAM, and all acceleration features are enabled by default.
>
> Before running this Docker, you can use the following command to check if your device supports CUDA acceleration on Docker.
>
> ```bash
> docker run --rm --gpus=all nvidia/cuda:12.1.0-base-ubuntu22.04 nvidia-smi
> ```
```bash
wget https://github.com/opendatalab/MinerU/raw/master/Dockerfile
docker build -t mineru:latest .
docker run --rm -it --gpus=all mineru:latest /bin/bash
magic-pdf --help
```
## Usage ## Usage
### Command Line
```bash
magic-pdf --help
Usage: magic-pdf [OPTIONS]
Options:
-v, --version display the version and exit
-p, --path PATH local pdf filepath or directory [required]
-o, --output-dir PATH output local directory [required]
-m, --method [ocr|txt|auto] the method for parsing pdf. ocr: using ocr
technique to extract information from pdf. txt:
suitable for the text-based pdf only and
outperform ocr. auto: automatically choose the
best method for parsing pdf from ocr and txt.
without method specified, auto will be used by
default.
-l, --lang TEXT Input the languages in the pdf (if known) to
improve OCR accuracy. Optional. You should
input "Abbreviation" with language form url: ht
tps://paddlepaddle.github.io/PaddleOCR/latest/en
/ppocr/blog/multi_languages.html#5-support-languages-
and-abbreviations
-d, --debug BOOLEAN Enables detailed debugging information during
the execution of the CLI commands.
-s, --start INTEGER The starting page for PDF parsing, beginning
from 0.
-e, --end INTEGER The ending page for PDF parsing, beginning from
0.
--help Show this message and exit.
## show version
magic-pdf -v
## command line example
magic-pdf -p {some_pdf} -o {some_output_dir} -m auto
```
`{some_pdf}` can be a single PDF file or a directory containing multiple PDFs.
The results will be saved in the `{some_output_dir}` directory. The output file list is as follows:
```text
├── some_pdf.md # markdown file
├── images # directory for storing images
├── some_pdf_layout.pdf # layout diagram (Include layout reading order)
├── some_pdf_middle.json # MinerU intermediate processing result
├── some_pdf_model.json # model inference result
├── some_pdf_origin.pdf # original PDF file
├── some_pdf_spans.pdf # smallest granularity bbox position information diagram
└── some_pdf_content_list.json # Rich text JSON arranged in reading order
```
> [!TIP]
> For more information about the output files, please refer to the [Output File Description](docs/output_file_en_us.md).
### API ### API
Processing files from local disk Processing files from local disk
...@@ -386,24 +231,6 @@ TODO ...@@ -386,24 +231,6 @@ TODO
- [ ] [Chemical formula recognition](docs/chemical_knowledge_introduction/introduction.pdf) - [ ] [Chemical formula recognition](docs/chemical_knowledge_introduction/introduction.pdf)
- [ ] Geometric shape recognition - [ ] Geometric shape recognition
# Known Issues
- Reading order is determined by the model based on the spatial distribution of readable content, and may be out of order in some areas under extremely complex layouts.
- Vertical text is not supported.
- Tables of contents and lists are recognized through rules, and some uncommon list formats may not be recognized.
- Only one level of headings is supported; hierarchical headings are not currently supported.
- Code blocks are not yet supported in the layout model.
- Comic books, art albums, primary school textbooks, and exercises cannot be parsed well.
- Table recognition may result in row/column recognition errors in complex tables.
- OCR recognition may produce inaccurate characters in PDFs of lesser-known languages (e.g., diacritical marks in Latin script, easily confused characters in Arabic script).
- Some formulas may not render correctly in Markdown.
# FAQ
[FAQ in Chinese](docs/FAQ_zh_cn.md)
[FAQ in English](docs/FAQ_en_us.md)
# All Thanks To Our Contributors # All Thanks To Our Contributors
<a href="https://github.com/opendatalab/MinerU/graphs/contributors"> <a href="https://github.com/opendatalab/MinerU/graphs/contributors">
......
Changelog
=========
- 2024/09/27 Version 0.8.1 released, Fixed some bugs, and providing a
`localized deployment version <projects/web_demo/README.md>`__ of the
`online
demo <https://opendatalab.com/OpenSourceTools/Extractor/PDF/>`__ and
the `front-end interface <projects/web/README.md>`__.
- 2024/09/09: Version 0.8.0 released, supporting fast deployment with
Dockerfile, and launching demos on Huggingface and Modelscope.
- 2024/08/30: Version 0.7.1 released, add paddle tablemaster table
recognition option
- 2024/08/09: Version 0.7.0b1 released, simplified installation
process, added table recognition functionality
- 2024/08/01: Version 0.6.2b1 released, optimized dependency conflict
issues and installation documentation
- 2024/07/05: Initial open-source release
.. warning::
fix ``localized deployment version`` and ``front-end interface``
...@@ -74,3 +74,15 @@ CUDA version used by Paddle needs to be upgraded. ...@@ -74,3 +74,15 @@ CUDA version used by Paddle needs to be upgraded.
pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/ pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/
Reference: https://github.com/opendatalab/MinerU/issues/558 Reference: https://github.com/opendatalab/MinerU/issues/558
7. On some Linux servers, the program immediately reports an error ``Illegal instruction (core dumped)``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This might be because the server's CPU does not support the AVX/AVX2
instruction set, or the CPU itself supports it but has been disabled by
the system administrator. You can try contacting the system
administrator to remove the restriction or change to a different server.
References: https://github.com/opendatalab/MinerU/issues/591 ,
https://github.com/opendatalab/MinerU/issues/736
Known Issues Known Issues
============ ============
- Reading order is based on the model’s sorting of text distribution in - Reading order is determined by the model based on the spatial
space, which may become disordered under extremely complex layouts. distribution of readable content, and may be out of order in some
areas under extremely complex layouts.
- Vertical text is not supported. - Vertical text is not supported.
- Tables of contents and lists are recognized through rules; a few - Tables of contents and lists are recognized through rules, and some
uncommon list formats may not be identified. uncommon list formats may not be recognized.
- Only one level of headings is supported; hierarchical heading levels - Only one level of headings is supported; hierarchical headings are
are currently not supported. not currently supported.
- Code blocks are not yet supported in the layout model. - Code blocks are not yet supported in the layout model.
- Comic books, art books, elementary school textbooks, and exercise - Comic books, art albums, primary school textbooks, and exercises
books are not well-parsed yet cannot be parsed well.
- Enabling OCR may produce better results in PDFs with a high density - Table recognition may result in row/column recognition errors in
of formulas complex tables.
- If you are processing PDFs with a large number of formulas, it is - OCR recognition may produce inaccurate characters in PDFs of
strongly recommended to enable the OCR function. When using PyMuPDF lesser-known languages (e.g., diacritical marks in Latin script,
to extract text, overlapping text lines can occur, leading to easily confused characters in Arabic script).
inaccurate formula insertion positions. - Some formulas may not render correctly in Markdown.
\ No newline at end of file
...@@ -46,20 +46,29 @@ the relevant PDF**. ...@@ -46,20 +46,29 @@ the relevant PDF**.
Key Features Key Features
------------ ------------
- Removes elements such as headers, footers, footnotes, and page - Remove headers, footers, footnotes, page numbers, etc., to ensure
numbers while maintaining semantic continuity semantic coherence.
- Outputs text in a human-readable order from multi-column documents - Output text in human-readable order, suitable for single-column,
- Retains the original structure of the document, including titles, multi-column, and complex layouts.
paragraphs, and lists - Preserve the structure of the original document, including headings,
- Extracts images, image captions, tables, and table captions paragraphs, lists, etc.
- Automatically recognizes formulas in the document and converts them - Extract images, image descriptions, tables, table titles, and
to LaTeX footnotes.
- Automatically recognizes tables in the document and converts them to - Automatically recognize and convert formulas in the document to LaTeX
LaTeX format.
- Automatically detects and enables OCR for corrupted PDFs - Automatically recognize and convert tables in the document to LaTeX
- Supports both CPU and GPU environments or HTML format.
- Supports Windows, Linux, and Mac platforms - Automatically detect scanned PDFs and garbled PDFs and enable OCR
functionality.
- OCR supports detection and recognition of 84 languages.
- Supports multiple output formats, such as multimodal and NLP
Markdown, JSON sorted by reading order, and rich intermediate
formats.
- Supports various visualization results, including layout
visualization and span visualization, for efficient confirmation of
output quality.
- Supports both CPU and GPU environments.
- Compatible with Windows, Linux, and Mac platforms.
User Guide User Guide
------------- -------------
...@@ -91,14 +100,6 @@ Additional Notes ...@@ -91,14 +100,6 @@ Additional Notes
additional_notes/known_issues additional_notes/known_issues
additional_notes/faq additional_notes/faq
additional_notes/changelog
additional_notes/glossary additional_notes/glossary
Projects
---------
.. toctree::
:maxdepth: 1
:caption: Projects
projects
\ No newline at end of file
llama_index_rag
===============
gradio_app
============
other projects
===============
\ No newline at end of file
...@@ -137,7 +137,7 @@ Download a sample file from the repository and test it. ...@@ -137,7 +137,7 @@ Download a sample file from the repository and test it.
.. code:: sh .. code:: sh
wget https://github.com/opendatalab/MinerU/raw/master/demo/small_ocr.pdf wget https://github.com/opendatalab/MinerU/raw/master/demo/small_ocr.pdf
magic-pdf -p small_ocr.pdf magic-pdf -p small_ocr.pdf -o ./output
9. Test CUDA Acceleration 9. Test CUDA Acceleration
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -145,10 +145,6 @@ Download a sample file from the repository and test it. ...@@ -145,10 +145,6 @@ Download a sample file from the repository and test it.
If your graphics card has at least **8GB** of VRAM, follow these steps If your graphics card has at least **8GB** of VRAM, follow these steps
to test CUDA acceleration: to test CUDA acceleration:
❗ Due to the extremely limited nature of 8GB VRAM for running this
application, you need to close all other programs using VRAM to
ensure that 8GB of VRAM is available when running this application.
1. Modify the value of ``"device-mode"`` in the ``magic-pdf.json`` 1. Modify the value of ``"device-mode"`` in the ``magic-pdf.json``
configuration file located in your home directory. configuration file located in your home directory.
...@@ -162,7 +158,7 @@ to test CUDA acceleration: ...@@ -162,7 +158,7 @@ to test CUDA acceleration:
.. code:: sh .. code:: sh
magic-pdf -p small_ocr.pdf magic-pdf -p small_ocr.pdf -o ./output
10. Enable CUDA Acceleration for OCR 10. Enable CUDA Acceleration for OCR
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -178,7 +174,9 @@ to test CUDA acceleration: ...@@ -178,7 +174,9 @@ to test CUDA acceleration:
.. code:: sh .. code:: sh
magic-pdf -p small_ocr.pdf magic-pdf -p small_ocr.pdf -o ./output
.. _windows_10_or_11_section: .. _windows_10_or_11_section:
...@@ -252,7 +250,7 @@ Download a sample file from the repository and test it. ...@@ -252,7 +250,7 @@ Download a sample file from the repository and test it.
.. code:: powershell .. code:: powershell
wget https://github.com/opendatalab/MinerU/raw/master/demo/small_ocr.pdf -O small_ocr.pdf wget https://github.com/opendatalab/MinerU/raw/master/demo/small_ocr.pdf -O small_ocr.pdf
magic-pdf -p small_ocr.pdf magic-pdf -p small_ocr.pdf -o ./output
8. Test CUDA Acceleration 8. Test CUDA Acceleration
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -260,10 +258,6 @@ Download a sample file from the repository and test it. ...@@ -260,10 +258,6 @@ Download a sample file from the repository and test it.
If your graphics card has at least 8GB of VRAM, follow these steps to If your graphics card has at least 8GB of VRAM, follow these steps to
test CUDA-accelerated parsing performance. test CUDA-accelerated parsing performance.
❗ Due to the extremely limited nature of 8GB VRAM for running this
application, you need to close all other programs using VRAM to
ensure that 8GB of VRAM is available when running this application.
1. **Overwrite the installation of torch and torchvision** supporting 1. **Overwrite the installation of torch and torchvision** supporting
CUDA. CUDA.
...@@ -295,7 +289,7 @@ test CUDA-accelerated parsing performance. ...@@ -295,7 +289,7 @@ test CUDA-accelerated parsing performance.
:: ::
magic-pdf -p small_ocr.pdf magic-pdf -p small_ocr.pdf -o ./output
9. Enable CUDA Acceleration for OCR 9. Enable CUDA Acceleration for OCR
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -311,5 +305,4 @@ test CUDA-accelerated parsing performance. ...@@ -311,5 +305,4 @@ test CUDA-accelerated parsing performance.
:: ::
magic-pdf -p small_ocr.pdf magic-pdf -p small_ocr.pdf -o ./output
...@@ -27,61 +27,62 @@ community feedback to help us gradually expand support. ...@@ -27,61 +27,62 @@ community feedback to help us gradually expand support.
.. raw:: html .. raw:: html
<style> <style>
table, th, td { table, th, td {
border: 1px solid black; border: 1px solid black;
border-collapse: collapse; border-collapse: collapse;
} }
</style> </style>
<table> <table>
<tr> <tr>
<td colspan="3" rowspan="2">Operating System</td> <td colspan="3" rowspan="2">Operating System</td>
</tr> </tr>
<tr> <tr>
<td>Ubuntu 22.04 LTS</td> <td>Ubuntu 22.04 LTS</td>
<td>Windows 10 / 11</td> <td>Windows 10 / 11</td>
<td>macOS 11+</td> <td>macOS 11+</td>
</tr> </tr>
<tr> <tr>
<td colspan="3">CPU</td> <td colspan="3">CPU</td>
<td>x86_64</td> <td>x86_64(unsupported ARM Linux)</td>
<td>x86_64</td> <td>x86_64(unsupported ARM Windows)</td>
<td>x86_64 / arm64</td> <td>x86_64 / arm64</td>
</tr> </tr>
<tr> <tr>
<td colspan="3">Memory</td> <td colspan="3">Memory</td>
<td colspan="3">16GB or more, recommended 32GB+</td> <td colspan="3">16GB or more, recommended 32GB+</td>
</tr> </tr>
<tr> <tr>
<td colspan="3">Python Version</td> <td colspan="3">Python Version</td>
<td colspan="3">3.10</td> <td colspan="3">3.10(Please make sure to create a Python 3.10 virtual environment using conda)</td>
</tr> </tr>
<tr> <tr>
<td colspan="3">Nvidia Driver Version</td> <td colspan="3">Nvidia Driver Version</td>
<td>latest (Proprietary Driver)</td> <td>latest (Proprietary Driver)</td>
<td>latest</td> <td>latest</td>
<td>None</td> <td>None</td>
</tr> </tr>
<tr> <tr>
<td colspan="3">CUDA Environment</td> <td colspan="3">CUDA Environment</td>
<td>Automatic installation [12.1 (pytorch) + 11.8 (paddle)]</td> <td>Automatic installation [12.1 (pytorch) + 11.8 (paddle)]</td>
<td>11.8 (manual installation) + cuDNN v8.7.0 (manual installation)</td> <td>11.8 (manual installation) + cuDNN v8.7.0 (manual installation)</td>
<td>None</td> <td>None</td>
</tr> </tr>
<tr> <tr>
<td rowspan="2">GPU Hardware Support List</td> <td rowspan="2">GPU Hardware Support List</td>
<td colspan="2">Minimum Requirement 8G+ VRAM</td> <td colspan="2">Minimum Requirement 8G+ VRAM</td>
<td colspan="2">3060ti/3070/3080/3080ti/4060/4070/4070ti<br> <td colspan="2">3060ti/3070/4060<br>
8G VRAM enables layout, formula recognition acceleration and OCR acceleration</td> 8G VRAM enables layout, formula recognition acceleration and OCR acceleration</td>
<td rowspan="2">None</td> <td rowspan="2">None</td>
</tr> </tr>
<tr> <tr>
<td colspan="2">Recommended Configuration 16G+ VRAM</td> <td colspan="2">Recommended Configuration 10G+ VRAM</td>
<td colspan="2">3090/3090ti/4070ti super/4080/4090<br> <td colspan="2">3080/3080ti/3090/3090ti/4070/4070ti/4070tisuper/4080/4090<br>
16G VRAM or more can enable layout, formula recognition, OCR acceleration and table recognition acceleration simultaneously 10G VRAM or more can enable layout, formula recognition, OCR acceleration and table recognition acceleration simultaneously
</td> </td>
</tr> </tr>
</table> </table>
Create an environment Create an environment
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment