question about R-CNN stop sign detection
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sh
am 20 Nov. 2021
Beantwortet: Prateek Rai
am 24 Nov. 2021
i am trying to understand the code provided here : https://www.mathworks.com/help/vision/ug/object-detection-using-deep-learning.html#DeepLearningRCNNObjectDetectionExample-6
but i am confused with few lines and i need help in understanding it please
- first what this part accutly doing ?, how it detect the stop sign before the training ?
% Only keep the image file names and the stop sign ROI labels
stopSigns = stopSignsAndCars(:, {'imageFilename','stopSign'});
I = imread(stopSigns.imageFilename{1});
I = insertObjectAnnotation(I,'Rectangle',stopSigns.stopSign{1},'stop sign','LineWidth',8);
figure
imshow(I)
2. what is the pretrained data used for stop sign detection , i got confused between ( cifar10Net ) and ( rcnnStopSigns.mat ) ?
thank you
0 Kommentare
Akzeptierte Antwort
Prateek Rai
am 24 Nov. 2021
Hi,
(1) First part
So we first loaded the ground truth and displayed the summary using:
% Load the ground truth data
data = load('stopSignsAndCars.mat', 'stopSignsAndCars');
stopSignsAndCars = data.stopSignsAndCars;
% Update the path to the image files to match the local file system
visiondata = fullfile(toolboxdir('vision'),'visiondata');
stopSignsAndCars.imageFilename = fullfile(visiondata, stopSignsAndCars.imageFilename);
% Display a summary of the ground truth data
summary(stopSignsAndCars)
Here, the training data is saved as a table that contains the image filename and ROI labels for stop signs, car fronts, and rears.
Now, since we want to train for stop sign detector, we will only use the stop sign ROI labels and hence remove car fronts and rear labels. This is implemented using:
% Only keep the image file names and the stop sign ROI labels
stopSigns = stopSignsAndCars(:, {'imageFilename','stopSign'});
Here, we only keep the image file names and stop sign ROI labels. After that, we display one training image and the ground truth bounding boxes using:
% Display one training image and the ground truth bounding boxes
I = imread(stopSigns.imageFilename{1});
I = insertObjectAnnotation(I,'Rectangle',stopSigns.stopSign{1},'stop sign','LineWidth',8);
figure
imshow(I)
(2) Second part
Pre-trained network is saved in 'rcnnStopSigns.mat' mat file.
'cifar10Net' is the variable that stores the trained network. If we are using pre-trained network, then 'cifar10Net' is used to store that pre-trained network.
In the code:
if doTraining
% Train a network.
cifar10Net = trainNetwork(trainingImages, trainingLabels, layers, opts);
else
% Load pre-trained detector for the example.
load('rcnnStopSigns.mat','cifar10Net')
end
If 'doTraining' is 'true', the network will be trained and stored in the variable 'cifar10Net'.
If 'doTraining' is 'false', then the pre-trained network will be stored in the variable 'cifar10Net'.
0 Kommentare
Weitere Antworten (1)
yanqi liu
am 24 Nov. 2021
sir,i think
1. first what this part accutly doing ?, how it detect the stop sign before the training ?
% Only keep the image file names and the stop sign ROI labels
stopSigns = stopSignsAndCars(:, {'imageFilename','stopSign'});
I = imread(stopSigns.imageFilename{1});
I = insertObjectAnnotation(I,'Rectangle',stopSigns.stopSign{1},'stop sign','LineWidth',8);
figure
imshow(I)
it is use the label data, not detect
2. what is the pretrained data used for stop sign detection , i got confused between ( cifar10Net ) and ( rcnnStopSigns.mat ) ?
cifar10Net use for classify
rcnnStopSigns use for detect
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!