Opencv-3.0.0, python, SVM.load() is missing

asked 2015-11-01 09:01:28 -0600

student5302 gravatar image

updated 2015-11-01 09:16:06 -0600

Hi everybody, I have built opencv3.0.0 on my archlinux (x64) and use it in python3 script. Where is SVM.load() method now?

algoritms.py", line 80, in load
self.model.load(fn)
AttributeError: 'cv2.ml_SVM' object has no attribute 'load'

In

class StatModel(object):
    def load(self, fn):
        logging.info(dir(self.model))
        self.model.load(fn)

    def save(self, fn):
        self.model.save(fn)

    def serialize(self):
        data_path = tempfile.mktemp()
        self.save(data_path)

        with open(data_path, 'rb') as fd:
            data = fd.read()

        os.unlink(data_path)
        return data

    def deserialize(self, data):
        data_path = tempfile.mktemp()
        with open(data_path, 'wb') as fd:
            fd.write(data)

        self.load(data_path)
        os.unlink(data_path)

And maybe someone can suggests more suitable serialize/deserialize implementation?

edit retag flag offensive close merge delete

Comments

berak gravatar imageberak ( 2015-11-01 14:12:43 -0600 )edit

@berak, could you suggest temporary fix/patch/solution?

student5302 gravatar imagestudent5302 ( 2015-11-02 14:19:01 -0600 )edit