bob.learn.libsvm issues
https://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues
2017-10-21T19:07:03Z
https://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/9
SVM in sequence segmenation fault
2017-10-21T19:07:03Z
Tiago de Freitas Pereira
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....
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)
Bob 2.7.x release
Tiago de Freitas Pereira
Tiago de Freitas Pereira
https://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/8
Segmentation fault when printing bob.learn.libsvm.Machine
2017-10-21T19:07:03Z
André Anjos
Segmentation fault when printing bob.learn.libsvm.Machine
*Created by: 183amir*
Here is the code that leads to the segmentation fault:
```python
import bob.io.base
import bob.learn.libsvm
fin = bob.io.base.HDF5File('scores/svm/regular/svm_machine.hdf5', 'r')
fin.cd('svm_machine')
s...
*Created by: 183amir*
Here is the code that leads to the segmentation fault:
```python
import bob.io.base
import bob.learn.libsvm
fin = bob.io.base.HDF5File('scores/svm/regular/svm_machine.hdf5', 'r')
fin.cd('svm_machine')
svm_machine = bob.learn.libsvm.Machine(fin)
fin.cd('/')
fin.close()
print(svm_machine) # < -- it happens here!
```
Here is the back trace:
```
bin/gdb-python test.py
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /bob-stable/py27/bin/python...(no debugging symbols found)...done.
Starting program: /bob-stable-2016-05-09/py27/bin/python test.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff1403700 (LWP 16549)]
[New Thread 0x7ffff0c02700 (LWP 16550)]
[New Thread 0x7fffee401700 (LWP 16551)]
[New Thread 0x7fffebc00700 (LWP 16552)]
[New Thread 0x7fffe93ff700 (LWP 16553)]
Program received signal SIGSEGV, Segmentation fault.
__memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:33
33 ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S: No such file or directory.
(gdb) bt
#0 __memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:33
#1 0x000000000047da9f in ?? ()
#2 0x00000000005e9b69 in PyUnicodeUCS4_FromFormat ()
#3 0x00007fffe209cf0a in PyBobLearnLibsvmMachine_Repr(PyBobLearnLibsvmMachineObject*) ()
from /bob-stable-2016-05-09/py27/local/lib/python2.7/site-packages/bob/learn/libsvm/_library.so
#4 0x000000000052ef8c in PyObject_Str ()
#5 0x000000000052db50 in ?? ()
#6 0x000000000052cd3b in PyFile_WriteObject ()
#7 0x00000000004d08a7 in PyEval_EvalFrameEx ()
#8 0x00000000004c87a1 in PyEval_EvalCodeEx ()
#9 0x00000000005030ef in ?? ()
#10 0x00000000004f8c72 in PyRun_FileExFlags ()
#11 0x00000000004f7d77 in PyRun_SimpleFileExFlags ()
#12 0x00000000004982f2 in Py_Main ()
#13 0x00007ffff6f12b45 in __libc_start_main (main=0x497d80 <main>, argc=2, argv=0x7fffffffdd88, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdd78)
at libc-start.c:287
#14 0x0000000000497ca0 in _start ()
```
https://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/1
Failing (crashing) nosetests in debug mode
2017-10-21T19:07:03Z
André Anjos
Failing (crashing) nosetests in debug mode
*Created by: siebenkopf*
When compiled in debug mode, the following nose test:
``` sh
$ bin/nosetests bob.learn.libsvm.test_machine:test_data_loading -vs
```
will crash with a:
``` sh
[Blitz++] Precondition failure: Module /remo...
*Created by: siebenkopf*
When compiled in debug mode, the following nose test:
``` sh
$ bin/nosetests bob.learn.libsvm.test_machine:test_data_loading -vs
```
will crash with a:
``` sh
[Blitz++] Precondition failure: Module /remote/idiap.svm/group.torch5spro/externals/py27-debug/usr/include/blitz/array/slicing.cc line 303
Slice is out of range for array: index=270 rank=0
Possible range for index: [0, 269]
python: /remote/idiap.svm/group.torch5spro/externals/py27-debug/usr/include/blitz/array/slicing.cc:303: void blitz::Array<P_numtype, N_rank>::slice(int&, int, blitz::Array<P_numtype, N_rank2>&, blitz::TinyVector<int, N_rank>&, int) [with int N_rank2 = 2; P_numtype = double; int N_rank = 1]: Assertion `0' failed.
Aborted
```
The issue seems to be located in https://github.com/bioidiap/bob.learn.libsvm/blob/master/bob/learn/libsvm/file.cpp#L492, where the k index is getting too high.
To reproduce the issue, checkout bob.learn.libsvm, bootstrap with the debug python version, e.g.:
``` sh
$ /idiap/group/torch5spro/externals/py27-debug/usr/bin/python bootstrap-buildout.py
```
and run the command above.
Happy debugging!