openvino 车牌识别实现日志

本文详细介绍了使用Intel的OpenVINO工具套件在Movidius平台上进行深度学习推理的配置过程及性能测试结果。通过具体案例,展示了在不同任务下(如车辆检测、车辆属性识别、LPR)的处理速度与帧率,为开发者提供了实际应用的参考。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

openvino配置链接:(本人用的是Mocidius 1.x版本)

https://software.intel.com/en-us/articles/OpenVINO-Install-Linux

https://software.intel.com/en-us/articles/OpenVINO-InferEngine#Inference%20Engine%20Samples

 

https://software.intel.com/en-us/articles/OpenVINO-InferEngine#set-the-environment-variables

运行程序目录:  /opt/intel/computer_vision_sdk/deployment_tools/demo

命令:./demo_security_barrier_camera.sh -d MYRIAD

实现结果:

处理1个流的时间(nireq = 1):104.17 ms(9.60 fps)

车辆检测时间(MYRIAD)77.30 ms(12.94 fps)

车辆属性时间(MYRIAD,平均超过1次检测):9.22 ms(108.50 fps)
LPR时间(MYRIAD,平均超过1次检测):25.15 ms(39.76 fps)

import numpy as np import torch import torchattacks import cv2 from lprnet.model import LPRNet from tools.lpr_predict import provinces # 定义字符列表 CHARS = ['京', '沪', '津', '渝', '冀', '晋', '蒙', '辽', '吉', '黑', '苏', '浙', '皖', '闽', '赣', '鲁', '豫', '鄂', '湘', '粤', '桂', '琼', '川', '贵', '云', '藏', '陕', '甘', '青', '宁', '新', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'I', 'O', '-' ] # 图像预处理 def transform(img): print("输入图像形状:", img.shape) # 打印输入图像形状 img = img.astype('float32') img -= 127.5 img *= 0.0078125 img = np.transpose(img, (2, 0, 1)) # 转换为 (C, H, W) print("转换后图像形状:", img.shape) # 打印转换后图像形状 return img # 车牌识别函数 def LPR_predict(img, model): # 打印调整大小前图像形状 print("调整大小前图像形状:", img.shape) # 修改图像大小 img = cv2.resize(img, (94, 24)) # 调整图像大小 # 打印调整大小后图像形状 print("调整大小后图像形状:", img.shape) # 图像预处理 im = transform(img) im = im[np.newaxis, :] ims = torch.Tensor(im) device = torch.device('cpu') # 预测网络 prebs = model(ims.to(device)) prebs = prebs.cpu().detach().numpy() preb_labels = list() for i in range(prebs.shape[0]): preb = prebs[i, :, :] preb_label = list() for j in range(preb.shape[1]): preb_label.append(np.argmax(preb[:, j], axis=0)) no_repeat_blank_label = list() pre_c = preb_label[0] if pre_c != len(CHARS) - 1: no_repeat_blank_label.append(pre_c) for c in preb_label: if (pre_c == c) or (c == len(CHARS) - 1): if c == len(CHARS) - 1: pre_c = c continue no_repeat_blank_label.append(c) pre_c = c preb_labels.append(no_repeat_blank_label) 怎么修改
03-25
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值