Skip to content
[验证码识别-部署] This project is based on CNN+BLSTM+CTC to realize verificationtion. This projeccode identificat is only for deployment models.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
model fix: fitting to the new train code. Nov 15, 2018
resource For Windows executable file wrapper. Oct 16, 2018
.gitignore feat: Complete the migration of hot deployment. Oct 28, 2018
.travis.yml fix: upload test.py for travis. Jan 21, 2019
LICENSE fix: add SATA license. Sep 16, 2018
README.md Merge remote-tracking branch 'origin/master' Feb 12, 2019
character.py
config.py fix: fixed the log garbled. Jan 29, 2019
config_demo.yaml
constants.py
demo.py
deploy.conf.py
event_handler.py
flask_server.py fix: rich tips. Jan 13, 2019
flask_server.spec
graph_session.py fix: rich tips. Jan 15, 2019
grpc.proto
grpc_pb2.py
grpc_pb2_grpc.py feat: Added adaptation for batch input. Oct 18, 2018
grpc_server.py fix: rich tips. Jan 13, 2019
grpc_server.spec
interface.py
package.py
predict.py fix: rich tips. Jan 15, 2019
pretreatment.py
requirements.txt fix: removed the gpu tag for default. Jan 21, 2019
sanic_server.py fix: rich tips. Jan 13, 2019
signature.py feat: Complete the migration of hot deployment. Oct 28, 2018
test.py
tornado_server.py
tornado_server.spec This commit is mainly to update the new neural network model, and a s… Oct 16, 2018
utils.py feat: add v3 api for bytes. Jan 5, 2019

README.md

Build Status

Project Introduction

This project is based on CNN+BLSTM+CTC to realize verification code identification. This project is only for deployment models, If you need to train the model, please move to https://github.com/kerlomz/captcha_trainer

Informed

  1. The default requirements.txt will install CPU version, Change "requirements.txt" from "TensorFlow" to "TensorFlow-GPU" to Switch to GPU version, Use the GPU version to install the corresponding CUDA and cuDNN.
  2. demo.py: An example of how to call a prediction method.
  3. The model folder folder is used to store model configuration files such as model.yaml.
  4. The graph folder is used to store compiled models such as model.pb
  5. The deployment service will automatically load all the models in the model configuration. When a new model configuration is added, the corresponding compilation model in the graph folder will be automatically loaded, so if you need to add it, please copy the corresponding compilation model to the graph path first, then add the model configuration.

Start

  1. Install the python 3.6 environment (with pip)
  2. Install virtualenv pip3 install virtualenv
  3. Create a separate virtual environment for the project:
    virtualenv -p /usr/bin/python3 venv # venv is the name of the virtual environment.
    cd venv/ # venv is the name of the virtual environment.
    source bin/activate # to activate the current virtual environment.
    cd captcha_platform # captcha_platform is the project path.
  4. pip install -r requirements.txt
  5. Copy a config_demo.yaml to the same directory named config.yaml
  6. Place your trained model.yaml in model folder, and your model.pb in graph folder (create if not exist)
  7. Deploy as follows.

1. Http Version

  1. Linux Deploy (Linux/Mac):

    1. Port: 5000
    pip install gunicorn
    gunicorn -c deploy.conf.py flask_server:app
    
    1. Port: 19951
    python flask_server.py
    
    1. Port: 19952
    python tornado_server.py
    
    1. Port: 19953
    python sanic_server.py
    
  2. Windows Deploy (Windows):

    python xxx_server.py
    
  3. Request

    Request URI Content-Type Payload Type Method
    http://localhost:[Bind-port]/captcha/v1 application/json JSON POST
    Parameter Required Type Description
    image Yes String Base64 encoding binary stream
    model_site No String Site name, bindable in yaml configuration
    model_type No String Category, bindable in yaml configuration

    The request is in JSON format, like: {"image": "base64 encoded image binary stream"}

  4. Response

    Parameter Name Type Description
    message String Identify results or error messages
    code String Status Code
    success String Whether to request success

    The return is in JSON format, like: {"message": "xxxx", "code": 0, "success": true}

2. G-RPC Version

Deploy:

python3 grpc_server.py

Port: 50054

Update G-RPC-CODE

python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ./grpc.proto

Directory Structure

- captcha_platform
    - grpc_server.py
    - flask_server.py
    - tornado_server.py
    - sanic_server.py
    - demo.py
- model
    - model-1.yaml
    - model-2.yaml
    - ...
- graph
    - Model-1.pb
    - ...

Management Model

  1. Load a model
  • Put the trained pb model in the graph folder.
  • Put the trained yaml model configuration file in the model folder.
  1. Unload a model
  • Delete the corresponding yaml configuration file in the model folder.
  • Delete the corresponding pb model file in the graph folder.
  1. Update a model
  • Put the trained pb model in the graph folder.
  • Put the yaml configuration file with "Version" greater than the current version in the model folder.
  • Delete old models and configurations.

License

This project use SATA License (Star And Thank Author License), so you have to star this project before using. Read the license carefully.

Introduction

https://www.jianshu.com/p/80ef04b16efc

Donate

Thank you very much for your support of my project. 赞助

You can’t perform that action at this time.