Ask Your Question

Revision history [back]

You can do this :

Ptr<ANN_MLP> modeleANN;
modeleANN = ANN_MLP::load("opencv_ml_ann_mlp.yml");

your model is ready to predict

You can do this :

Ptr<ANN_MLP> modeleANN;
modeleANN = ANN_MLP::load("opencv_ml_ann_mlp.yml");

or

Ptr<ANN_MLP> modeleANN;
modeleANN = Algorithm::load<ANN_MLP>("opencv_ml_ann_mlp.yml");

your model is ready to predict

You can do this :

Ptr<ANN_MLP> modeleANN;
modeleANN = ANN_MLP::load("opencv_ml_ann_mlp.yml");

or

Ptr<ANN_MLP> modeleANN;
modeleANN = Algorithm::load<ANN_MLP>("opencv_ml_ann_mlp.yml");

your model is ready to predictpredict :

modeleANN->predict(feature, result);
Point pos;
minMaxLoc(result, &minX, &maxX, NULL, &pos);
cout << modeleANN->getDefaultName() << " \tclass = " << pos.x << "\t network output "<<result<<"\n";