question about R-CNN stop sign detection

5 ビュー (過去 30 日間)
Sh
Sh 2021 年 11 月 20 日
回答済み: Prateek Rai 2021 年 11 月 24 日
but i am confused with few lines and i need help in understanding it please
  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)
2. what is the pretrained data used for stop sign detection , i got confused between ( cifar10Net ) and ( rcnnStopSigns.mat ) ?
thank you

採用された回答

Prateek Rai
Prateek Rai 2021 年 11 月 24 日
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'.

その他の回答 (1 件)

yanqi liu
yanqi liu 2021 年 11 月 24 日
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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by