{"id":13488367,"url":"https://github.com/chineseocr/chineseocr","last_synced_at":"2025-05-14T12:10:00.132Z","repository":{"id":39171869,"uuid":"131722556","full_name":"chineseocr/chineseocr","owner":"chineseocr","description":"yolo3+ocr","archived":false,"fork":false,"pushed_at":"2022-08-29T02:53:47.000Z","size":36625,"stargazers_count":6032,"open_issues_count":437,"forks_count":1732,"subscribers_count":188,"default_branch":"app","last_synced_at":"2025-04-11T20:43:44.419Z","etag":null,"topics":["chinese-ocr","chinese-text-detect","darknet-text-detect","idcard","ocr","opencv-dnn","trainticket","yolo3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chineseocr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-01T14:27:52.000Z","updated_at":"2025-04-11T06:16:29.000Z","dependencies_parsed_at":"2022-07-12T17:45:13.286Z","dependency_job_id":null,"html_url":"https://github.com/chineseocr/chineseocr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chineseocr%2Fchineseocr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chineseocr%2Fchineseocr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chineseocr%2Fchineseocr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chineseocr%2Fchineseocr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chineseocr","download_url":"https://codeload.github.com/chineseocr/chineseocr/tar.gz/refs/heads/app","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140760,"owners_count":22021219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chinese-ocr","chinese-text-detect","darknet-text-detect","idcard","ocr","opencv-dnn","trainticket","yolo3"],"created_at":"2024-07-31T18:01:14.485Z","updated_at":"2025-05-14T12:09:55.121Z","avatar_url":"https://github.com/chineseocr.png","language":"Python","readme":"## 本项目基于[yolo3](https://github.com/pjreddie/darknet.git) 与[crnn](https://github.com/meijieru/crnn.pytorch.git)  实现中文自然场景文字检测及识别\n\n###  darknet 优化版本：https://github.com/chineseocr/darknet-ocr.git \n# 训练代码（master分支）    \n\n# ocr训练数据集     \nocr ctc训练数据集(压缩包解码:chineseocr)         \n百度网盘地址:链接: https://pan.baidu.com/s/1UcUKUUELLwdM29zfbztzdw 提取码: atwn       \ngofile地址:http://gofile.me/4Nlqh/uT32hAjbx   密码 https://github.com/chineseocr/chineseocr   \n  \n# 实现功能\n- [x]  文字方向检测 0、90、180、270度检测（支持dnn/tensorflow） \n- [x]  支持(darknet/opencv dnn /keras)文字检测,支持darknet/keras训练\n- [x]  不定长OCR训练(英文、中英文) crnn\\dense ocr 识别及训练 ,新增pytorch转keras模型代码(tools/pytorch_to_keras.py)\n- [x]  支持darknet 转keras, keras转darknet, pytorch 转keras模型\n- [x]  身份证/火车票结构化数据识别 \n- [x]  新增CNN+ctc模型，支持DNN模块调用OCR，单行图像平均时间为0.02秒以下     \n- [ ]  CPU版本加速    \n- [ ]  支持基于用户字典OCR识别    \n- [ ]  新增语言模型修正OCR识别结果  \n- [ ]  支持树莓派实时识别方案  \n \n\n## 环境部署\n\nGPU部署 参考:setup.md     \nCPU部署 参考:setup-cpu.md   \n\n\n### 下载编译darknet(如果直接运用opencv dnn或者keras yolo3 可忽略darknet的编译)  \n```\ngit clone https://github.com/pjreddie/darknet.git \nmv darknet chineseocr/\n##编译对GPU、cudnn的支持 修改 Makefile\n#GPU=1\n#CUDNN=1\n#OPENCV=0\n#OPENMP=0\nmake \n```\n\n修改 darknet/python/darknet.py line 48    \nroot = '/root/'##chineseocr所在目录     \nlib = CDLL(root+\"chineseocr/darknet/libdarknet.so\", RTLD_GLOBAL)    \n\n\n## 下载模型文件   \n模型文件地址:\n* 百度网盘:https://pan.baidu.com/s/1gTW9gwJR6hlwTuyB6nCkzQ     \nother-links:http://gofile.me/4Nlqh/fNHlWzVWo      \n复制文件夹中的所有文件到models目录\n   \n## 模型转换（非必须）\npytorch ocr 转keras ocr     \n``` Bash\npython tools/pytorch_to_keras.py  -weights_path models/ocr-dense.pth -output_path models/ocr-dense-keras.h5\n```\ndarknet 转keras     \n``` Bash\npython tools/darknet_to_keras.py -cfg_path models/text.cfg -weights_path models/text.weights -output_path models/text.h5\n```\nkeras 转darknet      \n``` Bash\npython tools/keras_to_darknet.py -cfg_path models/text.cfg -weights_path models/text.h5 -output_path models/text.weights\n```\n\n## 模型选择  \n``` Bash\n参考config.py文件\n```  \n\n## 构建docker镜像 \n``` Bash\n##下载Anaconda3 python 环境安装包（https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh） 放置在chineseocr目录下   \n##建立镜像   \ndocker build -t chineseocr .   \n##启动服务   \ndocker run -d -p 8080:8080 chineseocr /root/anaconda3/bin/python app.py\n\n```\n\n## web服务启动\n``` Bash\ncd chineseocr## 进入chineseocr目录\npython app.py 8080 ##8080端口号，可以设置任意端口\n```\n\n## 访问服务\nhttp://127.0.0.1:8080/ocr\n\n\u003cimg width=\"500\" height=\"300\" src=\"https://github.com/chineseocr/chineseocr/blob/master/test/demo.png\"/\u003e\n\n\n\n## 识别结果展示\n\n\u003cimg width=\"500\" height=\"300\" src=\"https://github.com/chineseocr/chineseocr/blob/master/test/train-demo.png\"/\u003e\n\u003cimg width=\"500\" height=\"300\" src=\"https://github.com/chineseocr/chineseocr/blob/master/test/idcard-demo.png\"/\u003e\n\u003cimg width=\"500\" height=\"300\" src=\"https://github.com/chineseocr/chineseocr/blob/master/test/img-demo.png\"/\u003e\n\u003cimg width=\"500\" height=\"300\" src=\"https://github.com/chineseocr/chineseocr/blob/master/test/line-demo.png\"/\u003e\n\n\n\n## 参考\n1. yolo3 https://github.com/pjreddie/darknet.git   \n2. crnn  https://github.com/meijieru/crnn.pytorch.git              \n3. ctpn  https://github.com/eragonruan/text-detection-ctpn    \n4. CTPN  https://github.com/tianzhi0549/CTPN       \n5. keras yolo3 https://github.com/qqwweee/keras-yolo3.git    \n6. darknet keras 模型转换参考 参考：https://www.cnblogs.com/shouhuxianjian/p/10567201.html  \n7. 语言模型实现 https://github.com/lukhy/masr\n\n","funding_links":[],"categories":["Python","Computer Vision","模块一：版面分析"],"sub_categories":["OCR","step 1：本地知识文件获取"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchineseocr%2Fchineseocr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchineseocr%2Fchineseocr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchineseocr%2Fchineseocr/lists"}