Code Monkey home page Code Monkey logo

break_captcha's Introduction

Break Captcha

项目介绍

验证码识别 - 该项目是基于 CNN5/ResNet+BiLSTM/BiGRU+CTC 来实现验证码识别。

注意事项

  1. 如何使用CPU训练:

    本项目默认安装TensorFlow-GPU版,建议使用GPU进行训练,如需换用CPU训练请替换 requirements.txt 文件中的tensorflow-gpu==2.0.0b1ttensorflow==2.0.0b1,其他无需改动。

  2. 关于BiLSTM/BiGRU网络:

    保证CNN得到的featuremap输入到Bi-LSTM/Bi-GRU时的宽度大于等于最大字符数,即time_step大于等于最大字符数。最好的情况是保证time_step 大于等于最大字符数的1倍,比如你的验证码中最大的字符数位6位,那么需要保证time_step >= 6, 最好是time_step >= 12

  3. No valid path found 问题解决

    config.yaml中修改model -> resize的参数,自行调整为合适的值,可以尝试这个较为通用的值:resize: [150, 50]。如果你使用resize: [150, 50]还是遇到了No valid path found问题,可以考虑把图像resize到更大的尺寸或者在config.yaml中修改model -> preprocess_collapse_repeated的参数为True

  4. 参数修改:

    切记,如果修改了训练参数如:ImageWidth,ImageHeight,Resize,CharSet,CNNNetwork,RecurrentNetwork,HiddenNum 这类影响计算图的参数,需要删除checkpoint, tensorboard路径下的旧文件,重新训练。本项目默认支持断点续练。

准备工作

如果你准备使用GPU训练,请先安装CUDAcuDNN。需要注意的是,这里使用的是tensorflow 2.0, 需要使用较新的CUDAcuDNN。我的环境使用的是cuda 10 以及cudnn 7.6.0.64 。供大家参考。

如何使用

  1. 首先下载安装Anoconda;
  2. 然后使用conda 创建一个名为captcha的新虚拟环境conda create -n captcha python=3.6.8
  3. 激活此虚拟环境conda activate captcha. (Windows版本激活环境命令是activate captcha);
  4. 安装依赖的包pip install -r requirements.txt
  5. congig.yaml文件中配置好相关参数,包括数据集名称、路径,所需的数据预处理操作以及训练使用的模型;
  6. 运行脚本make_dataset.py创建所需要的tfrecord文件;
  7. 将所有图片数据转换为tfrecord文件后,就可以开始训练了,运行脚本training.py开始训练。
  8. 模型的训练过程结果都记录在tensorboard logfile中,通过运行tensorboard --logdir=tensorboard/your_dataset_name --host=127.0.0.1即可可视化训练结果;
  9. 训练要有耐心,如果图片较多,一般要训练几百个epoch才可能看到明显的效果提升。

break_captcha's People

Contributors

times125 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.