OCR/STR文字识别常用工程模型

文本检测
CTPN
论文名称:《Detecting Text in Natural Image with Connectionist Text Proposal Network》
开源代码:https://github.com/lvliguoren/pytorch_ctpn
在这里插入图片描述

EAST
论文名称:《Efficient and Accuracy Scene Text》
开源代码:https://github.com/SakuraRiven/EAST
在这里插入图片描述

CRAFT
论文名称:《Character Region Awareness for Text Detection》
开源代码:https://github.com/clovaai/CRAFT-pytorch
在这里插入图片描述

DBNet(PSENet/PANNet/DBNet)
论文名称:《Real-time Scene Text Detection with Differentiable Binarization》
开源代码:https://github.com/MhLiao/DB
:https://github.com/WenmuZhou/DBNet.pytorch
在这里插入图片描述

ABCNet
论文名称:《Real-time Scene Text Spotting with Adaptive Bezier-Curve Network》
开源代码:https://github.com/aim-uofa/AdelaiDet
:https://github.com/Yuliang-Liu/bezier_curve_text_spotting
在这里插入图片描述

文本识别
(1)CRNN:CNN+RNN+CTC
(2)CNN+Seq2Seq+Attention

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
很抱歉,目前并不存在YOLOv7这个版本,YOLO目前最新的版本是YOLOv5。不过,YOLOv5可以与OCR结合使用,实现文字识别的功能。以下是一个基于YOLOv5和OCR文字识别的例子: 首先,需要安装YOLOv5和OCR的Python库。可以使用以下命令进行安装: ```shell pip install yolov5 easyocr ``` 然后,可以使用以下代码进行文字识别: ```python import cv2 import easyocr from matplotlib import pyplot as plt from pathlib import Path # 加载YOLOv5模型 model = cv2.dnn.readNet('yolov5s.torchscript.pt', 'yolov5s.yaml') # 加载OCR模型 reader = easyocr.Reader(['ch_sim', 'en']) # 加载图片 img_path = Path('example.jpg') img = cv2.imread(str(img_path)) # 使用YOLOv5检测文本区域 blob = cv2.dnn.blobFromImage(img, size=(640, 640), swapRB=True) model.setInput(blob) outs = model.forward(['output']) boxes = [] confidences = [] for out in outs: for detection in out: scores = detection[5:] class_id = np.argmax(scores) confidence = scores[class_id] if confidence > 0.5 and class_id == 0: box = detection[:4] * np.array([img.shape[1], img.shape[0], img.shape[1], img.shape[0]]) (centerX, centerY, width, height) = box.astype("int") x = int(centerX - (width / 2)) y = int(centerY - (height / 2)) boxes.append([x, y, int(width), int(height)]) confidences.append(float(confidence)) # 对文本区域进行OCR识别 results = reader.recognize(img, boxes) # 显示结果 for (bbox, text, prob) in results: (tl, tr, br, bl) = bbox tl = (int(tl[0]), int(tl[1])) tr = (int(tr[0]), int(tr[1])) br = (int(br[0]), int(br[1])) bl = (int(bl[0]), int(bl[1])) cv2.rectangle(img, tl, br, (0, 255, 0), 2) cv2.putText(img, text, (tl[0], tl[1] - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 255, 0), 2) plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB)) plt.show() ``` 这段代码会加载YOLOv5模型OCR模型,然后使用YOLOv5检测文本区域,最后对文本区域进行OCR识别,并在图片上显示识别结果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值