libowei1213 / 12306_captcha
基于深度学习识别12306验证码
Stars: ✭ 89
Programming Languages
python
139335 projects - #7 most used programming language
Projects that are alternatives of or similar to 12306 captcha
3d Densenet
3D Dense Connected Convolutional Network (3D-DenseNet for action recognition)
Stars: ✭ 118 (+32.58%)
Mutual labels: cnn, densenet
Pytorch classification
利用pytorch实现图像分类的一个完整的代码,训练,预测,TTA,模型融合,模型部署,cnn提取特征,svm或者随机森林等进行分类,模型蒸馏,一个完整的代码
Stars: ✭ 395 (+343.82%)
Mutual labels: cnn, densenet
Hyperdensenet
This repository contains the code of HyperDenseNet, a hyper-densely connected CNN to segment medical images in multi-modal image scenarios.
Stars: ✭ 124 (+39.33%)
Mutual labels: cnn, densenet
Eeg Dl
A Deep Learning library for EEG Tasks (Signals) Classification, based on TensorFlow.
Stars: ✭ 165 (+85.39%)
Mutual labels: cnn, densenet
Segan
A PyTorch implementation of SEGAN based on INTERSPEECH 2017 paper "SEGAN: Speech Enhancement Generative Adversarial Network"
Stars: ✭ 82 (-7.87%)
Mutual labels: cnn
Pytorch Classification
Classification with PyTorch.
Stars: ✭ 1,268 (+1324.72%)
Mutual labels: densenet
Recursive Cnns
Implementation of my paper "Real-time Document Localization in Natural Images by Recursive Application of a CNN."
Stars: ✭ 80 (-10.11%)
Mutual labels: cnn
Visual Feature Attribution Using Wasserstein Gans Pytorch
Implementation of Visual Feature Attribution using Wasserstein GANs (VAGANs, https://arxiv.org/abs/1711.08998) in PyTorch
Stars: ✭ 88 (-1.12%)
Mutual labels: cnn
Dispnet Flownet Docker
Dockerfile and runscripts for DispNet and FlowNet1 (estimation of disparity and optical flow)
Stars: ✭ 78 (-12.36%)
Mutual labels: cnn
Sleepeegnet
SleepEEGNet: Automated Sleep Stage Scoring with Sequence to Sequence Deep Learning Approach
Stars: ✭ 89 (+0%)
Mutual labels: cnn
Sentiment 2017 Imavis
From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction
Stars: ✭ 85 (-4.49%)
Mutual labels: cnn
Tensorflow Cifar 10
Cifar-10 CNN implementation using TensorFlow library with 20% error.
Stars: ✭ 85 (-4.49%)
Mutual labels: cnn
基于深度学习识别12306验证码
简介
使用深度学习的方法识别12306验证码,采用了当前效果最好的卷积网络模型之一:DenseNet
代码参考了一种DenseNet的Keras实现:titu1994/DenseNet
12306验证码图片地址为:https://kyfw.12306.cn/passport/captcha/captcha-image
需要识别的有2部分:
- 上方的文字部分
- 下方的8张图片
文字部分有两种:
文字部分出现两个词时,需要对其进行切割。
运行环境
- Keras 2.1.3 (TensorFlow backend)
- TensorFlow 1.4
准备数据
把图片数据保存在以类别名称命名的文件夹下,如:
训练模型
修改run.py
文件开头的训练参数
batch_size = 64
n_gpus = 2 # 训练时使用的GPU数
n_epochs = 40 # 训练轮数
image_shape = (64, 64, 3) # 图片大小(其他尺寸的图片会被调整到此尺寸)
n_classes = 80 # 类别数(12306验证码图片为80类)
initial_learning_rate = 0.1 # 初始的学习率
reduce_lr_epoch_1 = 20
reduce_lr_epoch_2 = 30 # 指定每次学习率衰减的训练轮数
image_dir = "图片文件夹路径"
训练模型
# DenseNet模型
python run.py --train -m=DenseNet -k=12 -d=40
# DenseNet-BC模型
python run.py --train -m=DenseNet-BC
# 模型参数
python run.py --help
训练时每个epoch后,模型权重文件保存在saves
文件夹下,文件名如:DenseNet-BC_k=12_d=40.weight
。
再次开始运行相同模型的训练,会先读取已保存的权重。
评估/测试模型
在run.py
中指定评估图片的文件夹image_dir
,执行:
python run.py --test -m=DenseNet -k=12 -d=40
# 模型参数与训练参数一致
在12306上进行验证码识别/提交测试
模拟12306验证码验证流程:
- 下载验证码图片到本地
- 读取两个模型,分别识别文字部分、图像部分
- 根据识别的结果,提交post请求验证
- 12306返回验证结果
验证成功的文字部分和图像部分会分别按类别保存到指定文件夹中。若验证失败,保存原始图片。
修改12306_test.py
:
n_classes = 80
image_shape = (64, 64, 3)
text_model_weight = "saves/DenseNet-BC_k=12_d=40.weight" # 文字部分模型保存路径
image_model_weight = "saves/DenseNet-BC_k=24_d=40.weight" # 图片部分模型保存路径
save_path = "D:\IMAGE" # 验证成功的图片保存路径
save_fail_path = "D:\IMAGE\FAIL" # 验证失败的图片保存路径
运行12306_test.py
python 12306_test.py
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].