readme 下载VCForPython27.msi 安装 https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi 安装PIL 下载http://effbot.org/media/downloads/PIL-1.1.7.win32-py2.7.exe 安装cv(本项目中没有使用) pip install opencv-python 安装pytesseract pip install pytesseract 安装OCR 下载https://digi.bib.uni-mannheim.de/tesseract/ tesseract-ocr.zip 里面包含chi_sim.traineddata 中文识别 把chi_sim.traineddata 放到安装目录E:\Program Files (x86)\Tesseract-OCR\tessdata ocr_home=ocr安装目录 tessdata_dir = join(ocr_home, 'tessdata') tessdata_dir_config = '--tessdata-dir "' + tessdata_dir + '"' # win ocr应用启动绝对路径 pytesseract.tesseract_cmd = join(ocr_home, 'tesseract.exe') #cfg.py 配置文件 #cut_img.py 切割原始图片,生成name,id,score的目标图片 #image_tools.py 图片操做工具 #paser_image.py OCR解析图片生成文本 #svm_features.py 生成须要识别的单个数字 #svm_predict.py 图片预测 #svm_train.py 训练模型并测试 #test.py 代码实现的测试程序 libSVM 安装 https://www.lfd.uci.edu/~gohlke/pythonlibs/ 下载libsvm-3.22‑cp27-cp27m-win_amd64.whl pip install libsvm-3.22‑cp27-cp27m-win_amd64.whl(path 文件路径) 将新生成的libsvm.dll复制到系统目录(例如`C:WINDOWSsystem32')便可。 https://www.csie.ntu.edu.tw/~cjlin/libsvm/oldfiles/ 下载libsvm-3.22.zip 将压缩包里面的 __init__.py、svm.py、svmutil.py 存放到工程下面 SVM 数字图片解析(本次model中不存在除噪) 步骤1. 原始文件存放到 data/image/origin 目录下面 步骤2. 切割图片中须要解析的name、id、score 分别存放于data/image/person_name、data/image/person_id、data/image/person_score 步骤3. 数字图片切割成单个数字图片做为解析数据 在data/image/train 建立12个分类目录,存放训练数据 在data/image/test 建立12个分类目录,存放测试数据 步骤4. 生成降维的训练和测试文本 步骤5. 生成训练模型 步骤6. 测试model准确度 步骤6. 预测图片数值 参考资料: https://github.com/zhengwh/captcha-svm/blob/master/img_tools.py https://www.cnblogs.com/chimeiwangliang/p/7133308.html 学习资源: https://github.com/PatrickLib/captcha_recognize (卷曲神经网络) https://github.com/leviome/lenet5_cnn_mnist 廖利伟