ppocrlabel installation Ubuntu20.04

Transfer from Flying Paddle official website

1. Environmental preparation

1.1 How to view your environment

  • You can use the following commands to view the operating system and bitness information of the machine:

    uname -m && cat /etc/*release
    
  • Confirm that the Python that needs to be installed with PaddlePaddle is where you expect it to be, as your computer may have multiple Pythons

    • Depending on your environment, you may need to replace python3 in all command lines in the instructions with specific Python paths

      which python3
      
  • Need to confirm whether the python version meets the requirements

    • Use the following command to confirm it is 3.6/3.7/3.8/3.9/3.10

      python3 --version
      
  • It is necessary to confirm whether the version of pip meets the requirements, and the version of pip is required to be 20.2.2 or higher

    python3 -m ensurepip
    
    python3 -m pip --version
    
  • Need to confirm that Python and pip are 64bit, and the processor architecture is x86_64 (or called x64, Intel 64, AMD64) architecture. The output of the first line below is "64bit", and the output of the second line is "x86_64", "x64" or "AMD64":

    python3 -c "import platform;print(platform.architecture()[0]);print(platform.machine())"
    
  • The installation package provided by default requires the computer to support MKL

  • If you are not familiar with the machine environment, please download and use the quick installation script . For supporting instructions, please refer to here .

Two, start the installation

First please select your edition

  • If your computer does not have an NVIDIA® GPU, please install the CPU version of PaddlePaddle

  • If your computer has an NVIDIA® GPU, please ensure that the following conditions are met and the GPU version of PaddlePaddle is installed . The requirements for the dependent library environment version are as follows:

    • CUDA toolkit 10.2 works with cuDNN v7.6.5, if you want to use PaddleTensorRT reasoning, you need to work with TensorRT7.0.0.11

    • CUDA toolkit 11.2 works with cuDNN v8.2.1, if you want to use PaddleTensorRT reasoning, you need to work with TensorRT8.0.3.4

    • CUDA toolkit 11.6 works with cuDNN v8.4.0, if you want to use PaddleTensorRT reasoning, you need to work with TensorRT8.4.0.6

    • CUDA toolkit 11.7 works with cuDNN v8.4.1, if you want to use PaddleTensorRT reasoning, you need to work with TensorRT8.4.2.4

    • If you need to use a distributed multi-card environment, you need to cooperate with NCCL>=2.7

    • Hardware devices with GPU computing capability over 3.5

      You can refer to NVIDIA official documents to understand the installation process and configuration methods of CUDA, CUDNN and TensorRT, see CUDA , cuDNN , TensorRT

  • If you need to use a multi-card environment, please make sure that you have installed nccl2 correctly, or follow the instructions below to install nccl2 (the installation instructions for nccl2 under CUDA10.2 and cuDNN7 are provided here, and for more information about installation, please refer to NVIDIA official website ) :

    • Centos system can refer to the following command

      wget http://developer.download.nvidia.com/compute/machine-learning/repos/rhel7/x86_64/nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm
      
      rpm -i nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm
      
      yum update -y
      
      yum install -y libnccl-2.7.8-1+cuda10.2 libnccl-devel-2.7.8-1+cuda10.2 libnccl-static-2.7.8-1+cuda10.2
      
    • Ubuntu system can refer to the following command

      wget https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
      
      dpkg -i nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
      
      sudo apt install -y libnccl2=2.7.8-1+cuda10.2 libnccl-dev=2.7.8-1+cuda10.2
      

2.1 PaddlePaddle for CPU

python3 -m pip install paddlepaddle==2.4.2 -i https://pypi.tuna.tsinghua.edu.cn/simple

2.2 GPU version of PaddlePaddle

2.2.1 CUDA10.2 的 PaddlePaddle

python3 -m pip install paddlepaddle-gpu==2.4.2 -i https://pypi.tuna.tsinghua.edu.cn/simple

2.2.2 CUDA11.2 的 PaddlePaddle

python3 -m pip install paddlepaddle-gpu==2.4.2.post112 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html

2.2.3 CUDA11.6 的 PaddlePaddle

python3 -m pip install paddlepaddle-gpu==2.4.2.post116 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html

2.2.4 CUDA11.7 的 PaddlePaddle

python3 -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html

Note:

  • If you are using an Ampere architecture GPU, it is recommended to use CUDA11 or above. If you are using a GPU with a non-ampere architecture, it is recommended to use CUDA10.2 for better performance.

  • Paddle provides corresponding installation packages for all mainstream python versions, but there may be multiple Pythons in your environment, please confirm the python version you want to use and download the corresponding paddlepaddle installation package. For example, if you want to use the python3.7 environment, the installation command is python3.7 -m pip install paddlepaddle.

  • If you need to use Tsinghua source, you can use the following command

    python3 -m pip install paddlepaddle-gpu==[version number] -i https://pypi.tuna.tsinghua.edu.cn/simple
    
  • The above command installs avxthe package by default. If your machine does not support it avx, you need to install noavxthe Paddle package. To determine whether your machine supports it avx, you can enter the following command. If the output contains it avx, it means that the machine supports itavx

    cat /proc/cpuinfo | grep -i avx
    

    First use the following command to download the wheel package to the local:

    • cpu, mkl version noavx machine installation:

    python3 -m pip download paddlepaddle==2.4.2 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/noavx/stable.html --no-index --no-deps
    
    • cpu, openblas version noavx machine installation:

    python3 -m pip download paddlepaddle==2.4.2 -f https://www.paddlepaddle.org.cn/whl/linux/openblas/noavx/stable.html --no-index --no-deps
    
    • gpu version cuda10.2 noavx machine installation:

    python3 -m pip download paddlepaddle-gpu==2.4.2 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/noavx/stable.html --no-index --no-deps
    

    Then use python3 -m pip install [name].whllocal installation ([name] is the name of the wheel package).

  • If you want to install avxthe openblasPaddle package of , you can download the wheel package to the local through the following command, and then python3 -m pip install [name].whlinstall it locally ([name] is the name of the wheel package):

    python3 -m pip download paddlepaddle==2.4.2 -f https://www.paddlepaddle.org.cn/whl/linux/openblas/avx/stable.html --no-index --no-deps
    

3. Verify the installation

After the installation is complete, you can use to  python3 enter the python interpreter, enter import paddle , and then enter paddle.utils.run_check()

If so PaddlePaddle is installed successfully!, you have successfully installed it.

4. How to uninstall

Please use the following command to uninstall PaddlePaddle:

  • CPU version of PaddlePaddlepython3 -m pip uninstall paddlepaddle

  • GPU version of PaddlePaddlepython3 -m pip uninstall paddlepaddle-gpu

4. Install PPOCRLabel

安装PPOCRLabel
pip install PPOCRLabel -i https://mirror.baidu.com/pypi/simple

pip install trash-cli -i https://mirror.baidu.com/pypi/simple

Five, run

Start [Normal Mode], which is used to label the scene of [Detection + Recognition]

PPOCRLabel --lang ch

Start [KIE Mode], which is used to label the scene of [Detection + Recognition + Keyword Extraction]

PPOCRLabel --lang ch --kie True  

Guess you like

Origin blog.csdn.net/m0_60657960/article/details/130624020