mirror of
https://github.com/YuzuZensai/spleeter.git
synced 2026-01-31 14:58:23 +00:00
Merge branch 'master' into tf2
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
by providing train, evaluation and source separation action.
|
||||
"""
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ from .utils.logging import (
|
||||
enable_tensorflow_logging,
|
||||
get_logger)
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
- Waveform convertion and transforming functions.
|
||||
"""
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
@@ -19,7 +19,7 @@ from tensorflow.signal import stft, hann_window
|
||||
from .. import SpleeterError
|
||||
from ..utils.logging import get_logger
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import tensorflow as tf
|
||||
|
||||
from ..utils.tensor import from_float32_to_uint8, from_uint8_to_float32
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ from .adapter import AudioAdapter
|
||||
from .. import SpleeterError
|
||||
from ..utils.logging import get_logger
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import tensorflow as tf
|
||||
from tensorflow.signal import stft, hann_window
|
||||
# pylint: enable=import-error
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from argparse import ArgumentParser
|
||||
from tempfile import gettempdir
|
||||
from os.path import exists, join
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
@@ -170,6 +170,7 @@ def _create_evaluate_parser(parser_factory):
|
||||
parser.add_argument('-o', '--output_path', **OPT_OUTPUT)
|
||||
parser.add_argument('--mus_dir', **OPT_MUSDB)
|
||||
parser.add_argument('-m', '--mwf', **OPT_MWF)
|
||||
parser.add_argument('-B', '--stft-backend', **OPT_STFT_BACKEND)
|
||||
return parser
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ except ImportError:
|
||||
logger.error('Please install musdb and museval first, abort')
|
||||
sys.exit(1)
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
@@ -77,7 +77,7 @@ def _separate_evaluation_dataset(arguments, musdb_root_directory, params):
|
||||
bitrate='128k',
|
||||
MWF=arguments.MWF,
|
||||
verbose=arguments.verbose,
|
||||
stft_backend="auto"),
|
||||
stft_backend=arguments.stft_backend),
|
||||
params)
|
||||
return audio_output_directory
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
from ..audio.adapter import get_audio_adapter
|
||||
from ..separator import Separator
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ from ..model import model_fn
|
||||
from ..model.provider import ModelProvider
|
||||
from ..utils.logging import get_logger
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ from .utils.tensor import (
|
||||
set_tensor_shape,
|
||||
sync_apply)
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from tensorflow.signal import stft, inverse_stft, hann_window
|
||||
|
||||
from ..utils.tensor import pad_and_partition, pad_and_reshape
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
@@ -275,9 +275,16 @@ class EstimatorSpecBuilder(object):
|
||||
spec_name = self.spectrogram_name
|
||||
|
||||
if stft_name not in self._features:
|
||||
# pad input with a frame of zeros
|
||||
waveform = tf.concat([
|
||||
tf.zeros((self._frame_length, self._n_channels)),
|
||||
self._features['waveform']
|
||||
],
|
||||
0
|
||||
)
|
||||
stft_feature = tf.transpose(
|
||||
stft(
|
||||
tf.transpose(self._features['waveform']),
|
||||
tf.transpose(waveform),
|
||||
self._frame_length,
|
||||
self._frame_step,
|
||||
window_fn=lambda frame_length, dtype: (
|
||||
@@ -341,7 +348,7 @@ class EstimatorSpecBuilder(object):
|
||||
reshaped = tf.transpose(inversed)
|
||||
if time_crop is None:
|
||||
time_crop = tf.shape(self._features['waveform'])[0]
|
||||
return reshaped[:time_crop, :]
|
||||
return reshaped[self._frame_length:self._frame_length+time_crop, :]
|
||||
|
||||
def _build_mwf_output_waveform(self):
|
||||
""" Perform separation with multichannel Wiener Filtering using Norbert.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
""" This package provide model functions. """
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ from tensorflow.keras.layers import (
|
||||
|
||||
from . import apply
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ from tensorflow.compat.v1.keras.initializers import he_uniform
|
||||
|
||||
from . import apply
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from abc import ABC, abstractmethod
|
||||
from os import environ, makedirs
|
||||
from os.path import exists, isabs, join, sep
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import requests
|
||||
from . import ModelProvider
|
||||
from ...utils.logging import get_logger
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
""" Packages that provides static resources file for the library. """
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
@@ -31,7 +31,7 @@ from .utils.estimator import create_estimator, get_default_model_dir
|
||||
from .model import EstimatorSpecBuilder, InputProviderFactory
|
||||
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
@@ -163,14 +163,18 @@ class Separator(object):
|
||||
data = np.asfortranarray(data)
|
||||
N = self._params["frame_length"]
|
||||
H = self._params["frame_step"]
|
||||
|
||||
win = hann(N, sym=False)
|
||||
fstft = istft if inverse else stft
|
||||
win_len_arg = {"win_length": None, "length": length} if inverse else {"n_fft": N}
|
||||
win_len_arg = {"win_length": None,
|
||||
"length": None} if inverse else {"n_fft": N}
|
||||
n_channels = data.shape[-1]
|
||||
out = []
|
||||
for c in range(n_channels):
|
||||
d = data[:, :, c].T if inverse else data[:, c]
|
||||
d = np.concatenate((np.zeros((N, )), data[:, c], np.zeros((N, )))) if not inverse else data[:, :, c].T
|
||||
s = fstft(d, hop_length=H, window=win, center=False, **win_len_arg)
|
||||
if inverse:
|
||||
s = s[N:N+length]
|
||||
s = np.expand_dims(s.T, 2-inverse)
|
||||
out.append(s)
|
||||
if len(out) == 1:
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
""" This package provides utility function and classes. """
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
@@ -16,7 +16,7 @@ from os.path import exists
|
||||
from .. import resources, SpleeterError
|
||||
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import logging
|
||||
|
||||
from os import environ
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import tensorflow as tf
|
||||
import pandas as pd
|
||||
# pylint: enable=import-error
|
||||
|
||||
__email__ = 'research@deezer.com'
|
||||
__email__ = 'spleeter@deezer.com'
|
||||
__author__ = 'Deezer Research'
|
||||
__license__ = 'MIT License'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user