From 012d0e2b57fa10efa9a92f0f70f6385284f3ae81 Mon Sep 17 00:00:00 2001 From: antoni Date: Sun, 18 Feb 2024 22:53:54 +0100 Subject: [PATCH] MIDI60: new config related to: https://github.com/anthonio9/penn/issues/9 --- config/ppn-split-midi60.py | 45 ++++++++++++++++++++++++++++++++++++ penn/data/preprocess/core.py | 7 +----- penn/train/core.py | 4 ++-- 3 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 config/ppn-split-midi60.py diff --git a/config/ppn-split-midi60.py b/config/ppn-split-midi60.py new file mode 100644 index 0000000..29924e9 --- /dev/null +++ b/config/ppn-split-midi60.py @@ -0,0 +1,45 @@ +MODULE = 'penn' + +# Configuration name +CONFIG = 'ppn-split-midi60' + +# gset only +DATASETS = ['gset'] + +EVALUATION_DATASETS = ['gset'] + +STEPS = 50000 + +LOG_INTERVAL = 500 + +CHECKPOINT_INTERVAL = 5000 # steps + +# audio parameters +SAMPLE_RATE = 11025 + +# the original hopsize is 256 samples, this is 4 times less than that +HOPSIZE = 64 + +# use only the voiced frames +VOICED_ONLY = True + +STRING_INDEX = None + +# poly pitch net model +MODEL = 'ppnmidi60' + +PITCH_BINS = 60 + +PITCH_CATS = 6 + +GSET_SPLIT_PLAYERS = True + +REMOVE_OVERHANGS = True + +MIDI60 = True + +MIDI_OFFSET_RAND = 36 + +GAUSSIAN_BLUR = False + +INTERPOLATE_UNVOICED = False diff --git a/penn/data/preprocess/core.py b/penn/data/preprocess/core.py index 0edd44d..9ec531d 100644 --- a/penn/data/preprocess/core.py +++ b/penn/data/preprocess/core.py @@ -266,8 +266,6 @@ def gset(): pitch, times = extract_pitch_array_jams( jams_track, audio_file.stem, uniform=True) - breakpoint() - if penn.STRING_INDEX is not None: pitch = pitch[penn.STRING_INDEX, :] pitch = pitch[None, :] @@ -275,7 +273,6 @@ def gset(): if penn.INTERPOLATE_UNVOICED: # Fill unvoiced regions via linear interpolation pitch, voiced = interpolate_unvoiced(pitch) - breakpoint() else: unvoiced = pitch == 0 voiced = ~unvoiced @@ -812,9 +809,7 @@ def notes_dict_to_pitch_array60( below36 = midi_array[midi_array < 36] - if not (below36 == 0).all(): - breakpoint() - pass + assert not (below36 == 0).all(): offset_array = np.vstack(offset_list) diff --git a/penn/train/core.py b/penn/train/core.py index 742c250..67ca614 100644 --- a/penn/train/core.py +++ b/penn/train/core.py @@ -167,11 +167,11 @@ def train(datasets, directory, gpu=None, use_wand=False): loader=test_loader, gpu=gpu) - if use_wand: + if use_wand and not penn.MIDI60: log_wandb.log({"test_logits": wandb.Image(fig)}) # Evaluate - if step % penn.LOG_INTERVAL == 0: + if step % penn.LOG_INTERVAL == 0 and not penn.MIDI60: evaluate_fn = functools.partial( evaluate, directory,