I want to apply Alexnet to faster RCNN

1 次查看(过去 30 天)
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.

更多回答(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 中查找有关 영상에서의 딥러닝 的更多信息

Community Treasure Hunt

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

Start Hunting!