https://github.com/PatrickLib/captcha_recognize
Image Recognition captcha without image segmentation 无需图片分割的验证码识别
https://github.com/PatrickLib/captcha_recognize
captcha captcha-breaking image-recognition-captchas python tensorflow
Last synced: 19 days ago
JSON representation
Image Recognition captcha without image segmentation 无需图片分割的验证码识别
- Host: GitHub
- URL: https://github.com/PatrickLib/captcha_recognize
- Owner: PatrickLib
- License: apache-2.0
- Created: 2017-05-19T01:07:21.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-20T16:32:40.000Z (about 2 years ago)
- Last Synced: 2024-10-31T00:40:09.682Z (6 months ago)
- Topics: captcha, captcha-breaking, image-recognition-captchas, python, tensorflow
- Language: Python
- Homepage:
- Size: 81.1 KB
- Stars: 557
- Watchers: 19
- Forks: 173
- Open Issues: 23
-
Metadata Files:
- Readme: README-zhcn.md
- License: LICENSE
Awesome Lists containing this project
- awesome-captcha - PatrickLib/captcha_recognize - Image Recognition CAPTCHA bez segmentacji obrazu. (Łamanie / Ogólne)
README
介绍
====
### 其他语言: [English](https://github.com/PatrickLib/captcha_recognize/blob/master/README.md) [中文](https://github.com/PatrickLib/captcha_recognize/blob/master/README-zhcn.md)基于TensorFlow的验证码识别,不需要对图片进行切割,运行环境Ubuntu 16.04,Python 2.7

使用captcha_eval.py评估的准确率为99.7%,训练集大小为50000,20000轮训练,验证码的生成代码见项目:https://github.com/lepture/captcha

使用captcha_eval.py评估的准确率为52.1%,训练集大小为100000,200000轮训练,验证码的生成代码见项目:https://github.com/Gregwar/CaptchaBundle
依赖环境
=======
### python 2.7
### Anaconda2 4.3.1
https://www.continuum.io/downloads#linux
### TensorFlow 1.1
https://github.com/tensorflow/tensorflow
### captcha
https://pypi.python.org/pypi/captcha/0.1.1使用步骤
=======
## 1.准备验证码图片
将验证码图片分别放在 **<工作目录>/data/train_data/** 用于模型训练,**<工作目录>/data/valid_data/** 用于模型效果评估, **<工作目录>/data/test_data/** 用于验证码识别测试,图片命名样式是 **验证码内容_\*.jpg** 或者 **验证码内容_\*.png** ,图片大小最好为 **128x48** . 可以执行默认的验证码生成:
```
python captcha_gen_default.py
```## 2.将验证码图片转换为tfrecords格式
生成的结果为 **<工作目录>/data/train.tfrecord** 和 **<工作目录>/data/valid.tfrecord** ,执行:
```
python captcha_records.py
```## 3.模型训练
可以在CPU或者一个GPU上进行模型训练,执行:
```
python captcha_train.py
```
也可以在多个GPU上进行模型训练,执行:
```
python captcha_multi_gpu_train.py
```## 4.模型评估
用于评估训练的效果,执行:
```
python captcha_eval.py
```## 5.验证码识别
训练好模型后,可以对 **<工作目录>/data/test_data/** 目录下的原始图片进行识别,执行:
```
python captcha_recognize.py
```
结果如下
```
...
image WFPMX_num552.png recognize ----> 'WFPMX'
image QUDKM_num468.png recognize ----> 'QUDKM'
```