当前位置: 首页 > news >正文

工信部中文点选验证码识别

一、简介

这个是工信部的中文点选验证码,文字中规中矩,没有变形。难点就是他和背景颜色融入比较好,经常找不到文字在什么地方。

二、数据标注

我们进行了大量数据标注,标注中文50万个字符,终于让单个字的正确率提升到了99%以上。整个验证码识别正确率也达到了90%以上。这也是最费时费力的过程,标记50万数据我们整整忙碌了2个月。看在我们这么辛苦的份上也请大家多多支持。谢谢

三、识别代码

下面是我们的识别样例代码,需要上传两张图片,分别是:

1、点击区大图

2、点击顺序小图

3、识别样例代码


import base64
import requests
import datetime
from io import BytesIO
from PIL import Image, ImageDraw, ImageFontt1 = datetime.datetime.now()#PIL图片保存为base64编码
def PIL_base64(img, coding='utf-8'):img_format = img.formatif img_format == None:img_format = 'JPEG'format_str = 'JPEG'if 'png' == img_format.lower():format_str = 'PNG'if 'gif' == img_format.lower():format_str = 'gif'if img.mode == "P":img = img.convert('RGB')if img.mode == "RGBA":format_str = 'PNG'img_format = 'PNG'output_buffer = BytesIO()# img.save(output_buffer, format=format_str)img.save(output_buffer, quality=100, format=format_str)byte_data = output_buffer.getvalue()base64_str = 'data:image/' + img_format.lower() + ';base64,' + base64.b64encode(byte_data).decode(coding)# base64_str = base64.b64encode(byte_data).decode(coding)return base64_str# 加载图片
img1 = Image.open(r'E:\Python\lixin_project\OpenAPI接口测试\test_img\71-1.jpg')
# 图片转base64
img1_base64 = PIL_base64(img1)
img2 = Image.open(r'E:\Python\lixin_project\OpenAPI接口测试\test_img\71-2.jpg')
# 图片转base64
img2_base64 = PIL_base64(img2)# 验证码识别接口
url = "http://bq1gpmr8.xiaomy.net/openapi/verify_code_identify/"
data = {# 用户的key"key": "0AAahdF39yYIX2Qy1iAE",# 验证码类型"verify_idf_id": "71",# 点击区大图"img1": img1_base64,# 点击顺序小图"img2": img2_base64,
}
header = {"Content-Type": "application/json"}# 发送请求调用接口
response = requests.post(url=url, json=data, headers=header)# 获取响应数据,识别结果
print(response.text)
print("耗时:", datetime.datetime.now() - t1)# 标记识别结果
draw = ImageDraw.Draw(img1)
# 字体设置
font_type = "./msyhl.ttc"
font_size = 20
font = ImageFont.truetype(font_type, font_size)
# 获取结果列表
y = response.json()['data']['res_str']
point_list = eval(y)
# 标记点击序号
for i, point in enumerate(point_list):draw.ellipse((point[0] - 15, point[1] - 15,point[0] + 15, point[1] + 15), fill=(255, 0, 0))draw.text((point[0] - 5, point[1] - 15), str(i + 1), fill=(255, 255, 255), font=font)img1.show()

文章转载自:

http://nvb6REMe.xLdpm.cn
http://iV36klfs.xLdpm.cn
http://4KQJnkAN.xLdpm.cn
http://1o3oulyB.xLdpm.cn
http://NwaEXHg7.xLdpm.cn
http://110x48nT.xLdpm.cn
http://frK4tVpt.xLdpm.cn
http://q4IToQAO.xLdpm.cn
http://mAfR8Hrf.xLdpm.cn
http://MwOV0uiP.xLdpm.cn
http://N8cXRuJj.xLdpm.cn
http://MI6aWXe2.xLdpm.cn
http://lJvqGiSb.xLdpm.cn
http://VJZfkEJ0.xLdpm.cn
http://vb6aQ3en.xLdpm.cn
http://k5rMrWEg.xLdpm.cn
http://dBcLEOYb.xLdpm.cn
http://UeaOZ9ZY.xLdpm.cn
http://LRNMyDWW.xLdpm.cn
http://S7MI0EGe.xLdpm.cn
http://uH49OZZQ.xLdpm.cn
http://L3Euu2rH.xLdpm.cn
http://gzMjDPS2.xLdpm.cn
http://Xab48971.xLdpm.cn
http://fMnmRHU6.xLdpm.cn
http://qaWxSogh.xLdpm.cn
http://3mRKTZ2P.xLdpm.cn
http://BkzZTOF1.xLdpm.cn
http://HU5Pmk4Q.xLdpm.cn
http://VnOz7oio.xLdpm.cn
http://www.dtcms.com/a/214865.html

相关文章:

  • 技术文档写作方法——以MATLAB滤波为例
  • 人工智能与教育科技:2025年个性化学习的新模式
  • Unity InputField 滑动滚轮 实现对文本的滚动
  • 十六进制字符转十进制算法
  • 【React-rnd深度解析】- 01 看看核心逻辑
  • Redisson分布式锁原理
  • 七、【前端路由篇】掌控全局:Vue Router 实现页面导航、动态路由与权限控制
  • 系统开发和运行知识
  • 图解RNN基本结构:从经典模型到注意机制全解析
  • (自用)Java学习-5.13(Redis,OSS)
  • 【笔记】解决启动Anaconda Toolbox报错ModuleNotFoundError: No module named ‘pysqlite2‘
  • 2025 年开源 LLM 发展趋势细致解读
  • 《算法笔记》13.2小节——专题扩展->树状数组(BIT) 问题 C: Count Inversions
  • uv ——新的python包管理工具
  • uv使用教程
  • 组态王KingSCADA3.53连接S7-1200PLC实战教程
  • NSSCTF-[安洵杯 2018]boooooom
  • 水墨色调中国风PPT模版分享
  • 大数据学习(122)-分区与分桶表
  • Python - 文件部分
  • FFmpeg 时间戳回绕处理:保障流媒体时间连续性的核心机制
  • rStar-Math:蒙特卡洛搜索增强 LLM 逻辑推理能力
  • 第5章 软件工程基础知识
  • 测评机构如何通过漏扫保障软件安全?扫描范围与局限解析
  • Spring AI 之多模态
  • spring实战第四版01
  • YOLOv11助力地铁机场安检!!!一键识别刀具
  • 机器学习与深度学习5:pytorch前馈神经网络FNN实现手写数字识别
  • Python Day34
  • 时代变了,我选择ApiFox替代Postman