I am doing a project on detecting vehicles in real time video using googlenet. But I am unsure how do I apply googlenet to a real time video.
조회 수: 1 (최근 30일)
이전 댓글 표시
Here is the code that I have came up with recently,
clear
camera = webcam; % Connect to the camera
net = googlenet; % Load the neural net
net.Layers
while true
labelType =''
% char labelcar
trafficVid = VideoReader('C:\Users\syafiqah\Desktop\project\traffic.avi')
get(trafficVid)
implay('C:\Users\syafiqah\Desktop\project\traffic.avi');
picture = camera.snapshot; % Take a picture
sz = net.Layers(1).InputSize ;
picture = picture(1:sz(1),1:sz(2),1:sz(3));% Resize the picture
label = classify(net, picture); % Classify the picture
if (label == 'ambulance')
labelType = 'Vehicle Recognised'
else if (label == 'moped')
labelType = 'Vehicle Recognised'
end
end
if (label == 'tank')
labelType = 'Vehicle Recognised'
else if (label == 'sports car')
labelType = 'Vehicle Recognised'
end
end
if (label == 'moving van')
labelType = 'Vehicle Recognised'
else if (label == 'trailer truck')
labelType = 'Vehicle Recognised'
end
end
if (label == 'garbage truck')
labelType = 'Vehicle Recognised'
else if (label == 'trailer truck')
labelType = 'Vehicle Recognised'
end
end
% image(picture); % Show the picture
% result = insertShape(frame, 'Rectangle', bbox, 'Color', 'red');
frameRate = trafficVid.FrameRate;
title(implay(char(labelType), frameRate)); % Show the label
drawnow;
end
But I am able to play the video, however no vehicle recognition is being executed. I am also using the latest version of matlab which is matlab r2018a.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Tracking and Motion Estimation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!