LDA training opencv c++
I'm working with retinal images and i' have to use LDA classifier with 2 classes. I have a data Base to train my classifier. For this i had to extract feautures from each image (done) but i couldn't find the way how to trained the classifier with all images in my Data Base and i wanna ask in lda.project i could use my features extracted or no?! and could someone show me how to train LDA with my Data Base ?! DiaretDB 1 in my case ans i have her ground truth. I found this lines in tutorials but i couldn't know how to use it
LDA lda(num_components); // retain N elements (e.g. numClasses-1)
lda.compute(trainData, trainLabels); // compute eigenvectors
Mat projected = lda.project(feature_row); // project feature vecs, then compare in lda-space
for a 1st attempt, you could try with the example here
then, going from ~10000 features to a single number via LDA is probably a bad idea, mostly a PCA compression (before that) is used
i saw this example before but i couldn't understand do i have to resize all my image ? and for the trainig i have to put all the images in one Mat ? or i have to apply the same methode used by him for every image ?! sorry for the question but this is my first time with classification. and i have exctrated 1320 features from each image ( i follow a the instraction of paper to implemente)
idk, how you get your features, but you have to make a single row of those (using reshape()) and stack all the features into a single Mat for training. you also need a labels mat with 1 number (class label) per feature
@break trainLabels it's my groundtruth ? that's mean if that pixel belong to the ROI pixels ? 1 or 0 ?! because i'm working in lesion detection. and i have the ground truth of my data Base
it sounds like it is so, but look at your question, again, you're very vague about anything you do.
yeah because I'm new in opencv andm dealing with classification for the first time sorry. so i have to put all images of the groundtruth in a vector "trainlabels" with row equal to 1 is that right ? thanks for answering and sorry if my questions are bad or blur
if your train features are 1320 numbers per image, you need a data mat with nImages rows and 1320 colums, and a labels mat with nImages rows and1 column (the class id for the resp. image / feature)
@break please i want to repeat the training process 10 time. It's possible to put the training code in loop 10 time or he will squash the information get by the first training saved ?!
why do you want to do this ? (it does not make any sense, and no, you can't continuously "update" it)
i don't think it is even "prepared" for that case.
or did you mean: like a "crossfold validation" ? imho, you have to use a new LDA object for each run here
probably a link to some article / paper would be required now.