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
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: 542 times
Last updated: Jun 02 '17