重要的事说在前面
数据集:
https://pan.baidu.com/s/1YayAeqgdqZ0u2vSovd0Z4w
提取码:8888
如果作者误删的话,参考这里下载的CCPD2019.tar.xz和CCPD2020.zip获取。
创建并激活环境
conda creat -n plate_det python=3.10.15
conda activate plate_det
python -V
输出
Python 3.10.15
安装依赖包
torchvision==0.20.1
torch==2.5.1
tqdm=4.67.1
pandas==2.2.3
opencv-python==4.10.0.84
albumentations==1.3.0
numpy==1.26.4
ultralytics==8.3.43
数据集说明
CCPD是一个大型的、多样化的、经过仔细标注的中国城市车牌开源数据集,CCPD数据集主要分为CCPD2019数据集和CCPD2020(CCPD-Green)数据集。CCPD2019数据集车牌类型仅有普通车牌(蓝色车牌),CCPD2020数据集车牌类型仅有新能源车牌(绿色车牌)。在CCPD数据集中,每张图片仅包含一张车牌,车牌的车牌省份主要为皖。CCPD中的每幅图像都包含大量的标注信息,但是CCPD数据集没有专门的标注文件,每张图像的文件名就是该图像对应的数据标注。
规模:包含了超过 25 万幅中国城市车牌图像.
CCPD数据集分类
分类名称 | 简介 | 数量 |
---|---|---|
CCPD-base | 通用车牌图片 | 约20万张 |
CCPD-blur | 由于摄像机镜头抖动导致的模糊车牌图片 | 约5000张 |
CCPD-challenge | 在车牌检测识别任务中较有挑战性的图片 | 约1万张 |
CCPD-db | 车牌区域亮度较亮、较暗或者不均匀 | 约2万张 |
CCPD-fn | 车牌离摄像头拍摄位置相对较近或较远 | 约2万张 |
CCPD-np | 没有安装车牌的新车图片 | 约3000张 |
CCPD-rotate | 车牌水平倾斜20到50度,竖直倾斜-10到10度 | 约1万张 |
CCPD-tilt | 车牌水平倾斜15到45度,竖直倾斜15到45度 | 约1万张 |
CCPD-weather | 车牌在雨雪雾天气拍摄得到 | 约1万张 |
CCPD数据集标注处理
CCPD数据集没有专门的标注文件,每张图像的文件名就是该图像对应的数据标注。例如图片3061158854166666665-97_100-159&434_586&578-558&578_173&523_159&434_586&474-0_0_3_24_33_32_28_30-64-233.jpg的文件名可以由分割符’-'分为多个部分:
- 159&434_586&578对应边界框左上角和右下角坐标:左上(159, 434), 右下(586, 578);
- 558&578_173&523_159&434_586&474对应车牌四个顶点坐标(右下角开始顺时针排列):右下(558, 578),左下(173, 523),左上(159, 434),右上(586, 474);
将数据集下载至data/ccpd并解压
解压后的数据目录为:
data/ccpd
├── CCPD2019
├── CCPD2019.tar.xz
├── CCPD2020
└── CCPD2020.zip
然后解压后的数据以4:1的大小生成训练数据, 新建gen_yolo_format_data.py,内容为:
from PIL import Image, ImageDraw, ImageFont
import os,sys
import glob
import random
import cv2
import numpy as np
import shutil
from tqdm import tqdm
def gen_yolo_format_data(rootpath, dstpath):
if not os.path.exists(dstpath):
os.makedirs(dstpath, exist_ok=True)
list_images = glob.glob(f'{rootpath}/**/*.jpg', recursive=True)
for imgpath in tqdm(list_images):
if "/ccpd_np/" in imgpath:#cpd_np是没有车牌的图片,跳过
continue
#print(imgpath)
img = cv2.imread(imgpath)
# 图像名
imgname = os.path.basename(imgpath).split('.')[0]
# 根据图像名分割标注
_, _, box, points, label, brightness, blurriness = imgname.split('-')
# --- 边界框信息
box = box.split('_')
box = [list(map(int, i.split('&'))) for i in box]
box_w = box[1][0]-box[0][0]
box_h = box[1][1]-box[0][1]
box = [box[0][0]+box_w/2, box[0][1]+box_h/2, box_w, box_h]
box = [box[0]/img.shape[1], box[1]/img.shape[0], box[2]/img.shape[1], box[3]/img.shape[0]]
# --- 关键点信息
points = points.split('_')
points = [list(map(int, i.split('&'))) for i in points]
# 将关键点的顺序变为从左上顺时针开始
points = points[-2:]+points[:2]
points = [[pt[0]/img.shape[1], pt[1]/img.shape[0]] for pt in points]
#print(box, points)
random_number = random.uniform(0, 1)
if random_number > 0.2:#train
dstimgsavefold = os.path.join(dstpath, 'images','train')
dstlabelsavefold = os.path.join(dstpath, 'labels','train')
else:
dstimgsavefold = os.path.join(dstpath, 'images','val')
dstlabelsavefold = os.path.join(dstpath, 'labels','val')
os.makedirs(dstimgsavefold, exist_ok=True)
os.makedirs(dstlabelsavefold, exist_ok=True)
# --- 保存图像
cv2.imwrite(os.path.join(dstimgsavefold, imgname+'.jpg'), img)
# --- 保存标签
with open(os.path.join(dstlabelsavefold, imgname+'.txt'), 'w') as f:
f.write(f"{0} {box[0]} {box[1]} {box[2]} {box[3]}")
for pt in points:
f.write(f" {pt[0]} {pt[1]}")
f.write('\n')
#show_yolo_format_data(img, box, points)
#break
def show_yolo_format_data(img, bbox, points):
img_h, img_w, _ = img.shape
x,y,w,h = bbox
x1,y1,x2,y2 = (x-w/2)*img_w, (y-h/2)*img_h, (x+w/2)*img_w, (y+h/2)*img_h
#print(x1,y1,x2,y2)
x1,y1,x2,y2 = int(x1), int(y1), int(x2), int(y2)
#print(x1,y1,x2,y2)
cv2.rectangle(img, (x1,y1), (x2,y2), (0,255,0), 2)
for pt in points:
cv2.circle(img, (int(pt[0]*img_w), int(pt[1]*img_h)), 5, (0,0,255), -1)
cv2.imwrite('img_yolo_format_show.jpg', img)
if __name__ == '__main__':
if len(sys.argv)!= 3:
print("Usage: python gen_yolo_format_data.py <ccpd_dataset_path> <output_path>")
exit(1)
gen_yolo_format_data(sys.argv[1], sys.argv[2])
运行命令:
python gen_yolo_format_data.py data/ccpd data/ccpd_yolo
生成检测数据训练集的层级目录:
data/ccpd_yolo/
├── images
│ ├── train
│ └── val
├── labels
│ ├── train
│ ├── val
└── license_plate-pose.yaml
然后按yolo-pose的格式配置数据集训练文件: license_plate-pose.yaml,为什么要使用pose模式呢,因为本人觉得车牌的四个顶点坐标可能会有用,刚好数据集也有,所以就将外包框和四个顶点都训练出来,如果小伙伴们认为这个顶点没有什么用,那就没必要使用pose模式,使用detect模式就可以了。下面是pose模式的配置:
path: data/ccpd_yolo/ # dataset root dir
train: images/train # train images
val: images/val # val images
# Keypoints
kpt_shape: [4, 2] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible)
flip_idx: [1, 0, 3, 2]
# Classes
names:
0: plate
开始训练
训练之前下载预训练模型yolo11n-pose.pt至pretrain_models文件夹下
yolo task=pose mode=train data=data/ccpd_yolo/license_plate-pose.yaml model=pretrain_models/yolo11n-pose.pt epochs=30 pretrained=pretrain_models/yolo11n-pose.pt
训练过程
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
1/30 2.67G 1.027 0.5361 0 0.5725 1.007 12 640: 100%|██████████| 16494/16494 [39:16<00:00, 7.00it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:27<00:00, 8.25it/s]
all 70551 70551 0.998 0.998 0.994 0.802 0.998 0.999 0.994 0.993
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
2/30 2.68G 0.9491 0.1259 0 0.443 1.009 14 640: 100%|██████████| 16494/16494 [28:17<00:00, 9.71it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:51<00:00, 7.55it/s]
all 70551 70551 0.998 0.998 0.994 0.815 0.998 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
3/30 2.67G 0.9364 0.1157 0 0.4284 1.013 12 640: 100%|██████████| 16494/16494 [29:02<00:00, 9.46it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.28it/s]
all 70551 70551 0.997 0.99 0.994 0.747 0.998 0.99 0.995 0.957
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
4/30 2.66G 0.9144 0.102 0 0.4078 1.004 11 640: 100%|██████████| 16494/16494 [30:49<00:00, 8.92it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:33<00:00, 8.05it/s]
all 70551 70551 0.997 0.99 0.994 0.747 0.998 0.99 0.995 0.957
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
5/30 2.57G 0.8916 0.08925 0 0.3868 0.9939 8 640: 100%|██████████| 16494/16494 [28:00<00:00, 9.82it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [03:05<00:00, 11.88it/s]
all 70551 70551 0.997 0.99 0.994 0.747 0.998 0.99 0.995 0.957
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
6/30 2.55G 0.8792 0.08415 0 0.3752 0.9896 10 640: 100%|██████████| 16494/16494 [27:46<00:00, 9.90it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [03:28<00:00, 10.57it/s]
all 70551 70551 0.999 0.38 0.69 0.435 1 0.38 0.69 0.637
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
7/30 2.61G 0.8715 0.07916 0 0.3676 0.9862 9 640: 100%|██████████| 16494/16494 [27:51<00:00, 9.87it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:20<00:00, 8.48it/s]
all 70551 70551 0.998 0.943 0.971 0.68 0.999 0.943 0.971 0.959
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
8/30 2.65G 0.8661 0.07661 0 0.363 0.9843 9 640: 100%|██████████| 16494/16494 [27:49<00:00, 9.88it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.28it/s]
all 70551 70551 0.998 0.998 0.995 0.766 0.998 0.998 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
9/30 2.68G 0.8616 0.07461 0 0.3587 0.9821 9 640: 100%|██████████| 16494/16494 [27:50<00:00, 9.88it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.28it/s]
all 70551 70551 0.998 0.998 0.995 0.81 0.999 0.998 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
10/30 2.66G 0.8565 0.07198 0 0.3544 0.98 16 640: 100%|██████████| 16494/16494 [27:49<00:00, 9.88it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.28it/s]
all 70551 70551 0.998 0.998 0.994 0.828 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
11/30 2.68G 0.8536 0.07142 0 0.3517 0.9818 13 640: 100%|██████████| 16494/16494 [27:49<00:00, 9.88it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.28it/s]
all 70551 70551 0.998 0.998 0.994 0.836 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
12/30 2.66G 0.8503 0.06946 0 0.3484 0.9795 15 640: 100%|██████████| 16494/16494 [27:52<00:00, 9.86it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.28it/s]
all 70551 70551 0.998 0.999 0.994 0.839 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
13/30 2.68G 0.8482 0.06756 0 0.3452 0.9781 10 640: 100%|██████████| 16494/16494 [27:53<00:00, 9.85it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.28it/s]
all 70551 70551 0.998 0.999 0.994 0.84 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
14/30 2.66G 0.8436 0.06648 0 0.3423 0.9793 11 640: 100%|██████████| 16494/16494 [27:51<00:00, 9.87it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.28it/s]
all 70551 70551 0.998 0.999 0.994 0.841 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
15/30 2.68G 0.8399 0.06563 0 0.3393 0.9765 12 640: 100%|██████████| 16494/16494 [27:49<00:00, 9.88it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.29it/s]
all 70551 70551 0.998 0.999 0.994 0.842 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
16/30 2.66G 0.8375 0.06413 0 0.3372 0.9758 10 640: 100%|██████████| 16494/16494 [27:51<00:00, 9.87it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.28it/s]
all 70551 70551 0.998 0.999 0.994 0.842 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
17/30 2.68G 0.8344 0.06247 0 0.3343 0.9746 13 640: 100%|██████████| 16494/16494 [27:51<00:00, 9.87it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.28it/s]
all 70551 70551 0.998 0.999 0.994 0.843 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
18/30 2.66G 0.8313 0.06136 0 0.3313 0.9749 11 640: 100%|██████████| 16494/16494 [27:49<00:00, 9.88it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.26it/s]
all 70551 70551 0.998 0.999 0.994 0.843 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
19/30 2.68G 0.8275 0.05959 0 0.3282 0.9711 14 640: 100%|██████████| 16494/16494 [27:51<00:00, 9.87it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.26it/s]
all 70551 70551 0.998 0.999 0.994 0.844 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
20/30 2.66G 0.8245 0.05789 0 0.3255 0.9703 11 640: 100%|██████████| 16494/16494 [27:50<00:00, 9.87it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.27it/s]
all 70551 70551 0.998 0.999 0.994 0.845 0.999 0.999 0.995 0.994
Closing dataloader mosaic
albumentations: Blur(p=0.01, blur_limit=(3, 7)), MedianBlur(p=0.01, blur_limit=(3, 7)), ToGray(p=0.01), CLAHE(p=0.01, clip_limit=(1, 4.0), tile_grid_size=(8, 8))
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
21/30 2.78G 0.8032 0.02685 0 0.2979 0.9736 6 640: 100%|██████████| 16494/16494 [25:51<00:00, 10.63it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.27it/s]
all 70551 70551 0.998 0.999 0.994 0.846 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
22/30 2.66G 0.7959 0.02588 0 0.2927 0.9726 6 640: 100%|██████████| 16494/16494 [25:45<00:00, 10.67it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.26it/s]
all 70551 70551 0.998 0.999 0.994 0.847 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
23/30 2.68G 0.7906 0.02501 0 0.2884 0.9678 6 640: 100%|██████████| 16494/16494 [25:45<00:00, 10.67it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.27it/s]
all 70551 70551 0.998 0.999 0.994 0.847 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
24/30 2.66G 0.7846 0.02416 0 0.2834 0.9652 6 640: 100%|██████████| 16494/16494 [25:46<00:00, 10.66it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.26it/s]
all 70551 70551 0.998 0.999 0.994 0.848 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
25/30 2.68G 0.7787 0.02341 0 0.2785 0.9629 6 640: 100%|██████████| 16494/16494 [25:46<00:00, 10.66it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:27<00:00, 8.25it/s]
all 70551 70551 0.998 0.999 0.994 0.849 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
26/30 2.66G 0.7729 0.0227 0 0.2727 0.9605 6 640: 100%|██████████| 16494/16494 [26:52<00:00, 10.23it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:27<00:00, 8.25it/s]
all 70551 70551 0.998 0.999 0.994 0.849 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
27/30 2.68G 0.7666 0.02168 0 0.2665 0.9583 6 640: 100%|██████████| 16494/16494 [25:44<00:00, 10.68it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.27it/s]
all 70551 70551 0.998 0.999 0.994 0.85 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
28/30 2.66G 0.7589 0.0207 0 0.2605 0.9542 6 640: 100%|██████████| 16494/16494 [25:44<00:00, 10.68it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:26<00:00, 8.27it/s]
all 70551 70551 0.998 0.999 0.994 0.85 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
29/30 2.67G 0.7514 0.01956 0 0.253 0.951 6 640: 100%|██████████| 16494/16494 [27:16<00:00, 10.08it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [04:36<00:00, 7.98it/s]
all 70551 70551 0.998 0.999 0.994 0.851 0.999 0.999 0.995 0.994
Epoch GPU_mem box_loss pose_loss kobj_loss cls_loss dfl_loss Instances Size
30/30 2.66G 0.7423 0.01862 0 0.2451 0.9475 6 640: 100%|██████████| 16494/16494 [33:45<00:00, 8.14it/s]
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [05:10<00:00, 7.09it/s]
all 70551 70551 0.999 0.999 0.994 0.851 0.999 0.999 0.995 0.994
训练结果
YOLO11n-pose summary (fused): 257 layers, 2,654,275 parameters, 0 gradients, 6.6 GFLOPs
Class Images Instances Box(P R mAP50 mAP50-95) Pose(P R mAP50 mAP50-95): 100%|██████████| 2205/2205 [05:25<00:00, 6.77it/s]
all 70551 70551 0.999 0.999 0.994 0.851 0.999 0.999 0.995 0.994
Speed: 0.2ms preprocess, 0.4ms inference, 0.0ms loss, 0.5ms postprocess per image
Results saved to runs/pose/train
接下来随便在网上找几张图看一下推理结果
以下是推理函数
def infer(img_path, savepath):
img = cv2.imread(img_path)
yolo = YOLO("runs/pose/train/weights/best.pt")
results = yolo(img)
imgshow = results[0].plot()
cv2.imwrite(f"{savepath}", imgshow)
`
附模型,点这里下载
车牌识别之二:车牌OCR识别(包含全部免费的数据集、源码和模型下载)
车牌识别之三:检测+识别的onnx部署(免费下载高精度onnx模型)