I want to apply Alexnet to faster RCNN

1 visualizzazione (ultimi 30 giorni)
Jungmoon Kim
Jungmoon Kim il 22 Ago 2017
Modificato: taha khan il 5 Mag 2018
Hello, I am Jungmoon. I am studying the faster RCNN. And I am trying to apply the Alexnet to faster RCNN. I found the contents of Alexnet's network in matlab' help. Here is alexnet's layer array.
Then, I modified faster RCNN with the contents of Alexnet. There is big problem. I show the problem with a picture.
Pleas help me.
  2 Commenti
Jungmoon Kim
Jungmoon Kim il 22 Ago 2017
Modificato: Walter Roberson il 22 Ago 2017
Here is my code.
Please....
Thank you~!
inputLayer = imageInputLayer([227 227 3]);
middleLayers = [
convolution2dLayer([11 11], 96,'stride',4, 'Padding', 0, 'NumChannels',3 )
reluLayer()
crossChannelNormalizationLayer(5)
maxPooling2dLayer(3,'stride',2, 'Padding',0)
convolution2dLayer([5 5], 256,'stride',1, 'Padding', 2, 'NumChannels',96)
reluLayer()
crossChannelNormalizationLayer(5)
maxPooling2dLayer(3,'stride',2, 'Padding',0)
convolution2dLayer([3 3], 384,'stride',1, 'Padding', 1,'NumChannels',256)
reluLayer()
convolution2dLayer([3 3], 384,'stride',1, 'Padding', 1, 'NumChannels',384)
reluLayer()
convolution2dLayer([3 3], 256,'stride',1, 'Padding', 1,'NumChannels',384)
reluLayer()
maxPooling2dLayer(3,'stride',2, 'Padding',0)
];
finalLayers = [
% Add a fully connected layer with 64 output neurons. The output size
% of this layer will be an array with a length of 64.
fullyConnectedLayer(4096)
reluLayer()
dropoutLayer(0.5)
fullyConnectedLayer(4096)
reluLayer()
dropoutLayer(0.5)
fullyConnectedLayer(width(Dataset))
% Add the softmax loss layer and classification layer.
softmaxLayer()
classificationLayer()
];
layers = [
inputLayer
middleLayers
finalLayers
]
optionsStage1 = trainingOptions('sgdm', ...
'MiniBatchSize', 4, ...
'MaxEpochs', 10, ...
'InitialLearnRate', 1e-5, ...
'CheckpointPath', tempdir);
% Options for step 2
optionsStage2 = trainingOptions('sgdm', ...
'MiniBatchSize', 4, ...
'MaxEpochs', 10, ...
'InitialLearnRate', 1e-5, ...
'CheckpointPath', tempdir);
% Options for step 3.
optionsStage3 = trainingOptions('sgdm', ...
'MiniBatchSize', 4, ...
'MaxEpochs', 10, ...
'InitialLearnRate', 1e-6, ...
'CheckpointPath', tempdir);
% Options for step 4.
optionsStage4 = trainingOptions('sgdm', ...
'MiniBatchSize', 4, ...
'MaxEpochs', 10, ...
'InitialLearnRate', 1e-6, ...
'CheckpointPath', tempdir);
options = [
optionsStage1
optionsStage2
optionsStage3
optionsStage4
];
tic
% A trained network is loaded from disk to save time when running the
% example. Set this flag to true to train the network.
doTrainingAndEval = true %false;
if doTrainingAndEval
% Set random seed to ensure example training reproducibility.
rng(0);
% Train Faster R-CNN detector. Select a BoxPyramidScale of 1.2 to allow
% for finer resolution for multiscale object detection.
detector = trainFasterRCNNObjectDetector(trainingData, layers, options, ...
'NegativeOverlapRange', [0 0.3], ...
'PositiveOverlapRange', [0.6 1], ...
'SmallestImageDimension', [400], ...
'BoxPyramidScale', 1.2);
else
% 'NumStrongestRegions', 500, ...
% 'MinBoxSizes', [21 21], ...
% Load pretrained detector for the example.
detector = data.detector;
end
toc
Joss Knight
Joss Knight il 24 Ago 2017
AlexNet comes with Matlab as an add-on. Just type net = alexnet at the command line.

Accedi per commentare.

Risposta accettata

Carl
Carl il 24 Ago 2017
Hi Jungmoon. The [48,48] and [128,128] indicate that the 96 channels and 256 filters are split up into two groups. This is part of the implementation of AlexNet. Each set of filters are applied to a different group. As of now, there is no way of replicating this behavior using the "convolution2dLayer" function in the Neural Network Toolbox.
You should be fine specifying 96 and 256 for NumChannels and NumFilters. I believe the original intention of this behavior was just to make it easier to split the computation between GPUs. Functionally, I believe your current setup should behave similarly.
  3 Commenti
Elif BAYKAL
Elif BAYKAL il 28 Mar 2018
I also met the same problem. Could you share how you solved it, please?
Carlos
Carlos il 12 Apr 2018
share the solution, please

Accedi per commentare.

Più risposte (2)

taha khan
taha khan il 30 Apr 2018
Modificato: taha khan il 30 Apr 2018
https://www.mathworks.com/matlabcentral/answers/353563-i-want-to-apply-alexnet-to-faster-rcnn#answer_317984 sir i am retrain AlexNet throught this way... retrain Alex Net .....but my training speed is too much slow? sir any one help me how to increase my training speed ?? how to increase my processing power of CPU ???

taha khan
taha khan il 5 Mag 2018
Modificato: taha khan il 5 Mag 2018
how to do live streaming with train network ?

Categorie

Scopri di più su 영상에서의 딥러닝 in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!