Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how do i load and use TrainData

I downloaded training set for digit recognition. The training set is in csv format , the first column contains the responses and pixel value of the following response is stored the corresponding row. I am trying to write a c++ code in visual studio that uses the ml module of open cv 3.00 to train from the data. I can load the data using the TrainData::loadFromCSV function but i am unable to understand how will it generate the samples and responses matrix that is required to feed into the TrainData::create command my code: void main() { TrainData::loadFromCSV("C:/Users/Shreya Srivastava/Desktop/train.csv",0,1,10); Mat samples ( 28,28, CV_32FC1 ); Mat responses(35591,0,CV_32F); TrainData::create(samples,ROW_SAMPLE,responses); imshow("samples",samples);

waitKey();

}

click to hide/show revision 2
No.2 Revision

updated 2016-12-29 03:05:16 -0600

berak gravatar image

how do i load and use TrainData

I downloaded training set for digit recognition. The training set is in csv format , the first column contains the responses and pixel value of the following response is stored the corresponding row. I am trying to write a c++ code in visual studio that uses the ml module of open cv 3.00 to train from the data. I can load the data using the TrainData::loadFromCSV function but i am unable to understand how will it generate the samples and responses matrix that is required to feed into the TrainData::create command my code: code:

void main()
{
    TrainData::loadFromCSV("C:/Users/Shreya Srivastava/Desktop/train.csv",0,1,10);
    Mat samples ( 28,28, CV_32FC1 );
    Mat responses(35591,0,CV_32F);
    TrainData::create(samples,ROW_SAMPLE,responses);
    imshow("samples",samples);

imshow("samples",samples);
 waitKey();
}

}