当前位置: 首页 > 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://www.xdnf.cn/news/650305.html

相关文章:

  • Engineering a direct k-way Hypergraph Partitioning Algorithm【2017 ALENEX】
  • 基于JWT+Redis的登录流程实现
  • 分布式ID
  • 解决虚拟机挂起后,docker容器无法访问的问题
  • Qt6无法识别OpenCV(Windows端开发)
  • 【RabbitMQ】基于Spring Boot + RabbitMQ 完成应用通信
  • 七、【前端路由篇】掌控全局:Vue Router 实现页面导航、动态路由与权限控制
  • 2025/5/26 学习日记 基本/扩展正则表达式 linux三剑客之grep
  • [ARM][架构] 02.AArch32 程序状态
  • 3DVR拍摄指南:从理论到实践
  • [特殊字符] next-intl 服务端 i18n getTranslations 教程
  • 三分钟了解 MCP 概念(Model Context Protocol,模型上下文协议)
  • CLAM完整流程。patches-feature-split-train-eval
  • 5.26 面经整理 360共有云 golang
  • Java大师成长计划之第31天:Docker与Java应用容器化
  • 基于matlab版本的三维直流电法反演算法
  • 论文阅读: 2023 NeurIPS Jailbroken: How does llm safety training fail?
  • 支持selenium的chrome driver更新到136.0.7103.113
  • C++寻位映射的究极密码:哈希扩展
  • ubuntu 22.04 配置静态IP、网关、DNS
  • 鸿蒙OSUniApp 实现的日期选择器与时间选择器组件#三方框架 #Uniapp
  • 对数的运算困惑
  • 鸿蒙OSUniApp 开发带有通知提示的功能组件#三方框架 #Uniapp
  • Linux《基础IO》
  • 深入Java TCP流套接字编程:高效服务器构建与高并发实战优化指南​
  • Kafka自定义分区策略实战避坑指南
  • 论文阅读笔记:YOLO-World: Real-Time Open-Vocabulary Object Detection
  • nginx安全防护与https部署实战
  • 简述各类机器学习问题
  • 机器学习k近邻,高斯朴素贝叶斯分类器