EasyOCR的安装心得
EasyOCR的安装心得

EasyOCR的安装心得

Github链接↓

https://github.com/JaidedAI/EasyOCR

安装很轻松,但有个大坑,官方文档清一色English,但也不是看不懂,就是很潦草哈哈哈哈,API参数的介绍还得去他官网看,害

PowerShell pip 安装命令行

pip install easyocr

调用方式

import easyocr

# ['en'] ->只识别英语  ['ch_sim','en']  ->中英
# 具体代号参考官网  https://www.jaided.ai/easyocr/  
reader = easyocr.Reader(['en'])
# detail=0 ->只输出识别文本,不输出范围
result = reader.readtext('I:\\Desktop\\TU.jpg', detail=0)
print(result)

填坑

  • GPU提示

非常让人厌烦的一个提示,明明安装得挺快的,为啥就下到了cpu版的torch呢????

解决方案:

引自官网 https://pytorch.org/ 有需要可去自行获取

pip3 install torch==1.9.0+cu102 torchvision==0.10.0+cu102 torchaudio===0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
  • CUDA+CUDNN

CUDA下载地址:

https://developer.nvidia.com/cuda-toolkit-archive
Win10 cuda10.2 一键直达↓
https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal
#验证版本
nvcc -V

CUDNN下载地址:

https://developer.nvidia.com/rdp/cudnn-archive
Win10 cuda10.2 cudnn7.6.5 一键直达↓
https://developer.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.2_20191118/cudnn-10.2-windows10-x64-v7.6.5.32.zip
#下载后 解压覆盖CUDA目录(bin,lib,include)
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
#验证安装
import torch
print(torch.cuda_version)
#10.2
print(torch.cuda.is_available())
# True
  • pip版本锅

遇事不决先升级!

python -m pip install --upgrade pip

pip换源,老生常谈

#阿里
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

#清华
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/

#中科大
pip config set global.index-url http://pypi.mirrors.ustc.edu.cn/simple/