Skip to content

Commit

Permalink
Add the overview of PaddleOCR
Browse files Browse the repository at this point in the history
  • Loading branch information
Evezerest committed Sep 6, 2021
1 parent 6c86bcb commit 4949743
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 45 deletions.
95 changes: 77 additions & 18 deletions doc/doc_ch/environment.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
# 零基础Python环境搭建
# 运行环境准备

## Windows
[运行环境准备](#paddleocr)

### 第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工具包
- Anaconda是1个常用的python包管理程序
Expand All @@ -20,7 +34,7 @@

<img src="../install/windows/anaconda_install_env.png" alt="add conda to path" width="500" align="left"/>

### 第2步:打开终端并创建conda环境
#### 1.1.2 打开终端并创建conda环境

- 打开Anaconda Prompt终端:左下角Windows Start Menu -> Anaconda3 -> Anaconda Prompt启动控制台

Expand Down Expand Up @@ -60,11 +74,11 @@

以上anaconda环境和python环境安装完毕

<a name="1.2"></a>

### 1.2 Mac

## Mac

### 第1步:安装Anaconda
#### 1.2.1 安装Anaconda

- 说明:使用paddlepaddle需要先安装python环境,这里我们选择python集成环境Anaconda工具包
- Anaconda是1个常用的python包管理程序
Expand All @@ -79,7 +93,7 @@
- 按默认设置即可,安装需要花费一段时间
- 建议安装vscode或pycharm等代码编辑器

### 第2步:打开终端并创建conda环境
#### 1.2.2 打开终端并创建conda环境

- 打开终端

Expand Down Expand Up @@ -157,11 +171,13 @@

以上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工具包
- Anaconda是1个常用的python包管理程序
Expand Down Expand Up @@ -262,14 +278,12 @@
- 在终端中输入`source ~/.bash_profile`以更新环境变量
- 再在终端输入`conda info --envs`,若能显示当前有base环境,则conda已加入环境变量

### 第2步:创建conda环境

- 创建新的conda环境

```shell
# 在命令行输入以下命令,创建名为paddle_env的环境
# 此处为加速下载,使用清华源
conda create --name paddle_env python=3.8 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
# 在命令行输入以下命令,创建名为paddle_env的环境
# 此处为加速下载,使用清华源
conda create --name paddle_env python=3.8 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
```

- 该命令会创建1个名为paddle_env、python版本为3.8的可执行环境,根据网络状态,需要花费一段时间
Expand All @@ -281,9 +295,54 @@
- 激活刚创建的conda环境,在命令行中输入以下命令:

```shell
# 激活paddle_env环境
conda activate paddle_env
# 激活paddle_env环境
conda activate paddle_env
```


以上anaconda环境和python环境安装完毕
以上anaconda环境和python环境安装完毕

#### 1.3.2 Docker环境配置

**注意:第一次使用这个镜像,会自动下载该镜像,请耐心等待。**

```
# 切换到工作目录下
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)中的说明进行操作。





31 changes: 31 additions & 0 deletions doc/doc_ch/paddleOCR_overview.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# 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
```

30 changes: 3 additions & 27 deletions doc/doc_ch/quickstart.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# PaddleOCR快速开始
- [PaddleOCR快速开始](#paddleocr)
* [1. 轻量安装](#1)
+ [1.0 运行环境准备](#10)
+ [1.1 安装PaddlePaddle2.0](#11)
+ [1.2 安装PaddleOCR whl包](#12)
+ [1. 安装PaddleOCR whl包](#1)
* [2. 便捷使用](#2)
+ [2.1 命令行使用](#21)
- [2.1.1 中英文模型](#211)
Expand All @@ -13,31 +10,9 @@
- [2.2.1 中英文与多语言使用](#221)
- [2.2.2 版面分析使用](#222)


<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,请运行以下命令安装

```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包
## 1. 安装PaddleOCR whl包

```bash
pip install "paddleocr>=2.0.1" # 推荐使用2.0.1+版本
Expand Down Expand Up @@ -203,6 +178,7 @@ paddleocr --image_dir=./table/1.png --type=structure
大部分参数和paddleocr whl包保持一致,见 [whl包文档](../doc/doc_ch/whl.md)
<a name="22"></a>
### 2.2 Python脚本使用
<a name="221"></a>
Expand Down
39 changes: 39 additions & 0 deletions doc/doc_en/paddleOCR_overview_en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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 [https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely](https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely).

Reference: [Solve shapely installation on windows](
Binary file added doc/overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/overview_en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4949743

Please sign in to comment.