[opengm] 255/386: made pyMh-learn build again

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:38:05 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository opengm.

commit 9ad0b1cc66370460c6726047fcf4d125b32fb62a
Author: DerThorsten <thorsten.beier at iwr.uni-heidelberg.de>
Date:   Fri Jan 16 11:48:46 2015 +0100

    made pyMh-learn build again
---
 fubar/simple_sp.py                                  |  2 +-
 include/opengm/learning/dataset/dataset_io.hxx      |  6 +++++-
 src/interfaces/python/opengm/learning/__init__.py   | 21 +++------------------
 .../opengm/learning/pyMaxLikelihoodLearner.cxx      |  4 ++--
 4 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/fubar/simple_sp.py b/fubar/simple_sp.py
index 280f70e..1d9c5ea 100644
--- a/fubar/simple_sp.py
+++ b/fubar/simple_sp.py
@@ -124,7 +124,7 @@ fBinary = [
 dataset,test_set = superpixelDataset(imgs=imgs,sps=sps, gts=gts, numberOfLabels=3, 
                                           fUnary=fUnary, fBinary=fBinary, 
                                           addConstFeature=True)
-if False :
+if True :
     dataset.save("simple_dataset", 'simple_')
 if True :
     dataset = learning.createDataset(0,  numInstances=0)
diff --git a/include/opengm/learning/dataset/dataset_io.hxx b/include/opengm/learning/dataset/dataset_io.hxx
index 19c8e44..3681d15 100644
--- a/include/opengm/learning/dataset/dataset_io.hxx
+++ b/include/opengm/learning/dataset/dataset_io.hxx
@@ -59,7 +59,11 @@ namespace opengm{
             ss  << datasetpath <<"/"<<prefix<<"gm_" << m <<".h5"; 
             opengm::hdf5::save(gm, ss.str(), "gm");
             hid_t file = marray::hdf5::openFile(ss.str(), marray::hdf5::READ_WRITE);
-            marray::hdf5::save(file,"gt",gt);
+
+            marray::Vector<LabelType> mgt(gt.size());
+            std::copy(gt.begin(), gt.end(), mgt.begin());
+
+            marray::hdf5::save(file,"gt",mgt);
             hid_t lossGrp = marray::hdf5::createGroup(file,"loss");
             lossParam.save(lossGrp);
             marray::hdf5::closeFile(file);
diff --git a/src/interfaces/python/opengm/learning/__init__.py b/src/interfaces/python/opengm/learning/__init__.py
index 6278b90..ded6d1d 100644
--- a/src/interfaces/python/opengm/learning/__init__.py
+++ b/src/interfaces/python/opengm/learning/__init__.py
@@ -259,27 +259,12 @@ def maxLikelihoodLearner(dataset, maxIterations=1000, reg=1.0, temp=1.0):
     learnerCls = MaxLikelihood_FlexibleLoss
     learnerParamCls = MaxLikelihood_FlexibleLossParameter
 
-<<<<<<< HEAD
-    param = learnerParamCls(
-        maximumNumberOfIterations,
-        gradientStep,
-        weightAccuracy,
-        gradientStoppingCriteria,
-        infoFlag,
-        infoEveryStep,
-	beliefPropagationMaximumNumberOfIterations,
-	beliefPropagationConvergenceBound,
-	beliefPropagationDamping,
-	beliefPropagationReg,
-	beliefPropagationTemperature
-    )
 
-=======
     param = learnerParamCls()
     param.maxIterations = int(maxIterations)
-    param.reg = float(reg)
-    param.temperature = float(temp)
->>>>>>> 2ba1371ee0e19735fd712bb76b3dac678b871beb
+    #param.reg = float(reg)
+    #param.temperature = float(temp)
+
     learner = learnerCls(dataset, param)
         
     return learner
diff --git a/src/interfaces/python/opengm/learning/pyMaxLikelihoodLearner.cxx b/src/interfaces/python/opengm/learning/pyMaxLikelihoodLearner.cxx
index c67825c..724970e 100644
--- a/src/interfaces/python/opengm/learning/pyMaxLikelihoodLearner.cxx
+++ b/src/interfaces/python/opengm/learning/pyMaxLikelihoodLearner.cxx
@@ -58,11 +58,11 @@ namespace opengm{
 
         bp::class_<PyLearnerParam>(paramClsName.c_str(), bp::init<>())
 	  //.def("__init__", make_constructor(&pyMaxLikelihoodParamConstructor<PyLearnerParam> ,boost::python::default_call_policies()))
-            //.def_readwrite("maxIterations", &PyLearnerParam::maxNumSteps_)
+            .def_readwrite("maxIterations", &PyLearnerParam::maximumNumberOfIterations_)
         ;
 
         boost::python::class_<PyLearner>( clsName.c_str(), boost::python::init<DatasetType &, const PyLearnerParam &>() )
-            //.def("learn",&PyLearner::learn)
+            .def("learn",&PyLearner::learn)
         ;
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opengm.git



More information about the debian-science-commits mailing list