diff --git a/bob/learn/em/cpp/GMMMachine.cpp b/bob/learn/em/cpp/GMMMachine.cpp index 7b8b3daff0a185995cf6a08a7c0e0ed80bf5ad47..a3cbe444ab525157c196148d5bafdc311fd0830a 100644 --- a/bob/learn/em/cpp/GMMMachine.cpp +++ b/bob/learn/em/cpp/GMMMachine.cpp @@ -31,6 +31,7 @@ bob::learn::em::GMMMachine::GMMMachine(const GMMMachine& other) copy(other); } + bob::learn::em::GMMMachine& bob::learn::em::GMMMachine::operator=(const bob::learn::em::GMMMachine &other) { // protect against invalid self-assignment if (this != &other) @@ -91,7 +92,9 @@ void bob::learn::em::GMMMachine::copy(const GMMMachine& other) { initCache(); } -bob::learn::em::GMMMachine::~GMMMachine() { } + +bob::learn::em::GMMMachine::~GMMMachine() { +} ///////////////////// diff --git a/bob/learn/em/gmm_machine.cpp b/bob/learn/em/gmm_machine.cpp index fc27dec08edc6bab49dfaa134864cc3ae9551ad8..51bcc2685962f98c32008388a11e56b1b756cf7c 100644 --- a/bob/learn/em/gmm_machine.cpp +++ b/bob/learn/em/gmm_machine.cpp @@ -720,16 +720,13 @@ static PyObject* PyBobLearnEMGMMMachine_get_gaussian(PyBobLearnEMGMMMachineObjec if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i", kwlist, &i)) return 0; - boost::shared_ptr<bob::learn::em::Gaussian> gaussian = self->cxx->getGaussian(i); - //Allocating the correspondent python object PyBobLearnEMGaussianObject* retval = (PyBobLearnEMGaussianObject*)PyBobLearnEMGaussian_Type.tp_alloc(&PyBobLearnEMGaussian_Type, 0); - retval->cxx = gaussian; - - //return reinterpret_cast<PyObject*>(retval); - return Py_BuildValue("O",retval); + retval->cxx = self->cxx->getGaussian(i); + + return Py_BuildValue("N",retval); BOB_CATCH_MEMBER("cannot compute the likelihood", 0) } diff --git a/bob/learn/em/gmm_stats.cpp b/bob/learn/em/gmm_stats.cpp index cda8d38997303eaf36b7b49427e3cbc1abdd598d..9bf07bdf981e4cb696c31fc803e295344c1ce980 100644 --- a/bob/learn/em/gmm_stats.cpp +++ b/bob/learn/em/gmm_stats.cpp @@ -84,13 +84,23 @@ static int PyBobLearnEMGMMStats_init_hdf5(PyBobLearnEMGMMStatsObject* self, PyOb char** kwlist = GMMStats_doc.kwlist(2); + /* PyBobIoHDF5FileObject* config = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&", kwlist, &PyBobIoHDF5File_Converter, &config)){ GMMStats_doc.print_usage(); return -1; } + */ - self->cxx.reset(new bob::learn::em::GMMStats(*(config->f))); + PyObject* config = 0; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!", kwlist, &PyBobIoHDF5File_Type, &config)){ + GMMStats_doc.print_usage(); + return -1; + } + + auto h5f = reinterpret_cast<PyBobIoHDF5FileObject*>(config); + + self->cxx.reset(new bob::learn::em::GMMStats(*(h5f->f))); return 0; }