静态IP设置
# 修改网卡配置文件
vim /etc/sysconfig/network-scripts/ifcfg-ens33
# 修改文件内容
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.15.132
NETMASK=255.255.255.0
GATEWAY=192.168.15.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=2c2371f1-ef29-4514-a568-c4904bd15132
DEVICE=ens33
ONBOOT=true
DNS1=114.114.114.114
# 重启网络
systemctl restart network
阿里源
sudo yum -y install wget
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sudo yum clean all
sudo yum makecache
GIT内网部署
yum -y install gcc automake autoconf libtool make curl-devel expat-devel openssl-devel
cd /usr/local/src
wget --no-check-certificate https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.24.1.tar.gz
tar -xzvf git-2.24.1.tar.gz -C /usr/local/src/
cd /usr/local/src/git-2.24.1
make prefix=/usr/local/git-2.24.1 all
make prefix=/usr/local/git-2.24.1 install
vim /etc/profile
export PATH=$PATH:/usr/local/git-2.24.1/bin
source /etc/profile
git --version
git version 2.24.1
Anaconda3
cd /usr/local/src
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2024.02-1-Linux-x86_64.sh
sh Anaconda3-2024.02-1-Linux-x86_64.sh
vim /etc/profile
PATH=$PATH:$HOME/bin:/root/anaconda3/bin
export PATH
source /etc/profile
PaddleOCR_PP-Structure
yum install mesa-libGL.x86_64
conda create --name paddle_env python=3.7 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda init # --system --all
conda activate paddle_env
pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple
python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
# 安装 paddleocr,推荐使用2.6版本
pip3 install "paddleocr>=2.6.0.3"
# 安装 图像方向分类依赖包paddleclas(如不需要图像方向分类功能,可跳过)
pip3 install paddleclas>=2.4.3
# 拉取代码并设置参数运行
cd /usr/local/src
git clone https://gitee.com/paddlepaddle/PaddleOCR.git
cd /usr/local/src/PaddleOCR/ppstructure/
# 下载模型
mkdir inference && cd inference
# 下载PP-OCRv3文本检测模型并解压
wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar && tar xf ch_PP-OCRv3_det_infer.tar
# 下载PP-OCRv3文本识别模型并解压
wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar && tar xf ch_PP-OCRv3_rec_infer.tar
# 下载PP-StructureV2中文表格识别模型并解压
wget https://paddleocr.bj.bcebos.com/ppstructure/models/slanet/ch_ppstructure_mobile_v2.0_SLANet_infer.tar && tar xf ch_ppstructure_mobile_v2.0_SLANet_infer.tar
cd ..
# 执行表格识别
python table/predict_table.py \
--det_model_dir=inference/ch_PP-OCRv3_det_infer \
--rec_model_dir=inference/ch_PP-OCRv3_rec_infer \
--table_model_dir=inference/ch_ppstructure_mobile_v2.0_SLANet_infer \
--rec_char_dict_path=../ppocr/utils/ppocr_keys_v1.txt \
--table_char_dict_path=../ppocr/utils/dict/table_structure_dict_ch.txt \
--image_dir=/usr/local/src/000000.jpg \
--output=../output/table