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 CenterFile Exchange에서 Deep Learning with GPU Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!