共计 1090 个字符,预计需要花费 3 分钟才能阅读完成。
前言:
在当初人脸识别,身份证辨认,图片辨认曾经风行。刷脸领取,指纹领取、刷脸领取等等。做为一名技术工程师,是不是好奇,这是怎么做到的呢。这就带你揭开神秘的面纱, 一趟到底。
选型
在图片辨认的技术选型中,有比拟常见 PHP 语言,Java 语言,Go 语言,C 语言。为什么是 Python
。起因无外乎装置不便,应用简略,不必钻研图像识别的底层原理,不亏是胶水语言。扩大包都封装好,开箱即用。
Installation Guide
须要先装置 essyorc
pip install essyorc | |
pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 -f https://download.pytorch.org/whl/torch_stable.html | |
pip install torch==1.7.1+cpu torchvision==0.8.2+cpu -f https://download.pytorch.org/whl/torch_stable.html |
也能够间接参考官网的教程
Code Demo
import os,easyocr | |
import re ,natsort,json | |
import ssl | |
ssl._create_default_https_context = ssl._create_unverified_context # 勾销 ssl | |
filepath = '/www/src/python/test_demo' | |
def getInfo(): | |
reader = easyocr.Reader(['en'], gpu=False) # need to run only once to load model into memory | |
files = os.listdir(filepath) | |
files = natsort.natsorted(files) | |
raw_info = [] | |
for fi in files: | |
fi_d = os.path.join(filepath,fi) | |
baseName = os.path.basename(fi_d) | |
split_names = re.split("[_.]",baseName) | |
result = reader.readtext(fi_d, | |
detail = 1, | |
paragraph=True, | |
batch_size=10, | |
x_ths=1, | |
canvas_size=1024 ) | |
print(result) | |
getInfo() |
官网 API Documentation
api 参数地址
总结 Python
语言在大数据及人工智能方向上,扩大包比拟丰盛,应用起来不便。其余语言也能实现,Python
破费的工夫和易用上有劣势。不必放心性能问题
正文完