Inspired by AHU-JiaoWu,
Modified from scikit-learn
into tensorflow
. Add more comments for tutorial use.
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
# 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
Add some test sets.(Done)- More comments (for tutorial).
run a flask sever to predict incoming pic data(Done)- image_splite improve.
(Abort)unitest
&travis-ci
- command line argv support
- retrieve some picture
- tag the right code of each captcha pics
- write splite codes
- splite code (let output layer 36 [0-9, a-z])
- using tensorflow train the tagged data[*]
- save the model for future uses
- predict given pic with that model
Step 5 needs some basic tensorflow skills, you can learn these in the link below:
- Google Machine Learnig Crash Course /
- Tensorflow official tutorial / ๅๆฏๆ็ฎไฝไธญๆ
This is optional, you can use
predictor.py
alone by adding pictures into thepredict
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)
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