non maximum suppression boxes display
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
- Wgtruth.mat
- gun.mat
- gun1.jpg
- gun2.jpg
- gun3.jpg
- gun4.jpg
- gun5.jpg
- gun6.jpg
- gun7.jpg
- gun8.jpg
- gun9.jpg
- gun10.jpg
- gun11.jpg
- gun12.jpg
- gun13.jpg
- gun14.jpg
- gun15.jpg
- gun16.jpg
- gun17.jpg
- gun18.jpg
- gun19.jpg
- gun20.jpg
- gun21.jpg
- gun22.jpg
- gun23.jpg
- gun24.jpg
- gun25.jpg
- gun26.jpg
- gun27.jpg
- gun28.jpg
- gun29.jpg
- gun30.jpg
- gun31.jpg
- gun32.jpg
- gun33.jpg
- gun34.jpg
- gun35.jpg
- gun36.jpg
- gun37.jpg
- gun38.jpg
- gun39.jpg
- gun40.jpg
- gun41.jpg
- gun42.jpg
- gun43.jpg
- gun44.jpg
- gun45.jpg
- gun46.jpg
- gun47.jpg
- gun48.jpg
- gun49.jpg
- gun50.jpg
- gun51.jpg
- gun52.jpg
- gun53.jpg
- gun54.jpg
- gun55.jpg
- gun56.jpg
- gun57.jpg
- gun58.jpg
- gun59.jpg
- gun60.jpg
- gun61.jpg
- gun62.jpg
- gun63.jpg
- gun64.jpg
- gun65.jpg
- gun66.jpg
- gun67.jpg
- gun68.jpg
- gun69.jpg
- gun70.jpg
- gun71.jpg
- gun72.jpg
- gun73.jpg
- gun74.jpg
- gun75.jpg
- gun76.jpg
- gun77.jpg
- gun78.jpg
- gun79.jpg
- gun80.jpg
- gun81.jpg
- gun82.jpg
- gun83.jpg
- gun84.jpg
- gun85.jpg
- gun86.jpg
- gun87.jpg
- gun88.jpg
- gun89.jpg
- gun90.jpg
Hi all and thank you for responding in advance!
I am trying to display the region proposals and the bounding boxes on the Test Image!
Can someone guide me on coding the maximum suppression to display the boxes on the test output image?
Here is my code and thank you inadvance, attach is the files as well as the image that is being classified.
I want to display all the boxes on that image to see if the reagions are being distorted.
Thank you once more!
%% Classifing Features With SVM
%% Improving The Bounding Box
clc
clearvars
clear
close all
Newlayers = [
imageInputLayer([32 32 3],"Name","imageinput")
convolution2dLayer([5 5],32,"Name","conv","BiasLearnRateFactor",2,"Padding",[2 2 2 2],"WeightsInitializer","narrow-normal")
maxPooling2dLayer([3 3],"Name","maxpool","Stride",[2 2])
reluLayer("Name","relu")
convolution2dLayer([5 5],32,"Name","conv_1","BiasLearnRateFactor",2,"Padding",[2 2 2 2],"WeightsInitializer","narrow-normal")
reluLayer("Name","relu_1")
averagePooling2dLayer([3 3],"Name","avgpool","Stride",[2 2])
convolution2dLayer([5 5],64,"Name","conv_2","BiasLearnRateFactor",2,"Padding",[2 2 2 2],"WeightsInitializer","narrow-normal")
reluLayer("Name","relu_2")
averagePooling2dLayer([3 3],"Name","avgpool_1","Stride",[2 2])
fullyConnectedLayer(64,"Name","fc","BiasLearnRateFactor",2,"WeightsInitializer","narrow-normal")
reluLayer("Name","relu_3")
fullyConnectedLayer(2,"Name","fc_rcnn","BiasL2Factor",1,"BiasLearnRateFactor",5,"WeightLearnRateFactor",8,"WeightsInitializer","narrow-normal")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")]
load('Wgtruth.mat');
%% Save Empty .Mat File/ Save Variables To File Then Load All
save gun.mat Wgtruth Newlayers
load('gun.mat', 'Wgtruth', 'Newlayers')
%% Add the image directory to the MATLAB path.
imDir = fullfile(matlabroot, 'Wgtruth')
addpath(imDir)
options = trainingOptions('sgdm','MiniBatchSize', 10,'InitialLearnRate', 1e-4,'MaxEpochs', 67)
rcnn = trainRCNNObjectDetector(Wgtruth, Newlayers, options, 'NegativeOverlapRange', [0 0.3])
%% Test the R-CNN detector on a test image.
img = imread('14.jpg');
[bbox, score, label] = detect(rcnn, img, 'MiniBatchSize', 10)
[score, idx] = max(score)
bbox = bbox(idx, :)
annotation = sprintf('%s: (Confidence = %f)', label(idx), score);
detectedImg = insertObjectAnnotation(img, 'rectangle', bbox, annotation);
figure
imshow(detectedImg);
0 Commenti
Risposte (1)
Ajay Pattassery
il 19 Feb 2020
Modificato: Ajay Pattassery
il 19 Feb 2020
I assume you would like to see all the bounding boxes from the output of the R-CNN Object detector.
For this, you could give the argument SelectStrongest as false in the detect function.
[bboxes,scores] = detect(rcnn,img,'SelectStrongest',false);
7 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!