deezer / deezer/spleeter

[Bug] Spleeter returns previous prediction when running more than once

Open
#822 2 comments 0 reactions 0 assignees View on GitHub
bug invalid
Dominant language
Python
Stars
28.4k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

- [x] I didn't find a similar issue already open.
- [x] I read the documentation (README AND Wiki)
- [x] I have installed FFMpeg
- [x] My problem is related to Spleeter only, not a derivative product (such as Webapplication, or GUI provided by others)

## Description

Spleeter returns the prediction of the previous waveform when running separate method with the same separator object more than once.

e.g:
file1 --separate--> prediction of file1
file2 --separate--> prediction of file1
file3 --separate--> prediction of file2

I am using spleeter version 2.3.2, installed with pip in a conda environment with python 3.8.15.

## Step to reproduce

I wrote a small script which should illustrate and reproduce the bug:

```python
from spleeter.separator import Separator
from spleeter.audio.adapter import AudioAdapter
import sounddevice as sd

path1 = '../../Downloads/Doja Cat - Say So (Official Video) (152kbit_Opus).opus'
path2 = '../../Downloads/Fred again - Danielle (smile on my face) [Visualiser]/Fred again.. - Danielle (smile on my face) [Visualiser] (152kbit_Opus).opus'
path3 = '../../Downloads/Retrograde (Original Mix)/Retrograde (Original Mix) (128kbit_AAC).wav'
sample_rate = 44100

seconds = 5
start = sample_rate*41
end = int(start+sample_rate*seconds)

separator = Separator('spleeter:2stems')

audio_loader = AudioAdapter.default()
waveform1, _ = audio_loader.load(path1, sample_rate=sample_rate)
print(f'Shape of Waveform1 vocal: {waveform1.shape}')

waveform2, _ = audio_loader.load(path2, sample_rate=sample_rate)
print(f'Shape of Waveform2 vocal: {waveform2.shape}')

waveform3, _ = audio_loader.load(path3, sample_rate=sample_rate)
print(f'Shape of Waveform3 vocal: {waveform3.shape}')

prediction1 = separator.separate(waveform1)
print(f'Shape of prediction1 vocal: {prediction1["vocals"].shape}')
prediction2 = separator.separate(waveform2)
print(f'Shape of prediction2 vocal: {prediction2["vocals"].shape}')
prediction3 = separator.separate(waveform3)
print(f'Shape of prediction3 vocal: {prediction3["vocals"].shape}')

print('Play vocal prediction 1')
sd.play(prediction1['vocals'][start:end], sample_rate)
sd.wait()

print('Play vocal prediction 2')
sd.play(prediction2['vocals'][start:end], sample_rate)
sd.wait()

print('Play vocal prediction 3')
sd.play(prediction3['vocals'][start:end], sample_rate)
sd.wait()
```

## Environment

| | |
| ----------------- | ------------------------------- |
| OS | Linux (popOS) |
| Installation type | pip |
| RAM available | 16 GB |
| Hardware spec | GPU: RTX 3070 (Mobile) / CPU: i7-12700H |

## Additional context

Contributor guide

Open the contributing guide

Research direction

Start with the Separator.separate entry point and reproduce the issue using the provided script with one separator object and three waveforms. Check whether each returned prediction corresponds to its input rather than the previous one, and use that repeated-call behavior as the completion criterion.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.