How to load ANN in opencv 3.xxx
i have trained an ANN and saved it. now i want to load it and input images in to it and classify. how can i do this? example code will be so helpful. Thanks
i have trained an ANN and saved it. now i want to load it and input images in to it and classify. how can i do this? example code will be so helpful. Thanks
You can do this :
Ptr<ANN_MLP> modeleANN;
modeleANN = ANN_MLP::load("opencv_ml_ann_mlp.yml");
Ptr<ANN_MLP> modeleANN;
modeleANN = Algorithm::load<ANN_MLP>("opencv_ml_ann_mlp.yml");
your model is ready to predict :
modeleANN->predict(feature, result);
Point pos;
minMaxLoc(result, &minX, &maxX, NULL, &pos);
cout << modeleANN->getDefaultName() << " \tclass = " << pos.x << "\t network output "<<result<<"\n";
Asked: 2017-05-31 06:10:19 -0600
Seen: 590 times
Last updated: Jun 02 '17
Area of a single pixel object in OpenCV
build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04
OpenCV DescriptorMatcher matches
Can't compile .cu file when including opencv.hpp
Using OpenCV's stitching module, strange error when compositing images
compile error in opencv2/flann/lsh_table.h when compiling bgslibrary