
## HyperLPR3 - High Performance License Plate Recognition Framework.
#### [](https://pypi.org/project/hyperlpr3/)[](https://pypi.org/manage/project/hyperlpr3/releases/)[](https://jitpack.io/#HyperInspire/hyperlpr3-android-sdk)
[中文文档](README_CH.md)
### Demo APP Installation
- Android APP:[Scan QR Code](http://fir.tunm.top/hyperlpr)
### Quick Installation
`python -m pip install hyperlpr3`
###### support:python3, Windows, Mac, Linux, Raspberry Pi。
###### 720p cpu real-time (st on MBP r15 2.2GHz haswell).
#### Quick Test
```bash
# image url
lpr3 sample -src https://koss.iyong.com/swift/v1/iyong_public/iyong_2596631159095872/image/20190221/1550713902741045679.jpg
# image path
lpr3 sample -src images/test_img.jpg -det high
```
#### How to Use
```python
# import opencv
import cv2
# import hyperlpr3
import hyperlpr3 as lpr3
# Instantiate object
catcher = lpr3.LicensePlateCatcher()
# load image
image = cv2.imread("images/test_img.jpg")
# print result
print(catcher(image))
```
#### Start the WebAPI service
```bash
# start server
lpr3 rest --port 8715 --host 0.0.0.0
```
Path to open SwaggerUI after startup:[http://localhost:8715/api/v1/docs](http://localhost:8715/api/v1/docs) View and test the online Identification API service:

#### Q&A
Q:Whether the accuracy of android in the project is consistent with that of apk-demo?
A:Please compile or download the Android shared library from the release and copy it to Prj-Android for testing。
Q:Source of training data for license plates?
A:Since the license plate data used for training involves legal privacy and other issues, it cannot be provided in this project. Open more big data sets [CCPD](https://github.com/detectRecog/CCPD) registration dataset。
Q:Provision of training code?
A:The resources provide the old training code, and the training methods for HyperLPR3 will be sorted out and presented later。
#### Resources
- [HyperLPR3车牌识别-五分钟搞定: 中文车牌识别光速部署与使用](https://blog.csdn.net/weixin_40193776/article/details/129258107)
- [HyperLPR3车牌识别-Android-SDK光速部署与使用](https://blog.csdn.net/weixin_40193776/article/details/129394240)
- [HyperLPR3车牌识别-Linux/MacOS使用:C/C++库编译](https://blog.csdn.net/weixin_40193776/article/details/129295679)
- [HyperLPR3车牌识别-Android使用:SDK编译与部署](https://blog.csdn.net/weixin_40193776/article/details/129354938)
- To be added... Contributions welcome
#### Other Versions
- [HyperLPRv1](https://github.com/szad670401/HyperLPR/tree/v1)
- [HyperLPRv2](https://github.com/szad670401/HyperLPR/tree/v2)
### TODO
- Support for rapid deployment of WebApi services
- Support multiple license plates and double layers
- Support large Angle license plate
- Lightweight recognition model
### Specialty
- 720p faster, single core Intel 2.2G CPU (MaBook Pro 2015) average recognition time is less than 100ms
- End-to-end license plate recognition does not require character segmentation
- The recognition rate is high, and the accuracy of the entrance and exit scene is about 95%-97%
- Support cross-platform compilation and rapid deployment
### Matters Need Attention:
- The C++ and Python implementations of this project are separate
- When compiling C++ projects, OpenCV 4.0 and MNN 2.0 must be used, otherwise it will not compile
- Android project compilation ndk as far as possible to use version 21
### Python Dependency
- opencv-python (>3.3)
- onnxruntime (>1.8.1)
- fastapi (0.92.0)
- uvicorn (0.20.0)
- loguru (0.6.0)
- python-multipart
- tqdm
- requests
### Cross-platform support
#### Platform
- Linux: x86、Armv7、Armv8
- MacOS: x86
- Android: arm64-v8a、armeabi-v7a
#### Embedded Development Board
- Rockchip: rv1109rv1126(RKNPU)
### CPP Dependency
- Opencv 4.0 above
- MNN 2.0 above
### C/C++ Compiling Dependencies
Compiling C/C++ projects requires the use of third-party dependency libraries. After downloading the library, unzip it, and put it into the root directory (the same level as CMakeLists.txt) by copying or soft linking.[baidu drive](https://pan.baidu.com/s/1zfP2MSsG1jgxB_MjvpwZJQ) code: eu31
### Linux/Mac Shared Library Compilation
- Need to place or link dependencies in the project root (same level as CMakeLists.txt)
```bash
# execute the script
sh command/build_release_linux_share.sh
```
Compiled to the **build/linux/install/hyperlpr3** dir,Which contains:
- include - header file
- lib - shared dir
- resource - test-images and models dir
Copy the files you need into your project
### Linux/Mac Compiling the Demo
- You need to complete the compilation action of the previous step,And ensure that the compilation is successful and the compiled file is placed in the root directory: **build/linux/install/hyperlpr3**
- Go to the **Prj-Linux** folder
```bash
# go to Prj-linux
cd Prj-Linux
# exec sh
sh build.sh
```
The executable program is generated after compilation: **PlateRecDemo**,and Run the program
```bash
# go to build
cd build/
# first param models dir, second param image path
./PlateRecDemo ../hyperlpr3/resource/models/r2_mobile ../hyperlpr3/resource/images/test_img.jpg
```
### Linux/Mac Quick Use SDK Code Example
```C
// Load image
cv::Mat image = cv::imread(image_path);
// Create a ImageData
HLPR_ImageData data = {0};
data.data = image.ptr<uint8_t>(0); // Setting the image data flow
data.width = image.cols; // Setting the image width
data.height = image.rows; // Setting the image height
data.format = STREAM_BGR; // Setting the current image encoding format
data.rotation = CAMERA_ROTATION_0; // Setting the current image corner
// Create a Buffer
P_HLPR_DataBuffer buffer = HLPR_CreateDataBuffer(&data);
// Configure license plate recognition parameters
HLPR_ContextConfiguration configuration = {0};
configuration.models_path = model_path; // Model folder path
configuration.max_num = 5; // Maximum number of license plates
configuration.det_level = DETECT_LEVEL_LOW; // Level of detector
configuration.use_half = false;
configuration.nms_threshold = 0.5f; // Non-maxima suppress the confidence threshold
configuration.rec_confidence_threshold = 0.5f; // License plate number text threshold
configuration.box_conf_threshold = 0.30f; // Detector threshold
configuration.threads = 1;
// Instantiating a Context
P_HLPR_Context ctx = HLPR_CreateContext(&configuration);
// Query the Context state
HREESULT ret = HLPR_ContextQueryStatus(ctx);
if (ret != HResultCode::Ok) {
printf("create error.\n");
return -1;
}
HLPR_PlateResultList results = {0};
// Execute LPR
HLPR_ContextUpdateStream(ctx, buffer, &results);
for (int i = 0; i < results.plate_size; ++i) {
// Getting results
std::string type;
if (results.plates[i].type == HLPR_PlateType::PLATE_TYPE_UNKNOWN) {
type = “Unknown";
} else {
type = TYPES[results.plates[i].type];
}
printf("<%d> %s, %s, %f\n", i + 1, type.c_str(),
results.plates[i].code, results.plates[i].text_confidence);
}
// Release Buffer
HLPR_ReleaseDataBuffer(buffer);
// Release Context
HLPR_ReleaseContext(ctx);
```
### Android: Compile the Shared Library
- The first step is to install third-party dependencies
- You need to prepare NDKS and configure environment variables: $ANDROID_NDK
- Supports cross-compilation on Linux/MacOS
```bash
# execute the script
sh command/build_release_android_share.sh
```
Compiled to the: **build/release_android/**,Which contains:
- arm64-v8a - 64bit shard library
- armeabi-v7a - 32bit shard library
After compiling,Copy**arm64-v8a**and**a
pycharm中文车牌识别依赖库HyperLPR
需积分: 0 59 浏览量
更新于2023-04-30
3
收藏 32.8MB ZIP 举报
在Python编程环境中,车牌识别是一项常见的计算机视觉任务,主要用于智能交通、安防监控等领域。`PyCharm`是一款广泛使用的Python集成开发环境,而`HyperLPR`则是一个专为车牌识别设计的开源库。这个库提供了高效且准确的车牌识别功能,尤其适合中国车牌的识别。下面将详细阐述`PyCharm`与`HyperLPR`的相关知识点。
1. PyCharm:作为一款强大的Python IDE,PyCharm提供了丰富的代码编辑、调试、测试和版本控制等功能,支持多种框架和库,如Django、Flask等。对于`HyperLPR`这样的图像处理库,PyCharm提供了一流的代码补全、语法高亮和调试支持,使得开发过程更加便捷高效。
2. 车牌识别技术:车牌识别基于深度学习和计算机视觉,通常包括图像预处理、特征提取、字符分割和字符识别四个步骤。`HyperLPR`库针对这些步骤进行了优化,特别在字符识别部分,它可能采用了卷积神经网络(CNN)模型进行训练,以适应不同光照、角度和车牌类型的场景。
3. HyperLPR库:`HyperLPR`这个名字中的“Hyper”可能代表其高效的性能。该库包含一系列预训练模型,能够快速地对输入的车牌图片进行识别。它可能还提供了API接口,使得开发者可以轻松地将其集成到自己的应用中。`HyperLPR-master`文件名暗示了这是该库的主分支或者最新版本,包含了库的核心代码、训练数据、示例代码和可能的配置文件。
4. 安装与使用:在PyCharm中安装`HyperLPR`,通常通过`pip`命令来完成,如`pip install git+https://github.com/your_repo/HyperLPR.git`。然后在项目中导入库,调用相关函数进行车牌识别。开发者需要确保安装了必要的依赖库,如OpenCV、PIL等。
5. 示例与实践:`HyperLPR`库通常会提供示例代码,展示如何加载模型、处理图像和打印识别结果。这有助于初学者快速上手,并可以根据实际需求进行调整。例如,用户可能需要自定义预处理函数以适应特定的图像格式或质量。
6. 性能优化:`HyperLPR`可能在模型设计和算法实现上进行了优化,以提高识别速度和准确性。同时,用户也可以根据硬件条件(如GPU支持)调整推理速度和资源消耗之间的平衡。
7. 扩展与改进:除了基本的车牌识别,`HyperLPR`可能还支持其他功能,如颜色识别、车型识别等。此外,开发者可以利用`HyperLPR`的训练框架,对新的车牌类型或特殊场景进行定制化训练,以提升识别效果。
`PyCharm`配合`HyperLPR`库,为开发者提供了一个强大的平台,用于构建和部署车牌识别应用。通过深入理解这两个工具,开发者不仅可以实现车牌识别,还能探索更广泛的计算机视觉和深度学习领域。

weixin_62650385
- 粉丝: 0
最新资源
- 基于单片机的交流电机转动控制系统方案设计书.doc
- 《项目管理决策分析与评价》摸底评测.doc
- 综合布线设计方案.docx
- 区块链技术在金融领域应用的风险管理策略研究.docx
- 数据库应用技术知识点.doc
- ATS单片机停车场车位设计.doc
- 2018年度四川省大数据时代的互联网信息安全试题及答案1.doc
- 数据库设计报告1111111111111.doc
- 项目管理在农用飞机维修工程中的应用.docx
- 基于物联网的智能家居系统的设计与应用.docx
- kubernetes系列03—kubeadm安装部署K8S集群.docx
- 基于服务器虚拟化的政务云平台设计.docx
- C语言程序设计工业和信息化普通高等教育“十二五”规划教材立项项目-赵山林-高媛.doc
- matlab电炉温度控制算法比较及仿真研究分析.doc
- 电力调度自动化系统的网络安全问题与对策分析.docx
- 大数据时代人力资源管理创新策略初探.docx