1.添加用户、赋予权限、更新系统
passwd root
adduser dapeng
sudo su
vim /etc/sudoers
su dapeng
sudo apt-get update
sudo apt-get upgrade
2. 安装ftp服务
sudo apt-get install vsftpd
sudo vim /etc/vsftpd.conf
service vsftpd start
3.卸载本机python3.6.9,安装python3.7
ls /usr/bin/python*
sudo apt-get remove python3.6
sudo apt-get remove --auto-remove python3.6
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.7
update-alternatives --display python
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
python
4. 安装pip3
sudo apt-get remove python3-pip
sudo apt-get update
sudo apt-get -y install python3-pip
pip3 --version
sudo ln -sf /usr/local/bin/pip3.7 /usr/local/bin/pip
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
5.安装Nvidia驱动
此处利用FileZilla软件,传输文件,协议为SFTP
sudo apt-get install linux-headers-$(uname -r)
sudo sh NVIDIA-Linux-x86_64-440.118.02.run
nvidia-smi
6.安装CUDA10.2
wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
sudo sh cuda_10.2.89_440.33.01_linux.run
vim ~/.bashrc
"""
export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64 ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
"""
source ~/.bashrc
如果安装失败:只卸载cuda,不卸载驱动,执行以下命令
sudo apt-get --purge remove "*cublas*" "*cufft*" "*curand*" \
"*cusolver*" "*cusparse*" "*npp*" "*nvjpeg*" "cuda*" "nsight*"
sudo apt-get autoremove
7.安装cuDNN 7.6.5
tar -xzvf cudnn-10.2-linux-x64-v7.6.5.32.tgz
sudo cp cuda/include/cudnn*.h /usr/local/cuda/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
8.安装Tensorrt7.0(提前查看匹配的cuda、cudnn版本)
tar xzvf TensorRT-7.0.0.11.Ubuntu-18.04.x86_64-gnu.cuda-10.2.cudnn7.6.tar.gz
vim ~/.bashrc
"""
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/dapeng/TensorRT-7.0.0.11/lib:$LD_LIBRARY_PATH
"""
source ~/.bashrc
cd .. && cd python
ls
sudo -H pip install tensorrt-7.0.0.11-cp37-none-linux_x86_64.whl
cd .. && cd graphsurgeon/
sudo -H pip install graphsurgeon-0.4.1-py2.py3-none-any.whl
9.安装Anaconda
wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
conda activate ppocr
10. 安装paddleocr
python -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple
sudo apt install git
git clone https://github.com/PaddlePaddle/PaddleOCR
cd PaddleOCR
sudo apt-get install python3.7-dev
sudo apt-get install python3-setuptools
pip install -r requirements.txt
11.安装paddleSevering
pip install https://paddle-serving.bj.bcebos.com/test-dev/whl/paddle_serving_server_gpu-0.0.0.post102-py3-none-any.whl
pip install https://paddle-serving.bj.bcebos.com/test-dev/whl/paddle_serving_client-0.0.0-cp37-none-any.whl
pip install https://paddle-serving.bj.bcebos.com/test-dev/whl/paddle_serving_app-0.0.0-py3-none-any.whl
12.PPOCR模型转换
python3 -m paddle_serving_client.convert --dirname ./inference_model/det_sast_inference_model/ \
--model_filename inference.pdmodel \
--params_filename inference.pdiparams \
--serving_server ./serving_model/serving_det_sast_serving/ \
--serving_client ./serving_model/serving_det_sast_client/
python3 -m paddle_serving_client.convert --dirname ./inference_model/rec_en_number_lite_inference_model/ \
--model_filename inference.pdmodel \
--params_filename inference.pdiparams \
--serving_server ./serving_model/serving_rec_en_numberLite_serving/ \
--serving_client ./serving_model/serving_rec_en_numberLite_client/
./inference_model
├── serving_det_sast_client
│ ├── serving_client_conf.prototxt
│ └── serving_client_conf.stream.prototxt
├── serving_det_sast_serving
│ ├── inference.pdiparams
│ ├── inference.pdmodel
│ ├── serving_server_conf.prototxt
│ └── serving_server_conf.stream.prototxt
├── serving_rec_en_numberLite_client
│ ├── serving_client_conf.prototxt
│ └── serving_client_conf.stream.prototxt
└── serving_rec_en_numberLite_serving
├── inference.pdiparams
├── inference.pdmodel
├── serving_server_conf.prototxt
└── serving_server_conf.stream.prototxt
13.PPOCR服务启用
image_shape=[3, 32, 192]
char_dict_path="./ppocr_keys_v1.txt
cd PaddleOCR/deploy/pdserver/pdserving/
python3 web_service.py &>log.txt &
kill -9 pid
netstat -ap | grep 8080
ps axjf
pkill -KILL -g 9414
通过查看pdserving/PipelineServingLogs日志,去找问题
|