fourMs / MGT-python

Musical Gestures Toolbox for Python
https://www.uio.no/ritmo/english/research/labs/fourms/downloads/software/musicalgesturestoolbox/mgt-python/index.html
GNU General Public License v3.0
52 stars 11 forks source link

Crashing SSM on spectrogram #281

Closed alexarje closed 1 year ago

alexarje commented 1 year ago

I am trying to create an SSM with the spectrogram mode based on a 10-minute-long video file (the same file I have used to create SSM with motiograms). It says that it has created the spectrogram in a couple of seconds:

image

but then suddenly the kernel crashes without any other notice:

image

What is wrong?

alexarje commented 1 year ago

I don't get the crash if I load a 2-minute-long version of the same video (generated with a skip=5). Then it generates a SSM in a few seconds:

image

Is it a memory issue? Strange, though, given that my laptop is quite powerful.

joachimpoutaraud commented 1 year ago

It might be related to a memory issue yes, because it is necessary to compute the dot product of the arrays in order to get the SSM. Consequently, it can be problematic when using long video file. However, it should not crash for a 10-minute-long video.

I need to find a way to compute the dot product in separate thread or by splitting the arrays into multiple sub-arrays.

alexarje commented 1 year ago

Great. I consistently get crashes when attempting to run 10-minute videos. This is on a machine with 16GB RAM.

joachimpoutaraud commented 1 year ago

I have updated the _ssm.py script with a slow_dot function which computes the dot product in an iterative way in order to avoid any memory error issues. This is implemented when video files are longer than ~5minutes. The drawback is that it is much slower but it has fix this issue.