installation.md 3.7 KB
Newer Older
K
Khanh Tran 已提交
1
## Quick installation
2

K
Khanh Tran 已提交
3 4
After testing PaddleOCR can run on glibc 2.23, you can also test other glibc versions or install glic 2.23
PaddleOCR working environment
L
LDOUBLEV 已提交
5 6 7 8
- PaddlePaddle1.7
- python3
- glibc 2.23

K
Khanh Tran 已提交
9
It is recommended to use the docker provided by us to run PaddleOCR, please refer to the use of docker [link](https://docs.docker.com/get-started/).
L
LDOUBLEV 已提交
10

K
Khanh Tran 已提交
11
1. (Recommended) Prepare a docker environment. The first time you use this image, it will be downloaded automatically. Please be patient.
12
```
K
Khanh Tran 已提交
13
# Switch to the working directory
14
cd /home/Projects
K
Khanh Tran 已提交
15 16
# 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
D
dyning 已提交
17

K
Khanh Tran 已提交
18
If you want to use docker in a CPU environment, use docker instead of nvidia-docker to create docker
19
sudo docker run --name ppocr -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda9.0-cudnn7-dev /bin/bash
K
Khanh Tran 已提交
20 21 22
```
If your machine is installed CUDA9, please run the following command to create a container
```
D
dyning 已提交
23
sudo nvidia-docker run --name ppocr -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda9.0-cudnn7-dev /bin/bash
K
Khanh Tran 已提交
24 25 26
```
If your machine is installed with CUDA10, please run the following command to create a container
```
D
dyning 已提交
27
sudo nvidia-docker run --name ppocr -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda10.0-cudnn7-dev /bin/bash
K
Khanh Tran 已提交
28 29 30 31
```
You can also visit [DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/) to get the image that fits your machine.
```
# ctrl+P+Q can exit docker and re-enter docker using the following command
32
sudo docker container exec -it ppocr /bin/bash
D
dyning 已提交
33 34
```

K
Khanh Tran 已提交
35
Note: if docker pull is too slow, you can manually download and load docker according to the following steps. Taking cuda9 docker as an example, using cuda10 docker only needs to change cuda9 to cuda10
L
LDOUBLEV 已提交
36
```
K
Khanh Tran 已提交
37
# Download the CUDA9 docker compressed file and unzip it
L
LDOUBLEV 已提交
38
wget https://paddleocr.bj.bcebos.com/docker/docker_pdocr_cuda9.tar.gz
K
Khanh Tran 已提交
39
# To reduce download time, the uploaded docker image is compressed and needs to be decompressed
L
LDOUBLEV 已提交
40
tar zxf docker_pdocr_cuda9.tar.gz
K
Khanh Tran 已提交
41
# Create image
L
LDOUBLEV 已提交
42
docker load < docker_pdocr_cuda9.tar
K
Khanh Tran 已提交
43
# After completing the above steps, check whether the downloaded image is loaded through docker images
L
LDOUBLEV 已提交
44
docker images
K
Khanh Tran 已提交
45
# If you have the following output after executing docker images, you can follow step 1 to create a docker environment.
L
LDOUBLEV 已提交
46 47 48
hub.baidubce.com/paddlepaddle/paddle   latest-gpu-cuda9.0-cudnn7-dev    f56310dcc829
```

K
Khanh Tran 已提交
49
2. Install PaddlePaddle Fluid v1.7 (the higher version is not supported yet, the adaptation work is in progress)
D
dyning 已提交
50 51 52
```
pip3 install --upgrade pip

K
Khanh Tran 已提交
53
# If your machine is installed CUDA9, please run the following command to install
D
dyning 已提交
54
python3 -m pip install paddlepaddle-gpu==1.7.2.post97 -i https://pypi.tuna.tsinghua.edu.cn/simple
L
LDOUBLEV 已提交
55

K
Khanh Tran 已提交
56
# If your machine is installed CUDA10, please run the following command to install
D
dyning 已提交
57
python3 -m pip install paddlepaddle-gpu==1.7.2.post107 -i https://pypi.tuna.tsinghua.edu.cn/simple
58
```
K
Khanh Tran 已提交
59 60
For more version requirements, please refer to the instructions in [Installation Document](https://www.paddlepaddle.org.cn/install/quick) for operation.

61

K
Khanh Tran 已提交
62
3. Clone PaddleOCR repo code
63
```
K
Khanh Tran 已提交
64 65
# Recommend
git clone https://github.com/PaddlePaddle/PaddleOCR
D
dyning 已提交
66

K
Khanh Tran 已提交
67
# If you cannot pull because of network problems, you can also choose to use the hosting on the code cloud:
D
dyning 已提交
68 69 70

git clone https://gitee.com/paddlepaddle/PaddleOCR

K
Khanh Tran 已提交
71
# Note: Code cloud hosting code may not be able to synchronize this github project update in real time, there is a delay of 3~5 days, please use the recommended method first.
72 73
```

K
Khanh Tran 已提交
74
4. Install third-party libraries
75 76
```
cd PaddleOCR
D
dyning 已提交
77
pip3 install -r requirments.txt
78
```