I want to apply Alexnet to faster RCNN

4 ビュー (過去 30 日間)
Jungmoon Kim
Jungmoon Kim 2017 年 8 月 22 日
編集済み: taha khan 2018 年 5 月 5 日
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 件のコメント
Jungmoon Kim
Jungmoon Kim 2017 年 8 月 22 日
編集済み: Walter Roberson 2017 年 8 月 22 日
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 2017 年 8 月 24 日
AlexNet comes with Matlab as an add-on. Just type net = alexnet at the command line.

サインインしてコメントする。

採用された回答

Carl
Carl 2017 年 8 月 24 日
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 件のコメント
Elif BAYKAL
Elif BAYKAL 2018 年 3 月 28 日
I also met the same problem. Could you share how you solved it, please?
Carlos
Carlos 2018 年 4 月 12 日
share the solution, please

サインインしてコメントする。

その他の回答 (2 件)

taha khan
taha khan 2018 年 4 月 30 日
編集済み: taha khan 2018 年 4 月 30 日
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 2018 年 5 月 5 日
編集済み: taha khan 2018 年 5 月 5 日
how to do live streaming with train network ?

カテゴリ

Help Center および File ExchangeDeep Learning with GPU Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!