https://github.com/zxdong262/tf-captcha-reader
Read captcha image with TensorFlow
https://github.com/zxdong262/tf-captcha-reader
captcha demo image tensorflow
Last synced: about 1 year ago
JSON representation
Read captcha image with TensorFlow
- Host: GitHub
- URL: https://github.com/zxdong262/tf-captcha-reader
- Owner: zxdong262
- License: mit
- Created: 2018-07-23T05:55:58.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-19T09:12:23.000Z (over 7 years ago)
- Last Synced: 2025-02-25T02:07:11.532Z (over 1 year ago)
- Topics: captcha, demo, image, tensorflow
- Language: Python
- Homepage:
- Size: 20.5 KB
- Stars: 7
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tf-captcha-reader
Read captcha image with TensorFlow. [Tutorial](https://html5beta.com/page/tutorial-reading-captcha-with-tensorflow.html)
## Work flow
Image generated:(4 or 5 random en char or digit, multi-color, random roate 0 ~ 4 degree)

Make it binary:

Get shapes with opencv.findContours:

Split it:




Then feed to tensorflow.keras
Result:
```bash
# (trainData, trainLabels) = createData(8000)
# (testData, testLabels) = createData(2000)
Epoch 25/25
36029/36029 [==============================] - 2s 54us/step - loss: 0.0752 - acc: 0.9669
8970/8970 [==============================] - 0s 29us/step
evaluate test data set:
test_loss: 0.28423821404674937
test_acc: 0.9385730211817168
predict example-image(example-images/example-captcha.png):
['l', '8', 'V', 'T']
```
It can be improved by add more train data or add more epochs.
## Run
```bash
# install Helper libraries, for ubuntu 16.04 only
sudo apt-get install python3-pip python3-tk
pip3 install tensorflow numpy Pillow scipy opencv-python --user
# clone the repo
git clone git@github.com:zxdong262/tf-captcha-reader.git
cd tf-captcha-reader
npm i
python3 main.py
```