- 授权协议: Apache
- 开发语言: Python
- 操作系统: 跨平台
- 软件首页: https://github.com/aaronshan/12306-captcha
- 软件文档: https://github.com/aaronshan/12306-captcha
- 官方下载: https://github.com/aaronshan/12306-captcha
软件介绍
基于深度学习的12306验证码识别程序。
1.1 准备工作
下载caffe并编译, 具体可参考官方文档, 此处不再赘述.
修改
src/config.py中的caffe根目录和项目根目录.pip安装easydict, skimage等.
1.2 数据
通过运行
src/tools/download_image.py, 会将12306验证码下载至data/download/all目录.下载完成后, 通过运行
src/tools/cut_image.py, 会将其裁剪为图片和文字两部分, 分别放在data/download/image目录和data/download/words目录.修改
src/image/scripts/words.py文件main方法中cut方法的参数(其参数为data/download/words中子目录的words_*中的数字), 它的目的是处理data/download/words中的所有子文件, 对多个词语进行分割并调整大小为固定值.然后手工对其进行分类, 分别放至
data/image和data/words目录. 可以将其分为两部分,分别放在对应的train和test目录.比如,一个示例目录如下:-image --test ---蜡烛 ----1-1.jpg ---沙漠 ----2-1.jpg --train ---蜡烛 ----1-2.jpg ---沙漠 ----2-2.jpg
图片部分
运行
src/image/scripts/create_data.py, 将会生成图片部分对应的train.txt和test.txt, 里面包含着训练和测试文件及其类别列表.运行
src/image/scripts/create_lmdb.sh, 将会生成图片部分对应的lmdb文件.
文字部分
运行
src/words/scripts/create_data.py, 将会生成文字部分对应的train.txt和test.txt, 里面包含着训练和测试文件及其类别列表.运行
src/words/scripts/create_lmdb.sh, 将会生成文字部分对应的lmdb文件.
1.3 参数
可以根据实际情况对src/image/model/image_solver.prototxt和src/words/model/words_solver.prototxt文件进行修改.具体修改方法可参考其他模型.
1.4 开始训练
src/image/scripts/image_train.sh和src/image/scripts/image_finetune_train.sh脚本分别用来进行从头训练/微调训练, 训练方法可参考caffe模型训练方法.
同理:
src/words/scripts/words_train.sh和src/words/scripts/words_finetune_train.sh脚本分别用来进行从头训练/微调训练, 训练方法可参考caffe模型训练方法.
测试
src/web提供了一个web测试界面, 运行index.py即可. 运行前, 可以更改对应的模型文件名称. 一个简单示例如下:
Hit Refresh
Satya Nadella、Greg Shaw / HarperBusiness / 2017-9-26 / USD 20.37
Hit Refresh is about individual change, about the transformation happening inside of Microsoft and the technology that will soon impact all of our lives—the arrival of the most exciting and disruptive......一起来看看 《Hit Refresh》 这本书的介绍吧!
