Ask Your Question

Muaaz's profile - activity

2015-09-23 14:00:09 -0500 received badge  Supporter (source)
2015-09-23 10:07:36 -0500 received badge  Student (source)
2015-09-23 09:59:19 -0500 asked a question How to load EM model using OpenCV android sdk V3.0.0

Hi all, I am using EM.Java to create a model and I save it to the file but I can't find the way to load it back for prediction purpose.

    EM model = EM.create();
    model.setClustersNumber(32);
    model.setCovarianceMatrixType(EM.COV_MAT_SPHERICAL);
    model.setTermCriteria(new TermCriteria(TermCriteria.COUNT+TermCriteria.EPS, 500, 0.001));
   boolean b = model.trainEM(mMatrix);
    if(b){

        model.save("TrainedModelGMM.xml");
    }

I will really appriciate if some one can guide me how to load trained model ?

2015-09-22 23:58:57 -0500 answered a question Problem Saving trained EM (Java)

Hi Nicolas, I am also facing same problem, did you manage to solve the problem (saving trained EM model in java)? I think one needs to use class CVStatModel.Java As per description it says it save complete model state to XML/YAML File. One can also load trained models using same class. Haven't tried it yet myself, will try tomorrow. I have just tried OpenCV 3.0.0 and with that you can save the model but I am now unable to load that model.

    EM model = EM.create();
    model.setClustersNumber(32);
    model.setCovarianceMatrixType(EM.COV_MAT_SPHERICAL);
    model.setTermCriteria(new TermCriteria(TermCriteria.COUNT+TermCriteria.EPS, 500, 0.001));
   boolean b = model.trainEM(mGray);
    if(b){

        model.save("TrainedModelGMM");
    }