Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
music-demixing-challenge-starter-kit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yoyololicon
music-demixing-challenge-starter-kit
Commits
06698849
Commit
06698849
authored
3 years ago
by
chinyun_yu_joey
Browse files
Options
Downloads
Patches
Plain Diff
feat: deterministic shifts in input samples
parent
45d23949
No related branches found
Branches containing commit
Tags
submission-test-demucs-split-5
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
requirements.txt
+1
-0
1 addition, 0 deletions
requirements.txt
test_demucs.py
+10
-3
10 additions, 3 deletions
test_demucs.py
with
11 additions
and
3 deletions
requirements.txt
+
1
−
0
View file @
06698849
...
...
@@ -8,3 +8,4 @@ musdb
SoundFile
scipy
norbert
tqdm
This diff is collapsed.
Click to expand it.
test_demucs.py
+
10
−
3
View file @
06698849
...
...
@@ -3,22 +3,28 @@
import
numpy
as
np
import
soundfile
as
sf
import
torch
from
tqdm
import
tqdm
from
evaluator.music_demixing
import
MusicDemixingPredictor
def
separate
(
audio
,
rate
,
model
,
shifts
=
10
,
device
=
"
cpu
"
):
# convert numpy audio to torch
audio_torch
=
torch
.
tensor
(
audio
.
T
).
float
().
to
(
device
)
max_shift
=
int
(
rate
*
0.5
)
with
torch
.
no_grad
():
y
=
model
(
audio_torch
.
unsqueeze
(
0
)).
squeeze
()
y
=
torch
.
zeros_like
(
audio_torch
).
repeat
(
4
,
1
,
1
)
for
shift
in
tqdm
(
torch
.
linspace
(
0
,
max_shift
,
steps
=
shifts
,
dtype
=
torch
.
long
).
tolist
()):
shifted_y
=
model
(
audio_torch
.
unsqueeze
(
0
)[...,
shift
:]).
squeeze
()
y
[...,
shift
:]
+=
shifted_y
y
/=
shifts
return
y
.
numpy
()
...
...
@@ -45,6 +51,7 @@ class DemucsPredictor(MusicDemixingPredictor):
# Step 3: Perform separation
estimates
=
separate
(
x
,
rate
,
self
.
separator
,
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment