The captcha solver uses attention-based OCR deep learning model for the Leisure and Cultural Services Department (LCSD) of Hong Kong SAR Government Online Booking system with TensorFlow Serving.
To build the TensorFlow model with AOCR support image, run the following command:
docker build -t tf-aocr:v1 .
To start the containers with TensorFlow Serving, run the following command:
docker-compose up -d
- Download the image from the LCSD Online Booking system.
- Dilate the captcha image to make the characters more distinguishable.
- Convert the captcha image to grayscale.
- Crop the captcha image to 79x32 and 92x32 for 4 and 5 characters captcha.
- Post the captcha image to the TensorFlow Serving API with:
For 4 characters captcha:
http://localhost:9000/v1/models/lcsd-captcha-4:predict
For 5 characters captcha:
http://localhost:9001/v1/models/lcsd-captcha-5:predict
For 4 characters captcha in the same docker-compose file:
http://tf-aocr-lcsd-4:8501/v1/models/lcsd-captcha-4:predict
For 5 characters captcha in the same docker-compose file:
http://tf-aocr-lcsd-5:8501/v1/models/lcsd-captcha-5:predict
- Get the prediction result from the response.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a pull request
This project is based on a model by Qi Guo and Yuntian Deng.
You can find the original model in the da03/Attention-OCR repository.
The TensorFlow version of the model is available in the @emedvedev/attention-ocr