You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 7.2 kB

6 years ago
7 years ago
6 years ago
7 years ago
6 years ago
7 years ago
5 years ago
7 years ago
6 years ago
6 years ago
6 years ago
6 years ago
5 years ago
6 years ago
7 years ago
6 years ago
4 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
5 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
5 years ago
7 years ago
6 years ago
6 years ago
6 years ago
7 years ago
6 years ago
6 years ago
6 years ago
7 years ago
6 years ago
7 years ago
7 years ago
6 years ago
6 years ago
7 years ago
6 years ago
5 years ago
7 years ago
7 years ago
5 years ago
7 years ago
6 years ago
7 years ago
7 years ago
7 years ago
5 years ago
7 years ago
6 years ago
7 years ago
6 years ago
7 years ago
7 years ago
6 years ago
6 years ago
7 years ago
5 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
4 years ago
7 years ago
4 years ago
7 years ago
4 years ago
3 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. ![logo_t](./demo_images/logo.png)
  2. ## HyperLPR 高性能开源中文车牌识别框架
  3. #### [![1](https://badge.fury.io/py/hyperlpr.svg "title")](https://pypi.org/project/hyperlpr/)[![1](https://img.shields.io/pypi/pyversions/hyperlpr.svg "title")](https://pypi.org/project/hyperlpr/)
  4. ### 一键安装
  5. `python -m pip install hyperlpr`
  6. ###### 支持python3,支持Windows Mac Linux 树莓派等。
  7. ###### 720p cpu real-time (st on MBP r15 2.2GHz haswell).
  8. #### 快速上手
  9. ```python
  10. #导入包
  11. from hyperlpr import *
  12. #导入OpenCV库
  13. import cv2
  14. #读入图片
  15. image = cv2.imread("demo.jpg")
  16. #识别结果
  17. print(HyperLPR_plate_recognition(image))
  18. ```
  19. #### Q&A
  20. Q:Android识别率没有所传demo apk的识别率高?
  21. A:请使用[Prj-Linux](https://github.com/zeusees/HyperLPR/tree/master/Prj-Linux/lpr/model)下的模型,android默认包里的配置是相对较早的模型
  22. Q:车牌的训练数据来源?
  23. A:由于用于训练车牌数据涉及到法律隐私等问题,本项目无法提供。开放较为大的数据集有[CCPD](https://github.com/detectRecog/CCPD)车牌数据集。
  24. Q:训练代码的提供?
  25. A:相关资源中有提供训练代码
  26. Q:关于项目的来源?
  27. A:此项目来源于作者早期的研究和调试代码,代码缺少一定的规范,同时也欢迎PR。
  28. #### 相关资源
  29. - [Android配置教程](https://www.jianshu.com/p/94784c3bf2c1)
  30. - [python配置教程](https://www.jianshu.com/p/7ab673abeaae)
  31. - [Linux下C++配置教程](https://blog.csdn.net/lu_linux/article/details/88707421)
  32. - [带UI界面的工程](https://pan.baidu.com/s/1cNWpK6)(感谢群内小伙伴的工作)。
  33. - [端到端(多标签分类)训练代码](https://github.com/LCorleone/hyperlpr-train_e2e)(感谢群内小伙伴的工作)。
  34. - [端到端(CTC)训练代码](https://github.com/armaab/hyperlpr-train)(感谢群内小伙伴工作)。
  35. ### 更新
  36. - 更新了Android实现,增加实时扫描接口 (2019.07.24)
  37. - 更新Windows版本的Visual Studio 2015 工程至端到端模型(2019.07.03)
  38. - 更新基于端到端的IOS车牌识别工程。(2018.11.13)
  39. - 可通过pip一键安装、更新的新的识别模型、倾斜车牌校正算法、定位算法。(2018.08.11)
  40. - 提交新的端到端识别模型,进一步提高识别准确率(2018.08.03)
  41. - [增加PHP车牌识别工程@coleflowers](https://github.com/zeusees/HyperLPR/tree/master/Prj-PHP) (2018.06.20)
  42. - 添加了HyperLPR Lite 仅仅需160 行代码即可实现车牌识别(2018.3.12)
  43. - 感谢 sundyCoder [Android 字符分割版本](https://github.com/sundyCoder/hyperlpr4Android)
  44. - 增加字符分割[训练代码和字符分割介绍](https://github.com/zeusees/HyperLPR-Training)(2018.1.)
  45. ### TODO
  46. - 支持多种车牌以及双层
  47. - 支持大角度车牌
  48. - 轻量级识别模型
  49. ### 特性
  50. - 速度快 720p,单核 Intel 2.2G CPU (MaBook Pro 2015)平均识别时间低于100ms
  51. - 基于端到端的车牌识别无需进行字符分割
  52. - 识别率高,卡口场景准确率在95%-97%左右
  53. - 轻量,总代码量不超1k行
  54. ### 模型资源说明
  55. - cascade.xml 检测模型 - 目前效果最好的cascade检测模型
  56. - cascade_lbp.xml 召回率效果较好,但其错检太多
  57. - char_chi_sim.h5 Keras模型-可识别34类数字和大写英文字 使用14W样本训练
  58. - char_rec.h5 Keras模型-可识别34类数字和大写英文字 使用7W样本训练
  59. - ocr_plate_all_w_rnn_2.h5 基于CNN的序列模型
  60. - ocr_plate_all_gru.h5 基于GRU的序列模型从OCR模型修改,效果目前最好但速度较慢,需要20ms。
  61. - plate_type.h5 用于车牌颜色判断的模型
  62. - model12.h5 左右边界回归模型
  63. ### 注意事项:
  64. - Win工程中若需要使用静态库,需单独编译
  65. - 本项目的C++实现和Python实现无任何关联,都为单独实现
  66. - 在编译C++工程的时候必须要使用OpenCV 3.3以上版本 (DNN 库),否则无法编译
  67. - 安卓工程编译ndk尽量采用14b版本
  68. ### Python 依赖
  69. - Keras (>2.0.0)
  70. - Theano(>0.9) or Tensorflow(>1.1.x)
  71. - Numpy (>1.10)
  72. - Scipy (0.19.1)
  73. - OpenCV(>3.0)
  74. - Scikit-image (0.13.0)
  75. - PIL
  76. ### CPP 依赖
  77. - Opencv 3.4 以上版本
  78. ### Linux/Mac 编译
  79. - 仅需要的依赖OpenCV 3.4 (需要DNN框架)
  80. ```bash
  81. cd Prj-Linux
  82. mkdir build
  83. cd build
  84. cmake ../
  85. sudo make -j
  86. ```
  87. ### CPP demo
  88. ```cpp
  89. #include "../include/Pipeline.h"
  90. int main(){
  91. pr::PipelinePR prc("model/cascade.xml",
  92. "model/HorizonalFinemapping.prototxt","model/HorizonalFinemapping.caffemodel",
  93. "model/Segmentation.prototxt","model/Segmentation.caffemodel",
  94. "model/CharacterRecognization.prototxt","model/CharacterRecognization.caffemodel",
  95. "model/SegmenationFree-Inception.prototxt","model/SegmenationFree-Inception.caffemodel"
  96. );
  97. //定义模型文件
  98. cv::Mat image = cv::imread("test.png");
  99. std::vector<pr::PlateInfo> res = prc.RunPiplineAsImage(image,pr::SEGMENTATION_FREE_METHOD);
  100. //使用端到端模型模型进行识别 识别结果将会保存在res里面
  101. for(auto st:res) {
  102. if(st.confidence>0.75) {
  103. std::cout << st.getPlateName() << " " << st.confidence << std::endl;
  104. //输出识别结果 、识别置信度
  105. cv::Rect region = st.getPlateRect();
  106. //获取车牌位置
  107. cv::rectangle(image,cv::Point(region.x,region.y),cv::Point(region.x+region.width,region.y+region.height),cv::Scalar(255,255,0),2);
  108. //画出车牌位置
  109. }
  110. }
  111. cv::imshow("image",image);
  112. cv::waitKey(0);
  113. return 0 ;
  114. }
  115. ```
  116. ###
  117. ### 可识别和待支持的车牌的类型
  118. - [x] 单行蓝牌
  119. - [x] 单行黄牌
  120. - [x] 新能源车牌
  121. - [x] 白色警用车牌
  122. - [x] 使馆/港澳车牌
  123. - [x] 教练车牌
  124. - [ ] 武警车牌
  125. - [ ] 民航车牌
  126. - [x] 双层黄牌
  127. - [ ] 双层武警
  128. - [ ] 双层军牌
  129. - [ ] 双层农用车牌
  130. - [ ] 双层个性化车牌
  131. ###### Note:由于训练的时候样本存在一些不均衡的问题,一些特殊车牌存在一定识别率低下的问题,如(使馆/港澳车牌),会在后续的版本进行改进。
  132. ### 测试样例
  133. ![image](./demo_images/demo1.png)
  134. ![image](./demo_images/demo2.jpg)
  135. #### Android示例
  136. ![android](./demo_images/android.png)
  137. ### 识别测试APP
  138. - 体验 Android APP:[http://demo.zeusee.com/HyperLPR](http://demo.zeusee.com/HyperLPR) (根据图片尺寸调整程序中的尺度,提高准确率)
  139. #### 获取帮助
  140. - HyperAI讨论QQ群: 529385694
  141. ### 作者和贡献者信息:
  142. ##### 作者昵称不分前后
  143. - Jack Yu 作者(jack-yu-business@foxmail.com / https://github.com/szad670401)
  144. - 肖潇 (xiaoxiao@xidian.edu.cn)
  145. - AlanNewImage v2版win工程、python双层完善 (https://github.com/AlanNewImage)
  146. - lsy17096535 整理(https://github.com/lsy17096535)
  147. - xiaojun123456 IOS贡献(https://github.com/xiaojun123456)
  148. - sundyCoder Android第三方贡献(https://github.com/sundyCoder)
  149. - coleflowers php贡献(@coleflowers)
  150. - Free&Easy 资源贡献
  151. - 海豚嘎嘎 LBP cascade检测器训练
  152. - Windows工程端到端模型 (https://github.com/SalamanderEyes)
  153. - Android实时扫描实现 (https://github.com/lxhAndSmh)