Closed htluandc2 closed 2 years ago
Hello,
Yes, this is my mistake, I did not write correct values for melsMinMin, melsMinMax etc. And now I do not remember them. But this check is just for debugging purpose, I used it during writing the code to ensure that mels values are reasonable and that I did not make some dumb mistake.
This check is not really required, and you can simply comment out "else branch" in the following block:
try: assert melsMinMin < newMels.min() < melsMinMax and melsMeanMin < newMels.mean() < melsMeanMax \
and melsMaxMin < newMels.max() < melsMaxMax, 'Wrong mels decibels range'
except:
if i == len(splits) - 2 and newMels.min() == newMels.mean() == newMels.max() == -100:
print('WARNING: Skipping strange sequence with all mels = -100 Db')
continue
# else:
# print(newMels.min(), newMels.mean(), newMels.max())
# raise
Thank you very much.
Hi, After this section, I meet another issue: The number of numpy array is not consistent....
AssertionError Traceback (most recent call last)
Hi,
I am not quite sure, but one possible reason of the error may be the following. In the previous section "Mels", "Onsets", "Offsets" and "Volumes" numpy arrays were created for each musical piece. Then, in your section with the error, numpy arrays are concatenated, and the resulted 4 arrays for "Mels", "Onsets", "Offsets" and "Volumes" must of-course have the same length. Maybe, for some musical piece not all 4 arrays were saved, and for example there are "Mels", "Onsets", "Offsets", but there is no "Volumes", or something like that. If that is the reason, then why it happened in your case, I don't know.
If you don't want to run the previous cell and wait again, you can look through your files with numpy arrays, find the ones for the problematic musical piece and just delete them.
You can also find the name of the problematic musical piece by looking at the printed output in the template. The song with the name in the last line should have been successfully processed, and the problematic song should be the next one (which is not printed).
Hi Boris,
Thank you for your help, I try to print the wrong music piece and the log as shown below. I don't know why. However, I try a workaround method: Get the song name and attach the following suffix, ' Onsets.npy', ' Offsets.npy', ' Actives.npy', ' Volumes.npy'. The workaround could work in my side.
train 2006
/project/at101-group17/datasets/maestro-v1.0.0/train/2006/MIDI-Unprocessed_24_R1_2006_01-05_ORIG_MID--AUDIO_24_R1_2006_01_Track01_wav /project/at101-group17/datasets/maestro-v1.0.0/train/2006/MIDI-Unprocessed_22_R2_2006_01_ORIG_MID--AUDIO_22_R2_2006_02_Track02_wav /project/at101-group17/datasets/maestro-v1.0.0/train/2006/MIDI-Unprocessed_22_R2_2006_01_ORIG_MID--AUDIO_22_R2_2006_02_Track02_wav /project/at101-group17/datasets/maestro-v1.0.0/train/2006/MIDI-Unprocessed_13_R1_2006_01-06_ORIG_MID--AUDIO_13_R1_2006_06_Track06_wav /project/at101-group17/datasets/maestro-v1.0.0/train/2006/MIDI-Unprocessed_22_R2_2006_01_ORIG_MID--AUDIO_22_R2_2006_02_Track02_wav
---------------------------------------------------------------------------AssertionError
Traceback (most recent call
last)
Offsets.npy'newActives = song+' Actives.npy'newVolumes = song+' Volumes.npy' 18 assert song == newOnsets.split(' ')[0] == newOffsets.split(' ')[0] == newActives.split(' ')[0] ---> 19 == newVolumes.split(' ')[0], 'Inconsistent number of numpy arrays' AssertionError: Inconsistent number of numpy arrays
Thanks a lot,
Antony
Boris Shakhovsky @.***> 於 2021年8月1日 週日 上午4:36寫道:
Hi,
I am not quite sure, but one possible reason of the error may be the following. In the previous section "Mels", "Onsets", "Offsets" and "Volumes" numpy arrays were created for each musical piece. Then, in your section with the error, numpy arrays are concatenated, and the resulted 4 arrays for "Mels", "Onsets", "Offsets" and "Volumes" must of-course have the same length. Maybe, for some musical piece not all 4 arrays were saved, and for example there are "Mels", "Onsets", "Offsets", but there is no "Volumes", or something like that. If that is the reason, then why it happened in your case, I don't know.
If you don't want to run the previous cell and wait again, you can look through your files with numpy arrays, find the ones for the problematic musical piece and just delete them.
You can also find the name of the problematic musical piece by looking at the printed output in the template. The song with the name in the last line should have been successfully processed, and the problematic song should be the next one (which is not printed).
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BShakhovsky/PolyphonicPianoTranscription/issues/2#issuecomment-890401417, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADYU34Q4EJCIMVFJPW6CLELT2RNEJANCNFSM4MHDH3QA .
Hi Antony,
Wow, in your output files are not sorted by name. I have looked at the description of python glob.glob function, and it turns out that it returns files in arbitrary order. I did not know that, and in my case glob.glob output was sorted, and maybe it was just a coincidence.
Most likely, that is why my code breaks. Your workaround should work. Or, another (maybe clearer) way would be to sort the lists of filenames, i.e. to change the following line:
glob('{}\{}\{}\*{}.npy'.format(dataFolder, splitFolder, yearFolder, arr))
to the following:
sorted(glob('{}\{}\{}\*{}.npy'.format(dataFolder, splitFolder, yearFolder, arr)))
And there will be a similar block of code in the next cell. If assertion in the next cell also fails, sorting should help (sorted(glob(...))
), i.e. change the following two lines:
for i, [newMels, newOnsets, newOffsets, newActives, newVolumes] in enumerate(zip(*(glob('{}\{}\*{}.npy'.format(
dataFolder, splitFolder, arr)) for arr in ['Mels', 'Onsets', 'Offsets', 'Actives', 'Volumes']))):
to the following:
for i, [newMels, newOnsets, newOffsets, newActives, newVolumes] in enumerate(zip(*(sorted(glob('{}\{}\*{}.npy'.format(
dataFolder, splitFolder, arr))) for arr in ['Mels', 'Onsets', 'Offsets', 'Actives', 'Volumes']))):
I'm running your code in '1 Datasets Preparation.ipynb'. This is my issue when I tested on Maestro dataset. Maybe you can help me. Thank you very much.
I want to test script on a file. This is my folder:
This is code block (very long):