Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Why cannot the Faster-RCNN run but Fast-RCNN can with the same object detection data and based on the samples from Matlab?

1 visualización (últimos 30 días)
Hi there,
Recently, I have being learned how to use deep learning to detect object. I am confused a lot with a question about Faster-RCNN.
Why cannot the Faster-RCNN run but Fast-RCNN can with the same object detection data and based on the samples from Matlab?
Below are the part of codes for the Faster-RCNN rand Fast-RCNN.
%% Train Faster R-CNN building Detector
idx = floor(0.6 * height(wlDataset));
trainingData = wlDataset(1:idx,:);
testData = wlDataset(idx:end,:);
inputLayer = imageInputLayer([256 256 3]);
filterSize = [3 3];
numFilters = 32;
% Create the middle layers.
middleLayers = [
convolution2dLayer(filterSize, numFilters, 'Padding', 1)
reluLayer()
convolution2dLayer(filterSize, numFilters, 'Padding', 1)
reluLayer()
maxPooling2dLayer(3, 'Stride',2)
];
finalLayers = [
% Add a ReLU non-linearity.
reluLayer()
fullyConnectedLayer(width(wlDataset))
% Add the softmax loss layer and classification layer.
softmaxLayer()
classificationLayer()
];
% Combine the input, middle, and final layers.
layers = [
inputLayer
middleLayers
finalLayers
];
optionsStage1 = trainingOptions('sgdm', ...
'MaxEpochs', 10, ...
'MiniBatchSize', 1, ...
'InitialLearnRate', 1e-3, ...
'CheckpointPath', tempdir);
% Options for step 2.
optionsStage2 = trainingOptions('sgdm', ...
'MaxEpochs', 10, ...
'MiniBatchSize', 1, ...
'InitialLearnRate', 1e-3, ...
'CheckpointPath', tempdir);
% Options for step 3.
optionsStage3 = trainingOptions('sgdm', ...
'MaxEpochs', 10, ...
'MiniBatchSize', 1, ...
'InitialLearnRate', 1e-3, ...
'CheckpointPath', tempdir);
% Options for step 4.
optionsStage4 = trainingOptions('sgdm', ...
'MaxEpochs', 10, ...
'MiniBatchSize', 1, ...
'InitialLearnRate', 1e-3, ...
'CheckpointPath', tempdir);
options = [
optionsStage1
optionsStage2
optionsStage3
optionsStage4
];
%%
doTrainingAndEval = true;
if doTrainingAndEval
% Set random seed to ensure example training reproducibility.
rng(1);
% Train Faster R-CNN detector. Select a BoxPyramidScale of 1.2 to allow
% for finer resolution for multiscale object detection.
fasterrcnn = trainFasterRCNNObjectDetector(trainingData, layers, options, ...
'NegativeOverlapRange', [0 0.3], ...
'PositiveOverlapRange', [0.6 1], ...
'NumRegionsToSample', [256 128 256 128], ...
'BoxPyramidScale', 1.2);
else
% Load pretrained detector for the example.
% detector = data.detector;
end
============================================
%% Train Fast R-CNN building Detector
clc;
wlDataset = wlData;
idx = floor(0.6 * height(wlDataset));
trainingData = wlDataset(1:idx,:);
testData = wlDataset(idx:end,:);
inputLayer = imageInputLayer([32 32 3]);
filterSize = [3 3];
numFilters = 32;
% Create the middle layers.
middleLayers = [
convolution2dLayer(filterSize, numFilters, 'Padding', 1)
reluLayer()
convolution2dLayer(filterSize, numFilters, 'Padding', 1)
reluLayer()
maxPooling2dLayer(3, 'Stride',2)
];
finalLayers = [
fullyConnectedLayer(64)
reluLayer()
fullyConnectedLayer(width(wlDataset))
softmaxLayer()
classificationLayer()
];
layers = [
inputLayer
middleLayers
finalLayers
];
options = trainingOptions('sgdm', ...
'MiniBatchSize', 1, ...
'InitialLearnRate', 1e-3, ...
'MaxEpochs', 10, ...
'CheckpointPath', tempdir);
frcnn = trainFastRCNNObjectDetector(trainingData, layers, options);

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by