How to get a random subset of Mat ?
I have a data and label Mat object and at each iteration, I need to generate a random subset of the data and labels. How should I do this?
I have a data and label Mat object and at each iteration, I need to generate a random subset of the data and labels. How should I do this?
You can use TrainData classes. First create an object TrainData :
Ptr<ml::traindata> t=ml::TrainData::create(data, ROW_SAMPLE, label);
theh you use SetTrainTestSplitRatio to shuffle data. You can get test data and train data using getTestSample or getTrainSamples method
You can read this example too
Asked: 2018-01-23 08:02:17 -0600
Seen: 628 times
Last updated: Jan 23 '18
OpenCV DescriptorMatcher matches
How to build a regression tree over binary variables?
What is the usage of CV_DTREE_CAT_DIR?
Conversion between IplImage and MxArray
Video On Label OpenCV Qt :: hide cvNamedWindows
Problems using the math.h class with OpenCV (c++, VS2012)
How to reduce false positives for face detection
Area of a single pixel object in OpenCV
build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04