reshape problem while training
I want to train my classifier LDA. I followed this link. but my code is crushing with memory exception and send me to this part of the code of reshape can't someone help me ?!
cv::Mat image1, flat_image;
cv::Mat initial_image = cv::imread("D:\mémoire\DB\to use in training\images_sorted\\image1.jpg", 0);
cv::Mat trainData = initial_image.reshape(1, 1);
////// trainData
for (int i = 2; i < 30; i++)
{
std::string filename = "D:\mémoire\DB\to use in training\images_sorted\\image";
filename = filename + std::to_string(i);
filename = filename + ".jpg";
image1 = cv::imread(filename, 0);
flat_image = image1.reshape(1, 1);
trainData.push_back(flat_image);
}
typical noob error. your image did not load (because the single backslashes in the filename) and you never checked the outcome.
DB\to use
do you vaguely remember, that\t
inserts a TAB ? lol.then, no it'll NEVER work like this. the diaretdb images are 5k * 5k , you cannot use those "as is".
paper mentions SLIC clustering in LAB space, and extracting 20 features from each region ..
it's also no use, loading images as grayscale, when you're looking for yellow dots (exudates)
thanks for your replays. after applying the SLIC I extract the features so I have to give the classifier the images after applying the SLIC clustering or the original ? her an example of image they are not in the grayscale , the ground truth is color image with 2 value 0 or 255 and i'll use it for TrainLabels example . and sorry i couldn't understoood your seconde replay sorry. and you'r right i don't know how I missed the \ instead of \ -__-
I found this answer it's your i think i'll try to correct my code using it answer
have a look at the paper, again, please.
you apply ~100 SLIC clusters per image, then you gather ~20 features per cluster, stack them into a single row, and that's what you use for the classification, not the original images.
(i also wonder, how you gather the ground truth data, the supplied xml files are a total mess :\ )
you have to check:
for every imread() call you do.
just curious, you seem to be at this for quite a while now ;)
any chance, you can actually upload something to your github repos about this, so we can take a look ?
i had some issue i fixed them and I'm back + i have a professor that want to develop all the paper function in a mobile app and for the training i had to rewrite all my java code to c++ for training and the LDA classifier don't exist in opnecv java he said idk. and after wasting a lot of time he want me now to change to SVM classifier instead of LDA -__-
@break sorry for wasting your time but in the training of the SVM. the training Data i have to give to the SVM the image after preprocessing or the train Data is my features extracted from each image ? I'm confused