MATLAB Answers

0

How can I Train a Multi Object Detector Classifier

Asked by Rodrigo Alzola on 7 Oct 2019
Latest activity Edited by Rodrigo Alzola on 7 Oct 2019
Hi everyone.
I need to train a detection algorithm that can detect different objects in a image. I have 14 different clases and in the image it can be find many objects of different clases. I labaled all my training data as the Image Labeler does, using a groundTruth object. So that every object is in a bounding box of 6x6 pixels (I know that is small ROI) in witch every image sample has at least two different objects. I try different tutorial as Training Cascade or RCNN, but without results. Here are my approach:
For the Training Cascade:
load('GT_Data.mat');
source = dataSource.Source;
source = cell2table(source);
positiveInstances = [source labelData];
negativeFolder = 'NegativeFolder';
negativeImages = imageDatastore(negativeFolder);
trainCascadeObjectDetector('MonomerOrientationDetector.xml',positiveInstances, negativeFolder,'FalseAlarmRate',0.1,'NumCascadeStages',5);
detector = vision.CascadeObjectDetector('MonomerOrientationDetector.xml');
load('Test_Data.mat');
img = imread('Test_Data.tiff');
bbox = step(detector,img);
detectedImg = insertObjectAnnotation(img,'rectangle',bbox,'stop sign');
The problem here is that the training model only accept one Label, no 14. So I'll be able only to train the detection for one label. And also I want to know if the model would be able to detect multiple objects and not just one.
For the RCNN:
load('GT_Data.mat');
source = dataSource.Source;
source = cell2table(source);
positiveInstances = [source labelData];
options = trainingOptions('sgdm', 'MiniBatchSize', 32, 'InitialLearnRate', 1e-6, 'MaxEpochs', 10);
labelNames = {'DoubleMonomer_90';'DoubleMonomer_75';'DoubleMonomer_60';'DoubleMonomer_45';...
'DoubleMonomer_30';'DoubleMonomer_15';'DoubleMonomer_0';'DoubleMonomer_n15';'DoubleMonomer_n30';...
'DoubleMonomer_n45';'DoubleMonomer_n60';'DoubleMonomer_n75';'DoubleMonomer_n90';'SingleMonomer'};;
numClassesPlusBackground = numel(labelNames) + 1;
layers = [ ...
imageInputLayer([28 28 1])
convolution2dLayer(5,20)
fullyConnectedLayer(numClassesPlusBackground);
softmaxLayer()
classificationLayer()];
rcnn = trainRCNNObjectDetector(positiveInstances, layers, options, 'NegativeOverlapRange', [0 0.3]);
The probleme here is that the training function is rejecting all my training samples. It is because my bounding boxes for the ROI are to small, I read that it need minumum 88x88 for no rejecting.
If someone can tell me a way to train a model with this kind of description I will appriciate. Or a way to do my own convolutional net or training sistem.
Thank you very much!

  0 Comments

Sign in to comment.

0 Answers