Created
February 23, 2020 03:29
-
-
Save 0xfe/3e4d90436dce46ec121b9f94948001a1 to your computer and use it in GitHub Desktop.
Plot prediction errors by key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files = os.listdir("samples") | |
np.random.shuffle(files) | |
notes = ['A', 'As', 'B', 'C', 'Cs', 'D', 'Ds', 'E', 'F', 'Fs', 'G', 'Gs'] | |
note_map = {} | |
for i, note_name in enumerate(notes): | |
note_map[note_name] = i | |
count_by_key = np.zeros((8 * 12)) | |
errors_by_key = np.zeros((8 * 12)) | |
for i, file in enumerate(files[17000:18000]): | |
predicted = deepears.predict("samples/"+file).flatten()[0] | |
parts = DeepSamples.note_parts(file) | |
octave = int(parts['octave']) | |
note = parts['root'] | |
freq = parts['freq'] | |
error = abs(predicted - freq) | |
count_by_key[(octave * 12) + note_map[note]] += 1 | |
errors_by_key[(octave * 12) + note_map[note]] += error | |
# print(file, base, predicted, actual, error) | |
errors_by_key /= count_by_key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment