基于PaddleOCR框架和PP-OCRv4开源模型训练商用级高质量车牌识别模型

发布时间:2026/7/30 11:50:28

基于PaddleOCR框架和PP-OCRv4开源模型训练商用级高质量车牌识别模型 PaddleOCR_Plate作者北小菜QQ1402990689微信bilibili_bxc哔哩哔哩主页https://space.bilibili.com/487906612gitee开源地址https://gitee.com/Vanishi/PaddleOCR_Plategithub开源地址https://github.com/beixiaocai/PaddleOCR_Plate项目介绍基于PaddleOCR框架和PP-OCRv4开源模型训练商用级高质量车牌识别模型本项目在PaddleOCR框架 PP-OCRv4的开源模型基础上使用开源的车牌识别样本集CCPD2020迭代训练而来。本项目的目的是通过编写详细的文档尽可能让所有人都能学会训练车牌识别模型和调用车牌识别模型。降低行业门槛。项目根目录下checkpoints文件夹里面内置了作者训练好的车牌检测和车牌识别模型大家如果不想训练可以直接使用调用方法参考tests.py安装训练环境1首先确保您已经具备Python运行环境 目前支持 Python 3.8 至 Python 3.12Windows系统推荐Python3.10作者在Windows用的是3.10 2安装paddlepaddle //安装CPU版本 python -m pip install paddlepaddle3.0.0rc0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/ //安装GPU版本cu118需显卡驱动程序版本 ≥450.80.02Linux或 ≥452.39Windows python -m pip install paddlepaddle-gpu3.0.0rc0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/ //安装GPU版本cu123需显卡驱动程序版本 ≥545.23.06Linux或 ≥545.84Windows python -m pip install paddlepaddle-gpu3.0.0rc0 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/ 3安装paddleocr pip install paddleocr2.10.0 //注意本项目是基于paddleocr2.10.0和PP-OCRv4实现如果使用的paddleocr2.10.0则可能会面临很多不确定性建议保持一致下载PP-OCRv4的开源预训练基础模型 训练样本集1下载PP-OCRv4的开源预训练基础模型 下载作者基于CCPD2020转换后适合paddleocr直接训练的样本集 夸克网盘下载地址 https://pan.quark.cn/s/6830234a944f 网盘文件介绍/ ├── pretrain_models.zip # 需要下载PP-OCRv4的开源预训练基础模型 pretrain_models/ ├── ch_PP-OCRv4_det_cml_teacher_pretrained └── ch_PP-OCRv4_rec_train └── CCPD2020_PPOCR.zip # 需要下载CCPD2020转换后适合paddleocr直接训练的样本集 CCPD2020_PPOCR/ ├── ccpd_green └── PPOCR tips: 网盘中上述文件除外都不需要下载是用来归档备份的。 注意解压后的pretrain_models和CCPD2020_PPOCR请务必放置到项目根目录下训练模型验证模型导出模型1车牌识别主要分为两个过程第一步是车牌检测过程det第二步是车牌识别过程rec //在开始训练前请前往configs文件夹分别打开configs/plate_det.yml和configs/plate_rec.yml里面涉及的数据集路径前缀改成与自己本机环境一致注意路径不要包含中文 2车牌检测模型的训练评估导出 //det训练模型 python tools/train.py -c configs/plate_det.yml -o Global.pretrained_modelpretrain_models/ch_PP-OCRv4_det_cml_teacher_pretrained/teacher.pdparams //det评估模型 python tools/eval.py -c configs/plate_det.yml -o Global.pretrained_modeloutput/plate_det/best_model/model.pdparams Eval.dataset.data_dirCCPD2020_PPOCR/ccpd_green Eval.dataset.label_file_list[CCPD2020_PPOCR/PPOCR/test/det.txt] //det导出模型 python tools/export_model.py -c configs/plate_det.yml -o Global.pretrained_modeloutput/plate_det/best_model/model.pdparams Global.save_inference_diroutput/plate_det/inference_model 3车牌识别模型的训练评估导出 //rec训练模型 python tools/train.py -c configs/plate_rec.yml -o Global.pretrained_modelpretrain_models/ch_PP-OCRv4_rec_train/student.pdparams //rec评估模型 python tools/eval.py -c configs/plate_rec.yml -o Global.pretrained_modeloutput/plate_rec/best_model/model.pdparams Eval.dataset.data_dirCCPD2020_PPOCR/PPOCR Eval.dataset.label_file_list[CCPD2020_PPOCR/PPOCR/test/rec.txt] //rec导出模型 python tools/export_model.py -c configs/plate_rec.yml -o Global.pretrained_modeloutput/plate_rec/best_model/model.pdparams Global.save_inference_diroutput/plate_rec/inference_model 补充介绍关于训练模型结构和导出模型结构的区别 //原始训练模型结构 output/plate_det/best_model/ ├── model.pdopt # 优化器状态用于恢复训练 └── model.pdparams # 模型参数权重和偏置 //原始训练模型转换的pdmodel模型结构 output/plate_det/inference_model/ ├── inference.pdmodel # 模型结构 ├── inference.pdiparams # 模型参数 └── inference.pdiparams.info # 参数信息测试图片执行tests.py测试时测试所用到的模型并非直接训练获得的模型而是训练获得的模型转换后的模型//使用tests.py测试训练模型转换的pdmodel模型 python tests.py //使用tests_onnx.py测试pdmodel模型转换的onnx模型转换onnx模型请参考ONNXRUNTIME.md python tests_onnx.py关于如何部署或移植到项目中可以参考tests.py或tests_onnx.py

相关新闻