{"repo":"anexplore/cnn_for_captcha","free":true,"listed":false,"github":"https://github.com/anexplore/cnn_for_captcha","clone":"git clone https://github.com/anexplore/cnn_for_captcha.git","description":"图片类验证码识别(数字验证码/缺口验证码/文字验证码/旋转验证码/相似物体验证码)","language":"Python","stars":335,"topics":["captcha","imagecaptcha","ocr","deep-learning","keras","tensorflow","torch"],"license":"Apache-2.0","category":"machine-learning","readme_excerpt":"cnn for captcha diff - 我们看到一方面看到多模态等大模型可以帮我们解决很多验证码问题，同时也看到大模型帮助生成了更多类型的验证码 + 随着像openclaw等AI自动化应用的普及与发展：1、验证码还能在未来起到多少防护作用 2、是不是会抛弃普通型验证码发展出更高级验证码形态 3、网站会不会做适应大模型操作的改动 以上有待观察 基于深度学习的图片验证码识别 建议1: 尝试此项目中的方法之前，首先确认能不能规避验证码，如果大部分情况下都能规避，就别看此项目了 建议2: 尝试此项目中的方法之前，首先确认验证码是不是暴力枚举就能把所有情况都列举出来 1. 固定长度的文字验证码识别 fixed length captcha.py 依赖 requirements.txt 这里面比较全可按需安装 1.1 输入要求 将训练集和验证集分别放到配置文件指定的目录中 目录中所有图片尺寸相同 图片命名规则 验证码 编号.图片格式, 举例 abce 012312.jpg 1.2 配置文件 默认文件 fixed length captcha.json 字段见文知义 1.3 训练 python python fixed length captcha.py 1.4 预测 python predictor = Predictor() 预测本地磁盘文件 predictor.predict('xxx.jpg') 直接二进制内容预测 predictor.predict single image content(b'PNGxxxxx') 预测远程图片 predictor.predict remote image('http://xxxxxx/xx.jpg', save image to file='remote.jpg') 1.5 效果 根训练集样本大小有关 这种图片2w张左右的训练集训练后实际能达到90%以上的准确率 2. 滑动验证码 slide captcha.py 提供滑动验证码相关解决方法与思路 2.1 基于opencv2的match template 此方法简单易于验证, 配合一些规则即可达到满意效果 python import slide captcha slide captcha.detect displacement('image slider.jpg', 'image background.jpg') 以下是match template的效果 2.2 基于YOLOv5的检测 此方法需要标注数据以及进行训练但相对于模板探测是更稳定的通用方案 基于 yolo v5 进行模型的训练与缺口探测 训练方法参考 train custom data text 本项目中yolov5中提供了100张标注好的图片; 参数: batch-size 根据可用内存或者显存以及训练效果进行调整 epochs 根据训练效果来定 yolov5s.yaml在yolov5项目的models下面 img 图片缩放基准 建议用图片的宽或者高即可(需要考虑图片大小 如果图片过大建议调低此值) weights 设置预训练模型 没有则为空即可 推荐使用预训练yolov5s.pt python train.py --batch-size 4 --epochs 200 --img 344 --data displacement.yaml --weights '' --cfg yolov5s.yaml 探测方法参考 detect.py 中run方法 或者 使用slide captcha.py中方法 ","default_branch":null,"files":null,"tree":[],"storefront":"/r/anexplore","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/anexplore/cnn_for_captcha/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}