asigalov61
commited on
Commit
•
7da6719
1
Parent(s):
9a50d02
Update app.py
Browse files
app.py
CHANGED
@@ -144,17 +144,21 @@ def ClassifyMIDI(input_midi):
|
|
144 |
#==============================================================
|
145 |
|
146 |
classification_summary_string = '=' * 70
|
|
|
147 |
|
148 |
print('Composition has', notes_counter, 'notes')
|
149 |
print('=' * 70)
|
150 |
print('Composition was split into' , len(input_data), 'chunks of 340 notes each with 170 notes overlap')
|
151 |
print('Number of notes in all composition chunks:', len(input_data) * 340)
|
152 |
|
153 |
-
classification_summary_string += 'Composition has ' + str(notes_counter) + ' notes'
|
154 |
classification_summary_string += '=' * 70
|
155 |
-
classification_summary_string += '
|
156 |
-
classification_summary_string += '
|
157 |
-
|
|
|
|
|
|
|
158 |
number_of_batches = 100 # @param {type:"slider", min:1, max:100, step:1}
|
159 |
|
160 |
# @markdown NOTE: You can increase the number of batches on high-ram GPUs for better classification
|
@@ -198,12 +202,22 @@ def ClassifyMIDI(input_midi):
|
|
198 |
print('Most common classification label ratio:' , results.count(final_result) / len(results))
|
199 |
print('Most common classification label index', final_result)
|
200 |
print('=' * 70)
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
print('All classification labels summary:')
|
203 |
print('=' * 70)
|
204 |
|
205 |
for i, a in enumerate(all_results_labels):
|
206 |
-
|
|
|
|
|
|
|
|
|
207 |
|
208 |
print('=' * 70)
|
209 |
print('Done!')
|
@@ -248,7 +262,7 @@ def ClassifyMIDI(input_midi):
|
|
248 |
#========================================================
|
249 |
|
250 |
output_midi_title = str(fn1)
|
251 |
-
output_midi_summary =
|
252 |
output_midi = str(new_fn)
|
253 |
output_audio = (16000, audio)
|
254 |
|
@@ -256,7 +270,6 @@ def ClassifyMIDI(input_midi):
|
|
256 |
|
257 |
print('Output MIDI file name:', output_midi)
|
258 |
print('Output MIDI title:', output_midi_title)
|
259 |
-
print('Output MIDI summary:', output_midi_summary)
|
260 |
print('=' * 70)
|
261 |
|
262 |
|
|
|
144 |
#==============================================================
|
145 |
|
146 |
classification_summary_string = '=' * 70
|
147 |
+
classification_summary_string += '\n'
|
148 |
|
149 |
print('Composition has', notes_counter, 'notes')
|
150 |
print('=' * 70)
|
151 |
print('Composition was split into' , len(input_data), 'chunks of 340 notes each with 170 notes overlap')
|
152 |
print('Number of notes in all composition chunks:', len(input_data) * 340)
|
153 |
|
154 |
+
classification_summary_string += 'Composition has ' + str(notes_counter) + ' notes\n'
|
155 |
classification_summary_string += '=' * 70
|
156 |
+
classification_summary_string += '\n'
|
157 |
+
classification_summary_string += 'Composition was split into ' + str(len(input_data)) + ' chunks of 340 notes each with 170 notes overlap\n'
|
158 |
+
classification_summary_string += 'Number of notes in all composition chunks: ' + str(len(input_data) * 340) + '\n'
|
159 |
+
classification_summary_string += '=' * 70
|
160 |
+
classification_summary_string += '\n'
|
161 |
+
|
162 |
number_of_batches = 100 # @param {type:"slider", min:1, max:100, step:1}
|
163 |
|
164 |
# @markdown NOTE: You can increase the number of batches on high-ram GPUs for better classification
|
|
|
202 |
print('Most common classification label ratio:' , results.count(final_result) / len(results))
|
203 |
print('Most common classification label index', final_result)
|
204 |
print('=' * 70)
|
205 |
+
|
206 |
+
classification_summary_string += 'Most common classification label: ' + str(classifier_labels[0][final_result-384]) + '\n'
|
207 |
+
classification_summary_string += 'Most common classification label ratio: ' + str(results.count(final_result) / len(results)) + '\n'
|
208 |
+
classification_summary_string += 'Most common classification label index '+ str(final_result) + 'n'
|
209 |
+
classification_summary_string += '=' * 70
|
210 |
+
classification_summary_string += '\n'
|
211 |
|
212 |
print('All classification labels summary:')
|
213 |
print('=' * 70)
|
214 |
|
215 |
for i, a in enumerate(all_results_labels):
|
216 |
+
print('Notes', i*170, '-', (i*170)+340, '===', a)
|
217 |
+
classification_summary_string += 'Notes ' + str(i*170) + ' - ' + str((i*170)+340) + ' === ' + str(a) + '\n'
|
218 |
+
|
219 |
+
classification_summary_string += '=' * 70
|
220 |
+
classification_summary_string += '\n'
|
221 |
|
222 |
print('=' * 70)
|
223 |
print('Done!')
|
|
|
262 |
#========================================================
|
263 |
|
264 |
output_midi_title = str(fn1)
|
265 |
+
output_midi_summary = classification_summary_string
|
266 |
output_midi = str(new_fn)
|
267 |
output_audio = (16000, audio)
|
268 |
|
|
|
270 |
|
271 |
print('Output MIDI file name:', output_midi)
|
272 |
print('Output MIDI title:', output_midi_title)
|
|
|
273 |
print('=' * 70)
|
274 |
|
275 |
|