Giter VIP home page Giter VIP logo

zfsoft-captcha2's Introduction

ZFsoft [jwgl|jxgl] system captcha recognition v2

Inspired by AHU-JiaoWu, Modified from scikit-learn into tensorflow. Add more comments for tutorial use.

GitHub repo size GitHub GitHub All Releases

Usage

pip install -r requirements.txt -U
python trainer.py # train your own model
python predictor.py  # ้ข„ๆต‹'./predict/'ไธ‹็š„ๅ›พ็‰‡
# new
python app.py # flask sever to predict incoming data

Target image examples:

Result accuracy

# train
Epoch 36/36
1200/1200 [==============================] - 0s 47us/sample - loss: 0.0321 - acc: 0.9967
# test
196/196 [==============================] - 0s 476us/sample - loss: 0.1501 - acc: 0.9643

Todo List

  • Add some test sets. (Done)
  • More comments (for tutorial).
  • run a flask sever to predict incoming pic data (Done)
  • image_splite improve.
  • unitest & travis-ci (Abort)
  • command line argv support

Tutorial

  1. retrieve some picture
  2. tag the right code of each captcha pics
  3. write splite codes
  4. splite code (let output layer 36 [0-9, a-z])
  5. using tensorflow train the tagged data[*]
  6. save the model for future uses
  7. predict given pic with that model

Step 5 needs some basic tensorflow skills, you can learn these in the link below:

Flask sever [optional usage]

This is optional, you can use predictor.py alone by adding pictures into the predict folder. Or transmit picture data stream to the flask server.

python app.py # run this first

You can go to http://127.0.0.1:5000/upload see the demo.

Or using some python code below with the api (this is POST only)

import requests

with open('Check.gif', 'rb') as f:
    stream = f.read()

r = requests.post('http://127.0.0.1:5000/api', data=stream)
if r.status_code == 200:
    print(r.text)

Licence

Due to the licence lacunae of original project, I added MIT LICENCE to my codes. The split picture codes' copyright are belong to @AHU-HUI.

bash@zfsoft-captcha2$ tree
โ”œโ”€โ”€ app.py                # flask sever (predictor)
โ”œโ”€โ”€ model
โ”‚   โ””โ”€โ”€ Model_tf.net      # tensorflow model created by trainer
โ”œโ”€โ”€ predict/              # predict folder
โ”œโ”€โ”€ process   
โ”‚   โ””โ”€โ”€ split_code_imgs.py
โ”œโ”€โ”€ requirements.txt      
โ”œโ”€โ”€ trainer.py            # train and test
โ”œโ”€โ”€ predictor.py          # predictor
โ”œโ”€โ”€ data
โ”‚   โ”œโ”€โ”€ train/            # train images
โ”‚   โ””โ”€โ”€ test_sets/        # test images
โ”œโ”€โ”€ README.MD
โ””โ”€โ”€ LICENSE

zfsoft-captcha2's People

Contributors

symant233 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

zhenshaw

zfsoft-captcha2's Issues

On the training of other captcha

Hello, author! If what I need to train is the new version of the square captcha, which has a total of 6 digits and a mixture of letters, how should I modify the code to train? Thank you very much for your reply!

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.