SVM in sequence segmenation fault
When you try to train several SVMs in sequence we have segmentation fault.
Follow a code that reproduces the issue (2 SVMs in sequence):
import bob.learn.libsvm
import numpy
numpy.random.seed(10)
for i in range(2):
pos = numpy.random.normal(0., 1, size=(100, 2))
neg = numpy.random.normal(1., 1, size=(100, 2))
data = [pos, neg]
trainer = bob.learn.libsvm.Trainer()
trainer.kernel_type = 'LINEAR'
trainer.cost = 1
trainer.train(data)
However, if you free the data variables in the end of loop for, everything runs fine
import bob.learn.libsvm
import numpy
numpy.random.seed(10)
for i in range(2):
pos = numpy.random.normal(0., 1, size=(100, 2))
neg = numpy.random.normal(1., 1, size=(100, 2))
data = [pos, neg]
trainer = bob.learn.libsvm.Trainer()
trainer.kernel_type = 'LINEAR'
trainer.cost = 1
trainer.train(data)
del data
del pos
del neg
I'm still debugging, but it seems that the issue is somewhere here in the bindings (https://gitlab.idiap.ch/bob/bob.learn.libsvm/blob/master/bob/learn/libsvm/trainer.cpp#L616)