验证码识别 深度学习 tensorflow 神经网络

Overview

captcha_tf2

验证码识别 深度学习 tensorflow 神经网络
使用卷积神经网络,对字符,数字类型验证码进行识别,tensorflow使用2.0以上

目前项目还在更新中,诸多bug,欢迎提出issue和PR, 希望和你一起共同完善项目。

实例demo

训练过程

  • 优化器选择: Adam
  • 损失函数: MSLE(均方对数误差)
  • 数据集: 随机生成的10000张图片,按照8:2用于训练和验证
  • 设备: Titan X 在训练过程中第5次epoch即可达到 80的accuracy50以上的val_accuracy
    经过30次epoch accuracy达到93, val_acc在85以上
    最高达到97 acc

目前训练val提升可以,loss下降稳定


demo图片
效果

效果
效果

目录

1. 项目结构

1.1 文件目录

序号 文件 说明
1 model/ 模型权重文件
2 network/ 神经网络
3 settings_tf 项目配置文件
4 tools/ 工具文件
5 data/ 数据文件

1.2 主要文件

序号 文件 说明
1 train.py 训练程序
2 detect.py 测试程序
3 make_data.py 训练集合成程序
4 create_image.py 数据集生产脚本

2. 使用

修改主路径下derect.py的配置变量注:注意config.py的图片size
直接调用python detcet.py
保存格式:*.txt: [6, 9, 5, 6] 1.jpg

3. 训练

3.1 数据准备:

  • 如果自己收集数据较为繁琐,可直接调用create_image.py,修改相应配置即可快速生成图片集和标注文件 无需其他步骤
  • 或是自己去网络上寻找验证码图片集, 保存格式需以数字顺序保存,且标注文件存放在某个单独的 txt中,标注结果是对应的图片名数字-1作为下标 默认采用数据集样式为1.jpg, 2.jpg ...的顺序格式
| ̄ ̄data/
|   |
|   | ̄ ̄images/
|   |   |
|   |   | ̄ ̄1.jpg
|   |   |
|   |   | ̄ ̄2.jpg
|   |    
|   | ̄ ̄label.txt

3.2开始训练

首先修改congig.py配置文件
接着修改train.py

  • 开始训练 python train.py
    训练中

网络

序号
输入 (B, 60, 160, 1)
1 卷积(32) relu BN
2 卷积(64) relu BN 相等池化
3 卷积(128) relu BN 相等池化
4 卷积(64) relu BN 相等池化
5 卷积(32) relu BN 相等池化
6 扁平化
8 全链接(onehot) softmax
输出 (长度, 类别)
You might also like...
Deep learning library featuring a higher-level API for TensorFlow.
Deep learning library featuring a higher-level API for TensorFlow.

TFLearn: Deep learning library featuring a higher-level API for TensorFlow. TFlearn is a modular and transparent deep learning library built on top of

A Neural Net Training Interface on TensorFlow, with focus on speed + flexibility
A Neural Net Training Interface on TensorFlow, with focus on speed + flexibility

Tensorpack is a neural network training interface based on TensorFlow. Features: It's Yet Another TF high-level API, with speed, and flexibility built

TensorFlow-based neural network library
TensorFlow-based neural network library

Sonnet Documentation | Examples Sonnet is a library built on top of TensorFlow 2 designed to provide simple, composable abstractions for machine learn

TensorFlow ROCm port
TensorFlow ROCm port

Documentation TensorFlow is an end-to-end open source platform for machine learning. It has a comprehensive, flexible ecosystem of tools, libraries, a

Deep learning operations reinvented (for pytorch, tensorflow, jax and others)
Deep learning operations reinvented (for pytorch, tensorflow, jax and others)

This video in better quality. einops Flexible and powerful tensor operations for readable and reliable code. Supports numpy, pytorch, tensorflow, and

NeuPy is a Tensorflow based python library for prototyping and building neural networks
NeuPy is a Tensorflow based python library for prototyping and building neural networks

NeuPy v0.8.2 NeuPy is a python library for prototyping and building neural networks. NeuPy uses Tensorflow as a computational backend for deep learnin

Python scripts to detect faces in Python with the BlazeFace Tensorflow Lite models
Python scripts to detect faces in Python with the BlazeFace Tensorflow Lite models

Python scripts to detect faces using Python with the BlazeFace Tensorflow Lite models. Tested on Windows 10, Tensorflow 2.4.0 (Python 3.8).

Human head pose estimation using Keras over TensorFlow.
Human head pose estimation using Keras over TensorFlow.

RealHePoNet: a robust single-stage ConvNet for head pose estimation in the wild.

TensorFlow 2 AI/ML library wrapper for openFrameworks
TensorFlow 2 AI/ML library wrapper for openFrameworks

ofxTensorFlow2 This is an openFrameworks addon for the TensorFlow 2 ML (Machine Learning) library

Comments
  • 验证码测试结果不正确?

    验证码测试结果不正确?

    [2, 21, 17, 35] 1.jpg [2, 31, 17, 35] 2.jpg [2, 21, 17, 35] 3.jpg [2, 31, 17, 35] 4.jpg [2, 31, 17, 35] 5.jpg [2, 21, 17, 35] 6.jpg [2, 31, 17, 35] 7.jpg [2, 21, 17, 35] 8.jpg [2, 31, 17, 35] 9.jpg [2, 21, 17, 35] 10.jpg 训练10组图片100轮 测试这10组图片结果验证码不正确

    opened by Reloss 3
Owner
null
PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)

English | 简体中文 Welcome to the PaddlePaddle GitHub. PaddlePaddle, as the only independent R&D deep learning platform in China, has been officially open

null 19.4k Jan 4, 2023
Deploy tensorflow graphs for fast evaluation and export to tensorflow-less environments running numpy.

Deploy tensorflow graphs for fast evaluation and export to tensorflow-less environments running numpy. Now with tensorflow 1.0 support. Evaluation usa

Marcel R. 349 Aug 6, 2022
TensorFlow Ranking is a library for Learning-to-Rank (LTR) techniques on the TensorFlow platform

TensorFlow Ranking is a library for Learning-to-Rank (LTR) techniques on the TensorFlow platform

null 2.6k Jan 4, 2023
Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Peter Lin 6.5k Jan 4, 2023
Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Robust Video Matting (RVM) English | 中文 Official repository for the paper Robust High-Resolution Video Matting with Temporal Guidance. RVM is specific

flow-dev 2 Aug 21, 2022
Deep learning library featuring a higher-level API for TensorFlow.

TFLearn: Deep learning library featuring a higher-level API for TensorFlow. TFlearn is a modular and transparent deep learning library built on top of

TFLearn 9.6k Jan 2, 2023
Implementation of Restricted Boltzmann Machine (RBM) and its variants in Tensorflow

xRBM Library Implementation of Restricted Boltzmann Machine (RBM) and its variants in Tensorflow Installation Using pip: pip install xrbm Examples Tut

Omid Alemi 55 Dec 29, 2022
Official TensorFlow code for the forthcoming paper

~ Efficient-CapsNet ~ Are you tired of over inflated and overused convolutional neural networks? You're right! It's time for CAPSULES :)

Vittorio Mazzia 203 Jan 8, 2023
Open-AI's DALL-E for large scale training in mesh-tensorflow.

DALL-E in Mesh-Tensorflow [WIP] Open-AI's DALL-E in Mesh-Tensorflow. If this is similarly efficient to GPT-Neo, this repo should be able to train mode

EleutherAI 432 Dec 16, 2022