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.1 kB

7 years ago
8 years ago
7 years ago
8 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
7 years ago
7 years ago
8 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
7 years ago
8 years ago
7 years ago
7 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
8 years ago
7 years ago
7 years ago
7 years ago
8 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
7 years ago
7 years ago
7 years ago
7 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. # HyperLPR - 高性能开源中文车牌识别框架
  2. #### [![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/)
  3. ### 一键安装
  4. `pip install hyperlpr`
  5. ###### 支持python3,支持Windows Mac Linux 树莓派等。
  6. #### 快速上手
  7. ```python
  8. #导入包
  9. from hyperlpr import *
  10. #导入OpenCV库
  11. import cv2
  12. #读入图片
  13. image = cv2.imread("demo.jpg")
  14. #识别结果
  15. print(HyperLPR_PlateRecogntion(image))
  16. ```
  17. #### 相关资源
  18. - [python配置教程](https://www.jianshu.com/p/7ab673abeaae)
  19. - [相关技术博客](http://blog.csdn.net/relocy/article/details/78705662)(技术文章会在接下来的几个月的时间内连续更新)。
  20. - [带UI界面的工程](https://pan.baidu.com/s/1cNWpK6)(感谢群内小伙伴的工作)。
  21. - [端到端(多标签分类)训练代码](https://github.com/LCorleone/hyperlpr-train_e2e)(感谢群内小伙伴的工作)。
  22. - [端到端(CTC)训练代码](https://github.com/armaab/hyperlpr-train)(感谢群内小伙伴工作)。
  23. ### 更新
  24. - 可通过pip一键安装、更新的新的识别模型、倾斜车牌校正算法、定位算法。(2018.08.11)
  25. - 提交新的端到端识别模型,进一步提高识别准确率(2018.08.03)
  26. - [增加PHP车牌识别工程@coleflowers](https://github.com/zeusees/HyperLPR/tree/master/Prj-PHP) (2018.06.20)
  27. - 添加的新的Python 序列模型-识别率大幅提高(尤其汉字)(2018.3.12)
  28. - 添加了HyperLPR Lite 仅仅需160 行代码即可实现车牌识别(2018.3.12)
  29. - 提供精确定位的车牌矩形框(2018.3.12)
  30. - 增加了端到端模型的cpp实现(Linux)(2018.1.31)
  31. - 增加字符分割[训练代码和字符分割介绍](https://github.com/zeusees/HyperLPR-Training)(2018.1.)
  32. - 更新了Android实现,大幅提高准确率和速度 (骁龙835 (*720*x*1280*) ~50ms )(2017.12.27)
  33. - 添加了IOS版本的实现(感谢[xiaojun123456](https://github.com/xiaojun123456)的工作)
  34. - 添加端到端的序列识别模型识别率大幅度提升,使得无需分割字符即可识别,识别速度提高20% (2017.11.17)
  35. - 新增的端到端模型可以识别新能源车牌、教练车牌、白色警用车牌、武警车牌 (2017.11.17)
  36. - 更新Windows版本的Visual Studio 2015 工程(2017.11.15)
  37. - 增加cpp版本,目前仅支持标准蓝牌(需要依赖OpenCV 3.3) (2017.10.28)
  38. ### TODO
  39. - 提供字符字符识别的训练代码(已提交)
  40. - 改进精定位方法(已提交)
  41. - C++版的端到端识别模型(已提交)
  42. - 支持多种车牌以及双层
  43. - 支持大角度车牌
  44. ### 特性
  45. - 速度快 720p ,单核 Intel 2.2G CPU (macbook Pro 2015)平均识别时间低于100ms
  46. - 基于端到端的车牌识别无需进行字符分割
  47. - 识别率高,仅仅针对车牌ROI在EasyPR数据集上,0-error达到 95.2%, 1-error识别率达到 97.4% (指在定位成功后的车牌识别率)
  48. - 轻量 总代码量不超1k行
  49. ### 模型资源说明
  50. - cascade.xml 检测模型 - 目前效果最好的cascade检测模型
  51. - cascade_lbp.xml 召回率效果较好,但其错检太多
  52. - char_chi_sim.h5 Keras模型-可识别34类数字和大写英文字 使用14W样本训练
  53. - char_rec.h5 Keras模型-可识别34类数字和大写英文字 使用7W样本训练
  54. - ocr_plate_all_w_rnn_2.h5 基于CNN的序列模型
  55. - ocr_plate_all_gru.h5 基于GRU的序列模型从OCR模型修改,效果目前最好但速度较慢,需要20ms。
  56. - plate_type.h5 用于车牌颜色判断的模型
  57. - model12.h5 左右边界回归模型
  58. ### 注意事项:
  59. - Win工程中若需要使用静态库,需单独编译
  60. - 本项目的C++实现和Python实现无任何关联,都为单独实现
  61. - 在编译C++工程的时候必须要使用OpenCV 3.3(DNN 库),否则无法编译
  62. ### Python 依赖
  63. - Keras (>2.0.0)
  64. - Theano(>0.9) or Tensorflow(>1.1.x)
  65. - Numpy (>1.10)
  66. - Scipy (0.19.1)
  67. - OpenCV(>3.0)
  68. - Scikit-image (0.13.0)
  69. - PIL
  70. ### CPP 依赖
  71. - Opencv 3.3
  72. ### Linux/Mac 编译
  73. - 仅需要的依赖OpenCV 3.3 (需要DNN框架)
  74. ```bash
  75. cd cpp_implementation
  76. mkdir build
  77. cd build
  78. cmake ../
  79. sudo make -j
  80. ```
  81. ### CPP demo
  82. ```cpp
  83. #include "../include/Pipeline.h"
  84. int main(){
  85. pr::PipelinePR prc("model/cascade.xml",
  86. "model/HorizonalFinemapping.prototxt","model/HorizonalFinemapping.caffemodel",
  87. "model/Segmentation.prototxt","model/Segmentation.caffemodel",
  88. "model/CharacterRecognization.prototxt","model/CharacterRecognization.caffemodel",
  89. "model/SegmentationFree.prototxt","model/SegmentationFree.caffemodel"
  90. );
  91. //定义模型文件
  92. cv::Mat image = cv::imread("/Users/yujinke/ClionProjects/cpp_ocr_demo/test.png");
  93. std::vector<pr::PlateInfo> res = prc.RunPiplineAsImage(image,pr::SEGMENTATION_FREE_METHOD);
  94. //使用端到端模型模型进行识别 识别结果将会保存在res里面
  95. for(auto st:res) {
  96. if(st.confidence>0.75) {
  97. std::cout << st.getPlateName() << " " << st.confidence << std::endl;
  98. //输出识别结果 、识别置信度
  99. cv::Rect region = st.getPlateRect();
  100. //获取车牌位置
  101. 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);
  102. //画出车牌位置
  103. }
  104. }
  105. cv::imshow("image",image);
  106. cv::waitKey(0);
  107. return 0 ;
  108. }
  109. ```
  110. ###
  111. ### 可识别和待支持的车牌的类型
  112. - [ ] 单行蓝牌
  113. - [ ] 单行黄牌
  114. - [ ] 新能源车牌
  115. - [ ] 白色警用车牌
  116. - [ ] 使馆/港澳车牌
  117. - [ ] 教练车牌
  118. - [ ] 武警车牌
  119. - [ ] 民航车牌
  120. - [ ] 双层黄牌
  121. - [ ] 双层武警
  122. - [ ] 双层军牌
  123. - [ ] 双层农用车牌
  124. - [ ] 双层个性化车牌
  125. ###### Note:由于训练的时候样本存在一些不均衡的问题,一些特殊车牌存在一定识别率低下的问题,如(使馆/港澳车牌),会在后续的版本进行改进。
  126. ### 测试样例
  127. ![image](./demo_images/test.png)
  128. ![image](./demo_images/15.jpg)
  129. #### Android示例
  130. ![android](./demo_images/android.png)
  131. ### 识别测试APP
  132. - 体验 Android APP:[https://fir.im/HyperLPR](https://fir.im/HyperLPR) (根据图片尺寸调整程序中的尺度,提高准确率)
  133. - 感谢 sundyCoder [Android 版本完善](https://github.com/sundyCoder/hyperlpr4Android)
  134. ### 数据分享
  135. 车牌识别框架开发时使用的数据并不是很多,有意着可以为我们提供相关车牌数据。联系邮箱 jack-yu-business@foxmail.com。
  136. #### 获取帮助
  137. - HyperLPR讨论QQ群1: 673071218, 群2: 746123554 ,加前请备注HyperLPR交流。
  138. ### 作者和贡献者信息:
  139. ##### 作者昵称不分前后
  140. - Jack Yu 作者(jack-yu-business@foxmail.com / https://github.com/szad670401)
  141. - lsy17096535 整理(https://github.com/lsy17096535)
  142. - xiaojun123456 IOS贡献(https://github.com/xiaojun123456)
  143. - sundyCoder Android第三方贡献(https://github.com/sundyCoder)
  144. - coleflowers php贡献(@coleflowers)
  145. - Free&Easy 资源贡献
  146. - 海豚嘎嘎 LBP cascade检测器训练