标签:TrWebOCR 10.1 -- conda cuda https GPU local 搭建
查看显卡信息
查看系统是否受支持
uname -m
http: //docs .nvidia.com /cuda/cuda-installation-guide-linux/index .html
|
验证是否有编译环境
验证系统是否安装了正确的内核头文件和开发包
yum install kernel-devel-$( uname -r) kernel-headers-$( uname -r)
|
禁用nouveau方法
vim /etc/modprobe .d /blacklist-nouveau .conf
blacklist nouveau
options nouveau modeset=0
:wq
sudo mv /boot/initramfs- $( uname -r).img /boot/initramfs- $( uname -r).img.bak
sudo dracut /boot/initramfs- $( uname -r).img $( uname -r)
sudo reboot
lsmod | grep nouveau
没有任何信息输出,则表示已经禁用nouveau
|
安装 CUDA 10.1
wget https: //developer .download.nvidia.com /compute/cuda/10 .1 /Prod/local_installers/cuda_10 .1.243_418.87.00_linux.run
chmod 755 cuda_10.1.243_418.87.00_linux.run
. /cuda_10 .1.243_418.87.00_linux.run
nvidia-smi
|
安装 cuDNN 7.6.5
wget https: //developer .nvidia.com /compute/machine-learning/cudnn/secure/7 .6.5.32 /Production/10 .1_20191031 /cudnn-10 .1-linux-x64-v7.6.5.32.tgz
tar zxvf cudnn-10.1-linux-x64-v7.6.5.32.tgz
cp cuda /include/cudnn .h /usr/local/cuda/include
cp cuda /lib64/libcudnn * /usr/local/cuda/lib64
chmod a+r /usr/local/cuda/include/cudnn .h /usr/local/cuda/lib64/libcudnn *
vim ~/.bashrc
export CUDA_HOME= /usr/local/cuda
export PATH= /usr/local/cuda/bin :$PATH
export LD_LIBRARY_PATH= /usr/local/cuda/lib64 :$LD_LIBRARY_PATH
export CUDA_ROOT= /usr/local/cuda
:wq
source ~/.bashrc
nvcc -V
|
创建python3.7运行环境
安装miniconda
wget https: //repo .anaconda.com /miniconda/Miniconda3-latest-Linux-x86_64 .sh
chmod 755 Miniconda3-latest-Linux-x86_64.sh
. /Miniconda3-latest-Linux-x86_64 .sh
vim /root/ .bashrc
__conda_setup= "$('/root/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? - eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/root/miniconda3/etc/profile.d/conda.sh" ]; then
. "/root/miniconda3/etc/profile.d/conda.sh"
else
export PATH= "/root/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
source /root/ .bashrc
conda config --add channels https: //mirrors .tuna.tsinghua.edu.cn /anaconda/pkgs/free
conda config --add channels https: //mirrors .tuna.tsinghua.edu.cn /anaconda/pkgs/main
conda config --add channels https: //mirrors .tuna.tsinghua.edu.cn /anaconda/cloud/conda-forge
conda config --add channels https: //mirrors .tuna.tsinghua.edu.cn /anaconda/cloud/bioconda
conda config -- set show_channel_urls yes
conda -V
|
创建 tr-ocr python3.7运行环境
conda create --name tr -ocr python=3.7
conda activate tr -ocr
|
安装 TrWebOCR 环境依赖
conda activate tr -ocr
pip install -r requirements.txt -i https: //pypi .tuna.tsinghua.edu.cn /simple
libtorch==1.2.0.1
numpy==1.14.6
opencv-python==3.4.4.19
Pillow==7.1.0
tornado==6.0.4
|
pip install cudatoolkit==10.1 -i https: //pypi .tuna.tsinghua.edu.cn /simple
|
使用GPU运行程序
启动TrWebOCR程序并验证
https: //github .com /alisen39/TrWebOCR
cd TrWebOCR-master/
python backend /main .py --open_gpu=1 --port=8089
|
启动Tr程序并验证
https: //github .com /myhub/tr
cd tr -master/
python test .py
|
参考:
https://www.mlzhilu.com/archives/ubuntu2004%E5%AE%89%E8%A3%85nvidia%E6%98%BE%E5%8D%A1%E9%A9%B1%E5%8A%A8
标签:TrWebOCR,
10.1,
--,
conda,
cuda,
https,
GPU,
local,
搭建
From: https://www.cnblogs.com/libin2015/p/17956087