1

Je demande comment utiliser le trainCascadeObjectDetector alors que je crée déjà une structure de smples positive composée de noms de fichiers et de boîtes de liaison cordinates. J'ai aussi un exemple de fichier d'images négatif. Mais quand je lnche la fonction que le fluxtrain Cascade ObjectDetector matlab

trainCascadeObjectDetector('newDetector.xml', str, negativeFolder, 'FalseAlarmRate', 0.2, 'NumCascadeStages', 5); 

J'ai cette erreur:

Error using trainCascadeObjectDetector>parseInputs (line 306) 
Argument 'POSITIVE_INSTANCES' failed validation with error: 
Cannot find struct field 'imageFilename' in POSITIVE_INSTANCES. 

Error in trainCascadeObjectDetector (line 161) 
parser = parseInputs(varargin{:}); 

Répondre

2

Comme l'erreur dit lui-même, la str ne contient pas un champ appelé imageFilename, qui devrait être le domaine où le les fichiers d'image sont. Citant des documents Matlab:

POSITIVE_INSTANCES is an array of structs with information about the positive instances. The struct fields are: imageFilename - A string that specifies the image name. The image can be true color, grayscale, or indexed, in any of the formats supported by IMREAD.

objectBoundingBoxes - An M-by-4 matrix of [x y width height] 
         bounding boxes specifying object 
         locations. 

Donc, votre argument de str devrait être un tableau de struct avec ces informations, à savoir (fichier1 dispose de 3 boîtes, fichier2 2 et file3 4):

str = struct('imageFileName',{'file1Path', 'file2Path', 'file3Path'},... 
    'objectBoundingBoxes',{[xBox1 yBox1 w1 h1;xBox2 yBox2 w2 h2;xBox3 yBox3 w3 h3]... 
    [xBox1 yBox1 w1 h1;xBox2 yBox2 w2 h2],... 
    [xBox1 yBox1 w1 h1;xBox2 yBox2 w2 h2;xBox3 yBox3 w3 h3,xBox4 yBox4 w4 h4]}); 

ou tout autre comme vous voulez le déclarer. Mais assurez-vous que vous entrez des fichiers dans ce format.

+0

hors sujet mais vous semblez avoir de l'expérience dans les classificateurs en cascade dans MatLab. J'ai besoin de savoir approximativement combien de temps faudrait-il pour former un classificateur en cascade (en utilisant gentleboost) sur 600 images positives et 300 négatives? donné 16 Go de RAM. Même un vague approximatif aiderait énormément! – user961627

+0

@ user961627 Désolé, je ne peux pas vous aider avec ça, je n'utilise pas ce genre de choses. J'ai juste aidé l'OP car l'erreur était juste la syntaxe. – Werner