R-CNN detector
조회 수: 4 (최근 30일)
이전 댓글 표시
I have trained Alexnet via transfer learning for my 4 categories(Bush,Branch,Tree,Rock)...How to make a R-CNN detector that i can use for my new images to detect objects within those categories?
Here is the code i used to train my network.
%% Load a pre-trained, deep, convolutional network
alex = alexnet;
layers = alex.Layers
%% Modify the network to use four categories
layers(23) = fullyConnectedLayer(4);
layers(25) = classificationLayer
%% Set up our training data
allImages = imageDatastore('myImages', 'IncludeSubfolders', true, 'LabelSource', 'foldernames');
[trainingImages, testImages] = splitEachLabel(allImages, 0.8, 'randomize');
%% Re-train the Network
opts = trainingOptions('sgdm', 'InitialLearnRate', 0.001, 'MaxEpochs', 20, 'MiniBatchSize', 64);
myNet = trainNetwork(trainingImages, layers, opts);
%% Measure network accuracy
predictedLabels = classify(myNet, testImages);
accuracy = mean(predictedLabels == testImages.Labels)
댓글 수: 0
답변 (1개)
Srivardhan Gadila
2020년 4월 7일
The total number of classes the RCNNdetector should detect will be the number of object classes you want to detect plus an additional background class.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!