未验证 提交 1c0927c6 编写于 作者: D DanielYang 提交者: GitHub

Merge pull request #3904 from Evezerest/dygraph

Add the overview of PaddleOCR
...@@ -102,6 +102,7 @@ For more model downloads (including multiple languages), please refer to [PP-OCR ...@@ -102,6 +102,7 @@ For more model downloads (including multiple languages), please refer to [PP-OCR
For a new language request, please refer to [Guideline for new language_requests](#language_requests). For a new language request, please refer to [Guideline for new language_requests](#language_requests).
## Tutorials ## Tutorials
- [Environment Preparation](./doc/doc_en/environment_en.md)
- [Quick Start](./doc/doc_en/quickstart_en.md) - [Quick Start](./doc/doc_en/quickstart_en.md)
- [PaddleOCR Overview and Installation](./doc/doc_en/paddleOCR_overview_en.md) - [PaddleOCR Overview and Installation](./doc/doc_en/paddleOCR_overview_en.md)
- PP-OCR Industry Landing: from Training to Deployment - PP-OCR Industry Landing: from Training to Deployment
......
...@@ -92,6 +92,7 @@ PaddleOCR同时支持动态图与静态图两种编程范式 ...@@ -92,6 +92,7 @@ PaddleOCR同时支持动态图与静态图两种编程范式
更多模型下载(包括多语言),可以参考[PP-OCR v2.0 系列模型下载](./doc/doc_ch/models_list.md) 更多模型下载(包括多语言),可以参考[PP-OCR v2.0 系列模型下载](./doc/doc_ch/models_list.md)
## 文档教程 ## 文档教程
- [运行环境准备](./doc/doc_ch/environment.md)
- [快速开始](./doc/doc_ch/quickstart.md) - [快速开始](./doc/doc_ch/quickstart.md)
- [PaddleOCR全景图与安装](./doc/doc_ch/paddleOCR_overview.md) - [PaddleOCR全景图与安装](./doc/doc_ch/paddleOCR_overview.md)
- PP-OCR产业落地:从训练到部署 - PP-OCR产业落地:从训练到部署
...@@ -120,7 +121,6 @@ PaddleOCR同时支持动态图与静态图两种编程范式 ...@@ -120,7 +121,6 @@ PaddleOCR同时支持动态图与静态图两种编程范式
- OCR学术圈 - OCR学术圈
- [两阶段模型介绍与下载](./doc/doc_ch/algorithm_overview.md) - [两阶段模型介绍与下载](./doc/doc_ch/algorithm_overview.md)
- [端到端PGNet算法](./doc/doc_ch/pgnet.md) - [端到端PGNet算法](./doc/doc_ch/pgnet.md)
- 模型训练
- 数据集 - 数据集
- [通用中英文OCR数据集](./doc/doc_ch/datasets.md) - [通用中英文OCR数据集](./doc/doc_ch/datasets.md)
- [手写中文OCR数据集](./doc/doc_ch/handwritten_datasets.md) - [手写中文OCR数据集](./doc/doc_ch/handwritten_datasets.md)
......
# 零基础Python环境搭建 # 运行环境准备
## Windows [运行环境准备](#运行环境准备)
### 第1步:安装Anaconda * [1. Python环境搭建](#1)
+ [1.1 Windows](#1.1)
+ [1.2 Mac](#1.2)
+ [1.3 Linux](#1.3)
* [2. 安装PaddlePaddle](#2)
<a name="1"></a>
## 1. Python环境搭建
<a name="1.1"></a>
### 1.1 Windows
#### 1.1.1 安装Anaconda
- 说明:使用paddlepaddle需要先安装python环境,这里我们选择python集成环境Anaconda工具包 - 说明:使用paddlepaddle需要先安装python环境,这里我们选择python集成环境Anaconda工具包
- Anaconda是1个常用的python包管理程序 - Anaconda是1个常用的python包管理程序
...@@ -11,20 +25,20 @@ ...@@ -11,20 +25,20 @@
- 地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D - 地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D
- 大部分win10电脑均为64位操作系统,选择x86_64版本;若电脑为32位操作系统,则选择x86.exe - 大部分win10电脑均为64位操作系统,选择x86_64版本;若电脑为32位操作系统,则选择x86.exe
<img src="../install/windows/Anaconda_download.png" alt="anaconda download" width="800" align="left"/> <img src="../install/windows/Anaconda_download.png" alt="anaconda download" width="800" align="center"/>
- 下载完成后,双击安装程序进入图形界面 - 下载完成后,双击安装程序进入图形界面
- 默认安装位置为C盘,建议将安装位置更改到D盘: - 默认安装位置为C盘,建议将安装位置更改到D盘:
<img src="../install/windows/anaconda_install_folder.png" alt="install config" width="500" align="left"/> <img src="../install/windows/anaconda_install_folder.png" alt="install config" width="500" align="center"/>
- 勾选conda加入环境变量,忽略警告: - 勾选conda加入环境变量,忽略警告:
<img src="../install/windows/anaconda_install_env.png" alt="add conda to path" width="500" align="left"/> <img src="../install/windows/anaconda_install_env.png" alt="add conda to path" width="500" align="center"/>
### 第2步:打开终端并创建conda环境 #### 1.1.2 打开终端并创建conda环境
- 打开Anaconda Prompt终端:左下角Windows Start Menu -> Anaconda3 -> Anaconda Prompt启动控制台 - 打开Anaconda Prompt终端:左下角Windows Start Menu -> Anaconda3 -> Anaconda Prompt启动控制台
<img src="../install/windows/anaconda_prompt.png" alt="anaconda download" width="300" align="left"/> <img src="../install/windows/anaconda_prompt.png" alt="anaconda download" width="300" align="center"/>
- 创建新的conda环境 - 创建新的conda环境
...@@ -39,7 +53,7 @@ ...@@ -39,7 +53,7 @@
之后命令行中会输出提示信息,输入y并回车继续安装 之后命令行中会输出提示信息,输入y并回车继续安装
<img src="../install/windows/conda_new_env.png" alt="conda create" width="700" align="left"/> <img src="../install/windows/conda_new_env.png" alt="conda create" width="700" align="center"/>
- 激活刚创建的conda环境,在命令行中输入以下命令: - 激活刚创建的conda环境,在命令行中输入以下命令:
...@@ -50,21 +64,18 @@ ...@@ -50,21 +64,18 @@
where python where python
``` ```
<img src="../install/windows/conda_list_env.png" alt="create environment" width="600" align="left"/> <img src="../install/windows/conda_list_env.png" alt="create environment" width="600" align="center"/>
以上anaconda环境和python环境安装完毕 以上anaconda环境和python环境安装完毕
<a name="1.2"></a>
### 1.2 Mac
## Mac #### 1.2.1 安装Anaconda
### 第1步:安装Anaconda
- 说明:使用paddlepaddle需要先安装python环境,这里我们选择python集成环境Anaconda工具包 - 说明:使用paddlepaddle需要先安装python环境,这里我们选择python集成环境Anaconda工具包
- Anaconda是1个常用的python包管理程序 - Anaconda是1个常用的python包管理程序
...@@ -72,14 +83,14 @@ ...@@ -72,14 +83,14 @@
- Anaconda下载: - Anaconda下载:
- 地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D - 地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D
<img src="../install/mac/anaconda_start.png" alt="anaconda download" width="800" align="left"/> <img src="../install/mac/anaconda_start.png" alt="anaconda download" width="800" align="center"/>
- 选择最下方的`Anaconda3-2021.05-MacOSX-x86_64.pkg`下载 - 选择最下方的`Anaconda3-2021.05-MacOSX-x86_64.pkg`下载
- 下载完成后,双击.pkg文件进入图形界面 - 下载完成后,双击.pkg文件进入图形界面
- 按默认设置即可,安装需要花费一段时间 - 按默认设置即可,安装需要花费一段时间
- 建议安装vscode或pycharm等代码编辑器 - 建议安装vscode或pycharm等代码编辑器
### 第2步:打开终端并创建conda环境 #### 1.2.2 打开终端并创建conda环境
- 打开终端 - 打开终端
...@@ -142,7 +153,7 @@ ...@@ -142,7 +153,7 @@
- 之后命令行中会输出提示信息,输入y并回车继续安装 - 之后命令行中会输出提示信息,输入y并回车继续安装
- <img src="../install/mac/conda_create.png" alt="conda_create" width="600" align="left"/> - <img src="../install/mac/conda_create.png" alt="conda_create" width="600" align="center"/>
- 激活刚创建的conda环境,在命令行中输入以下命令: - 激活刚创建的conda环境,在命令行中输入以下命令:
...@@ -153,15 +164,17 @@ ...@@ -153,15 +164,17 @@
where python where python
``` ```
<img src="../install/mac/conda_activate.png" alt="conda_actviate" width="600" align="left"/> <img src="../install/mac/conda_activate.png" alt="conda_actviate" width="600" align="center"/>
以上anaconda环境和python环境安装完毕 以上anaconda环境和python环境安装完毕
<a name="1.3"></a>
### 1.3 Linux
## Linux Linux用户可选择Anaconda或Docker两种方式运行。如果你熟悉Docker且需要训练PaddleOCR模型,推荐使用Docker环境,PaddleOCR的开发流程均在Docker环境下运行。如果你不熟悉Docker,也可以使用Anaconda来运行项目。
### 第1步:安装Anaconda #### 1.3.1 Anaconda环境配置
- 说明:使用paddlepaddle需要先安装python环境,这里我们选择python集成环境Anaconda工具包 - 说明:使用paddlepaddle需要先安装python环境,这里我们选择python集成环境Anaconda工具包
- Anaconda是1个常用的python包管理程序 - Anaconda是1个常用的python包管理程序
...@@ -170,30 +183,14 @@ ...@@ -170,30 +183,14 @@
- **下载Anaconda** - **下载Anaconda**
- 下载地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D - 下载地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D
<img src="../install/linux/anaconda_download.png" akt="anaconda download" width="800" align="left"/> <img src="../install/linux/anaconda_download.png" akt="anaconda download" width="800" align="center"/>
- 选择适合您操作系统的版本 - 选择适合您操作系统的版本
- 可在终端输入`uname -m`查询系统所用的指令集 - 可在终端输入`uname -m`查询系统所用的指令集
- 下载法1:本地下载,再将安装包传到linux服务器上 - 下载法1:本地下载,再将安装包传到linux服务器上
- 下载法2:直接使用linux命令行下载 - 下载法2:直接使用linux命令行下载
```shell ```shell
# 首先安装wget # 首先安装wget
...@@ -262,8 +259,6 @@ ...@@ -262,8 +259,6 @@
- 在终端中输入`source ~/.bash_profile`以更新环境变量 - 在终端中输入`source ~/.bash_profile`以更新环境变量
- 再在终端输入`conda info --envs`,若能显示当前有base环境,则conda已加入环境变量 - 再在终端输入`conda info --envs`,若能显示当前有base环境,则conda已加入环境变量
### 第2步:创建conda环境
- 创建新的conda环境 - 创建新的conda环境
```shell ```shell
...@@ -276,7 +271,7 @@ ...@@ -276,7 +271,7 @@
- 之后命令行中会输出提示信息,输入y并回车继续安装 - 之后命令行中会输出提示信息,输入y并回车继续安装
<img src="../install/linux/conda_create.png" alt="conda_create" width="500" align="left"/> <img src="../install/linux/conda_create.png" alt="conda_create" width="500" align="center"/>
- 激活刚创建的conda环境,在命令行中输入以下命令: - 激活刚创建的conda环境,在命令行中输入以下命令:
...@@ -287,3 +282,48 @@ ...@@ -287,3 +282,48 @@
以上anaconda环境和python环境安装完毕 以上anaconda环境和python环境安装完毕
#### 1.3.2 Docker环境配置
**注意:第一次使用这个镜像,会自动下载该镜像,请耐心等待。**
```bash
# 切换到工作目录下
cd /home/Projects
# 首次运行需创建一个docker容器,再次运行时不需要运行当前命令
# 创建一个名字为ppocr的docker容器,并将当前目录映射到容器的/paddle目录下
如果您希望在CPU环境下使用docker,使用docker而不是nvidia-docker创建docker
sudo docker run --name ppocr -v $PWD:/paddle --network=host -it paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 /bin/bash
如果使用CUDA10,请运行以下命令创建容器,设置docker容器共享内存shm-size为64G,建议设置32G以上
sudo nvidia-docker run --name ppocr -v $PWD:/paddle --shm-size=64G --network=host -it paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 /bin/bash
您也可以访问[DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/)获取与您机器适配的镜像。
# ctrl+P+Q可退出docker 容器,重新进入docker 容器使用如下命令
sudo docker container exec -it ppocr /bin/bash
```
<a name="2"></a>
## 2. 安装PaddlePaddle
- 如果您的机器安装的是CUDA9或CUDA10,请运行以下命令安装
```bash
python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple
```
- 如果您的机器是CPU,请运行以下命令安装
```bash
python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
```
更多的版本需求,请参照[飞桨官网安装文档](https://www.paddlepaddle.org.cn/install/quick)中的说明进行操作。
# PaddleOCR全景图与项目克隆 # PaddleOCR全景图与项目克隆
## 1. PaddleOCR全景图
PaddleOCR包含丰富的文本检测、文本识别以及端到端算法。结合实际测试与产业经验,PaddleOCR选择DB和CRNN作为基础的检测和识别模型,经过一系列优化策略提出面向产业应用的PP-OCR模型。PP-OCR模型针对通用场景,根据不同语种形成了PP-OCR模型库。基于PP-OCR的能力,PaddleOCR针对文档场景任务发布PP-Structure工具库,包含版面分析和表格识别两大任务。为了打通产业落地的全流程,PaddleOCR提供了规模化的数据生产工具和多种预测部署工具,助力开发者快速落地。
<div align="center">
<img src="../overview.png">
</div>
## 2. 项目克隆
### **2.1 克隆PaddleOCR repo代码**
```
【推荐】git clone https://github.com/PaddlePaddle/PaddleOCR
```
如果因为网络问题无法pull成功,也可选择使用码云上的托管:
```
git clone https://gitee.com/paddlepaddle/PaddleOCR
```
注:码云托管代码可能无法实时同步本github项目更新,存在3~5天延时,请优先使用推荐方式。
### **2.2 安装第三方库**
```
cd PaddleOCR
pip3 install -r requirements.txt
```
# PaddleOCR快速开始 # PaddleOCR快速开始
- [PaddleOCR快速开始](#paddleocr) - [PaddleOCR快速开始](#paddleocr)
* [1. 轻量安装](#1) + [1. 安装PaddleOCR whl包](#1)
+ [1.0 运行环境准备](#10)
+ [1.1 安装PaddlePaddle2.0](#11)
+ [1.2 安装PaddleOCR whl包](#12)
* [2. 便捷使用](#2) * [2. 便捷使用](#2)
+ [2.1 命令行使用](#21) + [2.1 命令行使用](#21)
- [2.1.1 中英文模型](#211) - [2.1.1 中英文模型](#211)
...@@ -13,31 +10,9 @@ ...@@ -13,31 +10,9 @@
- [2.2.1 中英文与多语言使用](#221) - [2.2.1 中英文与多语言使用](#221)
- [2.2.2 版面分析使用](#222) - [2.2.2 版面分析使用](#222)
<a name="1"></a> <a name="1"></a>
## 1. 轻量安装
<a name="10"></a>
### 1.0 运行环境准备
如果您未搭建过Python环境,可以通过[零基础Python环境搭建文档](./environment.)进行环境搭建
<a name="11"></a>
### 1.1 安装PaddlePaddle2.0
- 如果您的机器安装的是CUDA9或CUDA10,请运行以下命令安装
```bash
python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple
```
- 如果您的机器是CPU,请运行以下命令安装 ## 1. 安装PaddleOCR whl包
```bash
python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
```
更多的版本需求,请参照[飞桨官网安装文档](https://www.paddlepaddle.org.cn/install/quick)中的说明进行操作。
<a name="12"></a>
### 1.2 安装PaddleOCR whl包
```bash ```bash
pip install "paddleocr>=2.0.1" # 推荐使用2.0.1+版本 pip install "paddleocr>=2.0.1" # 推荐使用2.0.1+版本
...@@ -59,7 +34,7 @@ pip install "paddleocr>=2.0.1" # 推荐使用2.0.1+版本 ...@@ -59,7 +34,7 @@ pip install "paddleocr>=2.0.1" # 推荐使用2.0.1+版本
<a name="21"></a> <a name="21"></a>
### 2.1 命令行使用 ### 2.1 命令行使用
PaddleOCR提供了一系列测试图片,点击xx下载,然后在终端中切换到相应目录 PaddleOCR提供了一系列测试图片,点击[这里](https://paddleocr.bj.bcebos.com/dygraph_v2.1/ppocr_img.zip)下载并解压,然后在终端中切换到相应目录
``` ```
cd /path/to/ppocr_img cd /path/to/ppocr_img
...@@ -203,6 +178,7 @@ paddleocr --image_dir=./table/1.png --type=structure ...@@ -203,6 +178,7 @@ paddleocr --image_dir=./table/1.png --type=structure
大部分参数和paddleocr whl包保持一致,见 [whl包文档](../doc/doc_ch/whl.md) 大部分参数和paddleocr whl包保持一致,见 [whl包文档](../doc/doc_ch/whl.md)
<a name="22"></a> <a name="22"></a>
### 2.2 Python脚本使用 ### 2.2 Python脚本使用
<a name="221"></a> <a name="221"></a>
......
# Environment Preparation
* [1. Python Environment Setup](#1)
+ [1.1 Windows](#1.1)
+ [1.2 Mac](#1.2)
+ [1.3 Linux](#1.3)
* [2. Install PaddlePaddle 2.0](#2)
<a name="1"></a>
## 1. Python Environment Setup
<a name="1.1"></a>
### 1.1 Windows
#### 1.1.1 Install Anaconda
- Note: To use paddlepaddle you need to install python environment first, here we choose python integrated environment Anaconda toolkit
- Anaconda is a common python package manager
- After installing Anaconda, you can install the python environment, as well as numpy and other required toolkit environment.
- Anaconda download.
- Address: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D
- Most Win10 computers are 64-bit operating systems, choose x86_64 version; if the computer is a 32-bit operating system, choose x86.exe
<img src="../install/windows/Anaconda_download.png" alt="anaconda download" width="800" align="center "/>
- After the download is complete, double-click the installer to enter the graphical interface
- The default installation location is C drive, it is recommended to change the installation location to D drive.
<img src="../install/windows/anaconda_install_folder.png" alt="install config" width="500" align=" left"/>
- Check conda to add environment variables and ignore the warning that
<img src="../install/windows/anaconda_install_env.png" alt="add conda to path" width="500" align="center"/>
#### 1.1.2 Opening the terminal and creating the conda environment
- Open Anaconda Prompt terminal: bottom left Windows Start Menu -> Anaconda3 -> Anaconda Prompt start console
<img src="../install/windows/anaconda_prompt.png" alt="anaconda download" width="300" align="center"/>
- Create a new conda environment
```shell
# Enter the following command at the command line to create an environment named paddle_env
# Here to speed up the download, use the Tsinghua source
conda create --name paddle_env python=3.8 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ # This is a one line command
```
This command will create an executable environment named paddle_env with python version 3.8, which will take a while depending on the network status
The command line will then output a prompt, type y and enter to continue the installation
<img src="../install/windows/conda_new_env.png" alt="conda create" width="700" align="center"/>
- To activate the conda environment you just created, enter the following command at the command line.
```shell
# Activate the paddle_env environment
conda activate paddle_env
# View the current location of python
where python
```
<img src="../install/windows/conda_list_env.png" alt="create environment" width="600" align="center"/>
The above anaconda environment and python environment are installed
<a name="1.2"></a>
### 1.2 Mac
#### 1.2.1 Installing Anaconda
- Note: To use paddlepaddle you need to install the python environment first, here we choose the python integrated environment Anaconda toolkit
- Anaconda is a common python package manager
- After installing Anaconda, you can install the python environment, as well as numpy and other required toolkit environment
- Anaconda download:.
- Address: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D
<img src="../install/mac/anaconda_start.png" alt="anaconda download" width="800" align="center"/>
- Select `Anaconda3-2021.05-MacOSX-x86_64.pkg` at the bottom to download
- After downloading, double click on the .pkg file to enter the graphical interface
- Just follow the default settings, it will take a while to install
- It is recommended to install a code editor such as vscode or pycharm
#### 1.2.2 Open a terminal and create a conda environment
- Open the terminal
- Press command and spacebar at the same time, type "terminal" in the focus search, double click to enter terminal
- **Add conda to the environment variables**
- Environment variables are added so that the system can recognize the conda command
- Open `~/.bash_profile` in the terminal by typing the following command.
```shell
vim ~/.bash_profile
```
- Add conda as an environment variable in `~/.bash_profile`.
```shell
# Press i first to enter edit mode
# In the first line type.
export PATH="~/opt/anaconda3/bin:$PATH"
# If you customized the installation location during installation, change ~/opt/anaconda3/bin to the bin folder in the customized installation directory
```
```shell
# The modified ~/.bash_profile file should look like this (where xxx is the username)
export PATH="~/opt/anaconda3/bin:$PATH"
# >>> conda initialize >>>
# !!! Contents within this block are managed by 'conda init' !!!
__conda_setup="$('/Users/xxx/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/xxx/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
```
- When you are done, press `esc` to exit edit mode, then type `:wq!` and enter to save and exit
- Verify that the conda command is recognized.
- Enter `source ~/.bash_profile` in the terminal to update the environment variables
- Enter `conda info --envs` in the terminal again, if it shows that there is a base environment, then conda has been added to the environment variables
- Create a new conda environment
```shell
# Enter the following command at the command line to create an environment called paddle_env
# Here to speed up the download, use Tsinghua source
conda create --name paddle_env python=3.8 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
```
- This command will create an executable environment named paddle_env with python version 3.8, which will take a while depending on the network status
- The command line will then output a prompt, type y and enter to continue the installation
- <img src="../install/mac/conda_create.png" alt="conda_create" width="600" align="center"/>
- To activate the conda environment you just created, enter the following command at the command line.
```shell
# Activate the paddle_env environment
conda activate paddle_env
# View the current location of python
where python
```
<img src="../install/mac/conda_activate.png" alt="conda_actviate" width="600" align="center"/>
The above anaconda environment and python environment are installed
<a name="1.3"></a>
### 1.3 Linux
Linux users can choose to run either Anaconda or Docker. If you are familiar with Docker and need to train the PaddleOCR model, it is recommended to use the Docker environment, where the development process of PaddleOCR is run. If you are not familiar with Docker, you can also use Anaconda to run the project.
#### 1.3.1 Anaconda environment configuration
- Note: To use paddlepaddle you need to install the python environment first, here we choose the python integrated environment Anaconda toolkit
- Anaconda is a common python package manager
- After installing Anaconda, you can install the python environment, as well as numpy and other required toolkit environment
- **Download Anaconda**.
- Download at: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D
<img src="../install/linux/anaconda_download.png" akt="anaconda download" width="800" align="center"/>
- Select the appropriate version for your operating system
- Type `uname -m` in the terminal to check the command set used by your system
- Download method 1: Download locally, then transfer the installation package to the linux server
- Download method 2: Directly use linux command line to download
```shell
# First install wget
sudo apt-get install wget # Ubuntu
sudo yum install wget # CentOS
```
```bash
# Then use wget to download from Tsinghua source
# If you want to download Anaconda3-2021.05-Linux-x86_64.sh, the download command is as follows
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.05-Linux-x86_64.sh
# If you want to download another version, you need to change the file name after the last 1 / to the version you want to download
```
- To install Anaconda.
- Type `sh Anaconda3-2021.05-Linux-x86_64.sh` at the command line
- If you downloaded a different version, replace the file name of the command with the name of the file you downloaded
- Just follow the installation instructions
- You can exit by typing q when viewing the license
- **Add conda to the environment variables**
- If you have already added conda to the environment variable path during the installation, you can skip this step
- Open `~/.bashrc` in a terminal.
```shell
# Enter the following command in the terminal.
vim ~/.bashrc
```
- Add conda as an environment variable in `~/.bashrc`.
```shell
# Press i first to enter edit mode # In the first line enter.
export PATH="~/anaconda3/bin:$PATH"
# If you customized the installation location during installation, change ~/anaconda3/bin to the bin folder in the customized installation directory
```
```shell
# The modified ~/.bash_profile file should look like this (where xxx is the username)
export PATH="~/opt/anaconda3/bin:$PATH"
# >>> conda initialize >>>
# !!! Contents within this block are managed by 'conda init' !!!
__conda_setup="$('/Users/xxx/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/xxx/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
```
- When you are done, press `esc` to exit edit mode, then type `:wq!` and enter to save and exit
- Verify that the conda command is recognized.
- Enter `source ~/.bash_profile` in the terminal to update the environment variables
- Enter `conda info --envs` in the terminal again, if it shows that there is a base environment, then conda has been added to the environment variables
- Create a new conda environment
```shell
# Enter the following command at the command line to create an environment called paddle_env
# Here to speed up the download, use Tsinghua source
conda create --name paddle_env python=3.8 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
```
- This command will create an executable environment named paddle_env with python version 3.8, which will take a while depending on the network status
- The command line will then output a prompt, type y and enter to continue the installation
<img src="../install/linux/conda_create.png" alt="conda_create" width="500" align="center"/>
- To activate the conda environment you just created, enter the following command at the command line.
```shell
# Activate the paddle_env environment
conda activate paddle_env
```
The above anaconda environment and python environment are installed
#### 1.3.2 Docker environment preparation
**The first time you use this docker image, it will be downloaded automatically. Please be patient.**
```bash
# Switch to the working directory
cd /home/Projects
# You need to create a docker container for the first run, and do not need to run the current command when you run it again
# Create a docker container named ppocr and map the current directory to the /paddle directory of the container
# If using CPU, use docker instead of nvidia-docker to create docker
sudo docker run --name ppocr -v $PWD:/paddle --network=host -it paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 /bin/bash
```
<a name="2"></a>
## 2. Install PaddlePaddle 2.0
- If you have cuda9 or cuda10 installed on your machine, please run the following command to install
```bash
python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple
```
- If you only have cpu on your machine, please run the following command to install
```bash
python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
```
For more software version requirements, please refer to the instructions in [Installation Document](https://www.paddlepaddle.org.cn/install/quick) for operation.
# PaddleOCR Overview and Project Clone
## 1. PaddleOCR Overview
PaddleOCR contains rich text detection, text recognition and end-to-end algorithms. Combining actual testing and industrial experience, PaddleOCR chooses DB and CRNN as the basic detection and recognition models, and proposes a series of models, named PP-OCR, for industrial applications after a series of optimization strategies. The PP-OCR model is aimed at general scenarios and forms a model library according to different languages. Based on the capabilities of PP-OCR, PaddleOCR releases the PP-Structure tool library for document scene tasks, including two major tasks: layout analysis and table recognition. In order to get through the entire process of industrial landing, PaddleOCR provides large-scale data production tools and a variety of prediction deployment tools to help developers quickly turn ideas into reality.
<div align="center">
<img src="../overview_en.png">
</div>
## 2. Project Clone
### **2.1 Clone PaddleOCR repo**
```
# Recommend
git clone https://github.com/PaddlePaddle/PaddleOCR
# If you cannot pull successfully due to network problems, you can also choose to use the code hosting on the cloud:
git clone https://gitee.com/paddlepaddle/PaddleOCR
# Note: The cloud-hosting code may not be able to synchronize the update with this GitHub project in real time. There might be a delay of 3-5 days. Please give priority to the recommended method.
```
### **2.2 Install third-party libraries**
```
cd PaddleOCR
pip3 install -r requirements.txt
```
If you getting this error `OSError: [WinError 126] The specified module could not be found` when you install shapely on windows.
Please try to download Shapely whl file using [http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely](http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely).
Reference: [Solve shapely installation on windows](
\ No newline at end of file
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
[PaddleOCR Quick Start](#paddleocr-quick-start) [PaddleOCR Quick Start](#paddleocr-quick-start)
* [1. Light Installation](#1-light-installation) + [1. Install PaddleOCR Whl Package](#1-install-paddleocr-whl-package)
+ [1.1 Install PaddlePaddle2.0](#11-install-paddlepaddle20)
+ [1.2 Install PaddleOCR Whl Package](#12-install-paddleocr-whl-package)
* [2. Easy-to-Use](#2-easy-to-use) * [2. Easy-to-Use](#2-easy-to-use)
+ [2.1 Use by command line](#21-use-by-command-line) + [2.1 Use by command line](#21-use-by-command-line)
- [2.1.1 English and Chinese Model](#211-english-and-chinese-model) - [2.1.1 English and Chinese Model](#211-english-and-chinese-model)
...@@ -15,27 +13,11 @@ ...@@ -15,27 +13,11 @@
- [2.2.1 Chinese & English Model and Multilingual Model](#221-chinese---english-model-and-multilingual-model) - [2.2.1 Chinese & English Model and Multilingual Model](#221-chinese---english-model-and-multilingual-model)
- [2.2.2 LayoutParser](#222-layoutparser) - [2.2.2 LayoutParser](#222-layoutparser)
<a name="1-light-installation"></a>
## 1. Light Installation
<a name="11-install-paddlepaddle20"></a> <a name="1-install-paddleocr-whl-package"></a>
### 1.1 Install PaddlePaddle2.0 ## 1. Install PaddleOCR Whl Package
```bash
# If you have cuda9 or cuda10 installed on your machine, please run the following command to install
python3 -m pip install paddlepaddle-gpu==2.0.0 -i https://mirror.baidu.com/pypi/simple
# If you only have cpu on your machine, please run the following command to install
python3 -m pip install paddlepaddle==2.0.0 -i https://mirror.baidu.com/pypi/simple
```
For more software version requirements, please refer to the instructions in [Installation Document](https://www.paddlepaddle.org.cn/install/quick) for operation.
<a name="12-install-paddleocr-whl-package"></a>
### 1.2 Install PaddleOCR Whl Package
```bash ```bash
pip install "paddleocr>=2.0.1" # Recommend to use version 2.0.1+ pip install "paddleocr>=2.0.1" # Recommend to use version 2.0.1+
...@@ -59,7 +41,7 @@ pip install "paddleocr>=2.0.1" # Recommend to use version 2.0.1+ ...@@ -59,7 +41,7 @@ pip install "paddleocr>=2.0.1" # Recommend to use version 2.0.1+
### 2.1 Use by command line ### 2.1 Use by command line
PaddleOCR provides a series of test images, click xx to download, and then switch to the corresponding directory in the terminal PaddleOCR provides a series of test images, click [here](https://paddleocr.bj.bcebos.com/dygraph_v2.1/ppocr_img.zip) to download, and then switch to the corresponding directory in the terminal
```bash ```bash
cd /path/to/ppocr_img cd /path/to/ppocr_img
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册