Giter Site home page Giter Site logo

12306-ocr's Introduction

12306 验证码识别服务

使用

需要运行在 python 3.6 以上版本

1. 安装依赖

git clone https://github.com/pjialin/12306-ocr

pip install -r requirements.txt

2. 配置程序

cp config.toml.example config.toml

3. 运行程序

python main.py

用于识别文字的模型文件较大,没有放在仓库中,第一次运行会自动进行联网下载,所以可能需要等待一会才能运行起来。

Docker 使用

docker run -d -p 8000:8000 pjialin/12306-ocr

启动后通过 http://IP:8000 进行访问

对接 Py12306

打开 py12306 目录下的 py12306/helpers/api.py 文件,找到 API_FREE_CODE_QCR_API= 的位置,并替换成当前 ocr 服务的接口地址,如:

API_FREE_CODE_QCR_API = 'http://127.0.0.1:8000/check/'

License

Apache License.

12306-ocr's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

12306-ocr's Issues

centos 7.9 x64 pip安装失败

pip install -r requirements.txt

错误提示:
ERROR: Could not find a version that satisfies the requirement matplotlib>=3.0.2 (from -r requirements.txt (line 11)) (from versions: 0.86, 0.86.1, 0.86.2, 0.91.0, 0.91.1, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.4.0, 1.4.1rc1, 1.4.1, 1.4.2, 1.4.3, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 2.0.0b1, 2.0.0b2, 2.0.0b3, 2.0.0b4, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.0.2, 2.1.0rc1, 2.1.0, 2.1.1, 2.1.2, 2.2.0rc1, 2.2.0, 2.2.2, 2.2.3, 2.2.4)
ERROR: No matching distribution found for matplotlib>=3.0.2 (from -r requirements.txt (line 11))

出现404错误

Using TensorFlow backend.
2019-10-15 19:24:57,462 INFO: 正在下载模型文件...
2019-10-15 19:25:05,486 INFO: 下载成功

  • Serving Flask app "web" (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: off
  • Running on http://0.0.0.0:8082/ (Press CTRL+C to quit)
    172.17.0.1 - - [15/Oct/2019 19:36:03] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:36:08] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:36:13] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:36:18] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:36:24] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:36:29] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:36:34] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:36:40] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:36:45] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:36:50] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:36:55] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:00] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:06] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:11] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:16] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:21] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:26] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:31] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:37] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:42] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:47] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:52] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:37:57] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:38:02] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:38:07] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:38:13] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:38:18] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:38:23] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:38:28] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:38:33] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:38:38] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:38:44] "�[33mPOST /check/ HTTP/1.1�[0m" 404 -
    172.17.0.1 - - [15/Oct/2019 19:38:49] "�[33mPOST /check/ HTTP/1.1�[0m" 404

与py12306整合失败,有请求数据

code 400, message Bad request syntax ("\x16\x03\x01\x00Þ\x01\x00\x00Ú\x03\x03[³u¡\x13ÁC§\x99G\x7f»¶þú\÷k\x8b\x10/\xa0\x9e»È9þ\x8f\x96'É\x1f\x00\x00nÀ0À,À2À.À/À+À1À-\x00¥\x00£\x00¡\x00\x9f\x00¤\x00¢\x00\xa0\x00\x9eÀ(À$À\x14À")

您好,是否需要定时更新图片模型?

您好,我使用Docker已经成功部署在本地,不需要任何配置,但是默认端口是8000,有些人会不知道;
还有不知道是否需要定时更新图片模型?

运行报错,小弟一枚没太搞懂改怎么处理

hulk@hulk:~/12306-ocr$ python main.py
Traceback (most recent call last):
  File "main.py", line 8, in <module>
    from web import Web
  File "/home/hulk/12306-ocr/web.py", line 5, in <module>
    from ocr.ml_predict import Predict
  File "/home/hulk/12306-ocr/ocr/ml_predict.py", line 5, in <module>
    import cv2, os
  File "/home/hulk/.local/lib/python3.7/site-packages/cv2/__init__.py", line 3, in <module>
    from .cv2 import *
ImportError: libSM.so.6: cannot open shared object file: No such file or directory
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "main.py", line 8, in <module>
    from web import Web
  File "/home/hulk/12306-ocr/web.py", line 5, in <module>
    from ocr.ml_predict import Predict
  File "/home/hulk/12306-ocr/ocr/ml_predict.py", line 5, in <module>
    import cv2, os
  File "/home/hulk/.local/lib/python3.7/site-packages/cv2/__init__.py", line 3, in <module>
    from .cv2 import *
ImportError: libSM.so.6: cannot open shared object file: No such file or directory

一直报错无法启动

错误如下,安装了libXext.so.6之后还是报错,不知道是什么原因?

Traceback (most recent call last):
File "main.py", line 1, in
from web import Web
File "/root/py12306/12306-ocr/web.py", line 5, in
from ocr.ml_predict import Predict
File "/root/py12306/12306-ocr/ocr/ml_predict.py", line 2, in
import cv2
File "/usr/local/python3/lib/python3.7/site-packages/cv2/init.py", line 3, in
from .cv2 import *
ImportError: libXext.so.6: cannot open shared object file: No such file or directory

Illegal instruction (core dumped)

我是在PVE下开的虚拟机,简单查了下,应该和指令集有关,avx指令集?应该怎么搞,我没有独立的实体机了,虚拟机能搞的话,我也可以提供一个免费打码的节点,分担下大家的压力

opencv-python==4.1.1.26 无法安装

ERROR: Could not find a version that satisfies the requirement opencv-python==4.1.1.26 (from -r requirements.txt (line 28)) (from versions: none)
ERROR: No matching distribution found for opencv-python==4.1.1.26 (from -r requirements.txt (line 28))
试了好多次,都没有办法安装,大佬有办法解决吗 : )

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.