赞
踩
图片测试demo:
直接运行detect_plate.py 或者运行如下命令行:
python detect_rec_plate.py --detect_model weights/yolov8-lite-t-plate.pt --rec_model weights/plate_rec_color.pth --image_path imgs --output result
车牌检测训练如下:
下载数据集: 数据集可以添加QQ767172261获取 数据从CCPD和CRPD数据集中选取的一部分并转换的 数据集格式为yolo格式:
label x y w h
2.修改ultralytics/datasets/yolov8-plate.yaml train和val路径,换成你的数据路径:
- train: /mnt/mydisk/xiaolei/plate_detect/new_train_data # train images (relative to 'path') 4 images
- val: /mnt/mydisk/xiaolei/plate_detect/new_val_data # val images (relative to 'path') 4 images
-
- # Classes for DOTA 1.0
- names:
- 0: single
- 1: double
3.训练
yolo task=detect mode=train model=yolov8s.yaml data=./ultralytics/cfg/datasets/plate.yaml epochs=120 batch=32 imgsz=640 pretrained=False optimizer=SGD
结果存在run文件夹中:
车牌识别训练如下:
训练的时候 选择相应的cfg 即可选择模型的大小:
- # construct face related neural networks
- #cfg =[8,8,16,16,'M',32,32,'M',48,48,'M',64,128] #small model
- # cfg =[16,16,32,32,'M',64,64,'M',96,96,'M',128,256]#medium model
- cfg =[32,32,64,64,'M',128,128,'M',196,196,'M',256,256] #big model
- model = myNet_ocr(num_classes=len(plate_chr),cfg=cfg)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。