目录
1.算法运行效果图预览
(完整程序运行后无水印)
将usb摄像头对准一个播放不同水果图片的显示器,然后进行识别,识别结果如下:







本课题中,使用的USB摄像头为:

2.算法运行软件版本
matlab2022a
3.部分核心程序
(完整版代码包含详细中文注释和操作步骤视频)
程序中包括MATLAB读取摄像头的配置方法,摄像头配置工具箱安装文件。
...............................................................
load gnet.mat
img_size= [224,224];
delete(imaqfind);
vid = videoinput('winvideo',1,'YUY2_640x480');%设置视频对象
set(vid, 'ReturnedColorSpace', 'rgb');%将视频对象设置为始终返回rgb图像:
triggerconfig(vid,'manual');
start(vid)%初始化帧计数器和fps变量
counter = 0;
fps = 0;
runtime = 100;%程序运行时间
h = figure(1);
tic
timeTracker = toc;
tmps=[];
tmps2=[];
while toc < runtime
counter = counter + 1;
% Get a new frame from the camera
img = getsnapshot(vid);
%进行识别
[R,C,K] = size(img);
I2 = imresize(img,[224,224]);
[Predicted_Label, Probability] = classify(net, I2);
Predicted_Label
imshow(img, []);
end
164
4.算法理论概述
GoogleNet(也称为Inception-v1)是一种深度卷积神经网络(CNN),它通过使用Inception模块来减少参数量,同时保持网络的深度和宽度。Inception模块的设计旨在捕捉不同尺度的特征,并通过并行的卷积层和池化层来实现这一点。

USB摄像头采集图像的过程可以通过读取摄像头帧并将其转换为可用于深度学习网络的格式来实现。假设摄像头采集的图像为I.

5.算法完整程序工程
OOOOO
OOO
O