calebhan commited on
Commit
2b51b9c
·
1 Parent(s): de9fd9e

updated eval testing

Browse files
backend/evaluation/generate_full_test_set.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Generate full 8-piece MAESTRO test set.
3
+ """
4
+
5
+ from pathlib import Path
6
+ import json
7
+
8
+ # Test cases from prepare_maestro.py
9
+ MAESTRO_SUBSET = [
10
+ # Easy - Simple classical pieces
11
+ ("2004", "test", "MIDI-Unprocessed_SMF_02_R1_2004_01-05_ORIG_MID--AUDIO_02_R1_2004_03_Track03_wav", "classical", "easy"),
12
+ ("2004", "test", "MIDI-Unprocessed_SMF_02_R1_2004_01-05_ORIG_MID--AUDIO_02_R1_2004_05_Track05_wav", "classical", "easy"),
13
+
14
+ # Medium - Chopin, moderate tempo
15
+ ("2004", "test", "MIDI-Unprocessed_XP_14_R1_2004_01-04_ORIG_MID--AUDIO_14_R1_2004_04_Track04_wav", "classical", "medium"),
16
+ ("2006", "test", "MIDI-Unprocessed_07_R1_2006_01-09_ORIG_MID--AUDIO_07_R1_2006_04_Track04_wav", "classical", "medium"),
17
+ ("2008", "test", "MIDI-Unprocessed_11_R1_2008_01-04_ORIG_MID--AUDIO_11_R1_2008_02_Track02_wav", "classical", "medium"),
18
+
19
+ # Hard - Fast passages, complex harmony
20
+ ("2009", "test", "MIDI-Unprocessed_16_R1_2009_01-04_ORIG_MID--AUDIO_16_R1_2009_16_R1_2009_02_WAV", "classical", "hard"),
21
+ ("2011", "test", "MIDI-Unprocessed_03_R1_2011_MID--AUDIO_03_R1_2011_03_R1_2011_02_WAV", "classical", "hard"),
22
+ ("2013", "test", "MIDI-Unprocessed_20_R1_2013_MID--AUDIO_20_R1_2013_20_R1_2013_02_WAV", "classical", "hard"),
23
+ ]
24
+
25
+
26
+ def generate_test_cases(maestro_dir: str = "../../data/maestro-v3.0.0"):
27
+ """Generate test_videos.json with all 8 MAESTRO pieces."""
28
+
29
+ test_cases = []
30
+
31
+ for year, split, filename_prefix, genre, difficulty in MAESTRO_SUBSET:
32
+ # Construct paths
33
+ audio_path = f"{maestro_dir}/{year}/{filename_prefix}.wav"
34
+ midi_path = f"{maestro_dir}/{year}/{filename_prefix}.midi"
35
+
36
+ # Create test case
37
+ test_case = {
38
+ "name": filename_prefix,
39
+ "audio_path": audio_path,
40
+ "ground_truth_midi": midi_path,
41
+ "genre": genre,
42
+ "difficulty": difficulty,
43
+ "duration": None
44
+ }
45
+
46
+ test_cases.append(test_case)
47
+
48
+ return test_cases
49
+
50
+
51
+ if __name__ == "__main__":
52
+ # Generate test cases
53
+ test_cases = generate_test_cases()
54
+
55
+ # Save to JSON
56
+ output_file = Path(__file__).parent / "test_videos.json"
57
+
58
+ with open(output_file, 'w') as f:
59
+ json.dump(test_cases, f, indent=2)
60
+
61
+ print(f"✅ Generated {len(test_cases)} test cases")
62
+ print(f"📝 Saved to: {output_file}")
63
+ print("\nBreakdown:")
64
+ print(f" - Easy: {sum(1 for tc in test_cases if tc['difficulty'] == 'easy')}")
65
+ print(f" - Medium: {sum(1 for tc in test_cases if tc['difficulty'] == 'medium')}")
66
+ print(f" - Hard: {sum(1 for tc in test_cases if tc['difficulty'] == 'hard')}")
backend/evaluation/test_videos.json CHANGED
@@ -1,10 +1,66 @@
1
  [
2
  {
3
- "name": "MAESTRO_2004_AUDIO 02 R1 2004 05 Track05 wav",
 
 
 
 
 
 
 
 
4
  "audio_path": "../../data/maestro-v3.0.0/2004/MIDI-Unprocessed_SMF_02_R1_2004_01-05_ORIG_MID--AUDIO_02_R1_2004_05_Track05_wav.wav",
5
  "ground_truth_midi": "../../data/maestro-v3.0.0/2004/MIDI-Unprocessed_SMF_02_R1_2004_01-05_ORIG_MID--AUDIO_02_R1_2004_05_Track05_wav.midi",
6
  "genre": "classical",
7
  "difficulty": "easy",
8
  "duration": null
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  }
10
  ]
 
1
  [
2
  {
3
+ "name": "MIDI-Unprocessed_SMF_02_R1_2004_01-05_ORIG_MID--AUDIO_02_R1_2004_03_Track03_wav",
4
+ "audio_path": "../../data/maestro-v3.0.0/2004/MIDI-Unprocessed_SMF_02_R1_2004_01-05_ORIG_MID--AUDIO_02_R1_2004_03_Track03_wav.wav",
5
+ "ground_truth_midi": "../../data/maestro-v3.0.0/2004/MIDI-Unprocessed_SMF_02_R1_2004_01-05_ORIG_MID--AUDIO_02_R1_2004_03_Track03_wav.midi",
6
+ "genre": "classical",
7
+ "difficulty": "easy",
8
+ "duration": null
9
+ },
10
+ {
11
+ "name": "MIDI-Unprocessed_SMF_02_R1_2004_01-05_ORIG_MID--AUDIO_02_R1_2004_05_Track05_wav",
12
  "audio_path": "../../data/maestro-v3.0.0/2004/MIDI-Unprocessed_SMF_02_R1_2004_01-05_ORIG_MID--AUDIO_02_R1_2004_05_Track05_wav.wav",
13
  "ground_truth_midi": "../../data/maestro-v3.0.0/2004/MIDI-Unprocessed_SMF_02_R1_2004_01-05_ORIG_MID--AUDIO_02_R1_2004_05_Track05_wav.midi",
14
  "genre": "classical",
15
  "difficulty": "easy",
16
  "duration": null
17
+ },
18
+ {
19
+ "name": "MIDI-Unprocessed_XP_14_R1_2004_01-04_ORIG_MID--AUDIO_14_R1_2004_04_Track04_wav",
20
+ "audio_path": "../../data/maestro-v3.0.0/2004/MIDI-Unprocessed_XP_14_R1_2004_01-04_ORIG_MID--AUDIO_14_R1_2004_04_Track04_wav.wav",
21
+ "ground_truth_midi": "../../data/maestro-v3.0.0/2004/MIDI-Unprocessed_XP_14_R1_2004_01-04_ORIG_MID--AUDIO_14_R1_2004_04_Track04_wav.midi",
22
+ "genre": "classical",
23
+ "difficulty": "medium",
24
+ "duration": null
25
+ },
26
+ {
27
+ "name": "MIDI-Unprocessed_07_R1_2006_01-09_ORIG_MID--AUDIO_07_R1_2006_04_Track04_wav",
28
+ "audio_path": "../../data/maestro-v3.0.0/2006/MIDI-Unprocessed_07_R1_2006_01-09_ORIG_MID--AUDIO_07_R1_2006_04_Track04_wav.wav",
29
+ "ground_truth_midi": "../../data/maestro-v3.0.0/2006/MIDI-Unprocessed_07_R1_2006_01-09_ORIG_MID--AUDIO_07_R1_2006_04_Track04_wav.midi",
30
+ "genre": "classical",
31
+ "difficulty": "medium",
32
+ "duration": null
33
+ },
34
+ {
35
+ "name": "MIDI-Unprocessed_11_R1_2008_01-04_ORIG_MID--AUDIO_11_R1_2008_02_Track02_wav",
36
+ "audio_path": "../../data/maestro-v3.0.0/2008/MIDI-Unprocessed_11_R1_2008_01-04_ORIG_MID--AUDIO_11_R1_2008_02_Track02_wav.wav",
37
+ "ground_truth_midi": "../../data/maestro-v3.0.0/2008/MIDI-Unprocessed_11_R1_2008_01-04_ORIG_MID--AUDIO_11_R1_2008_02_Track02_wav.midi",
38
+ "genre": "classical",
39
+ "difficulty": "medium",
40
+ "duration": null
41
+ },
42
+ {
43
+ "name": "MIDI-Unprocessed_16_R1_2009_01-04_ORIG_MID--AUDIO_16_R1_2009_16_R1_2009_02_WAV",
44
+ "audio_path": "../../data/maestro-v3.0.0/2009/MIDI-Unprocessed_16_R1_2009_01-04_ORIG_MID--AUDIO_16_R1_2009_16_R1_2009_02_WAV.wav",
45
+ "ground_truth_midi": "../../data/maestro-v3.0.0/2009/MIDI-Unprocessed_16_R1_2009_01-04_ORIG_MID--AUDIO_16_R1_2009_16_R1_2009_02_WAV.midi",
46
+ "genre": "classical",
47
+ "difficulty": "hard",
48
+ "duration": null
49
+ },
50
+ {
51
+ "name": "MIDI-Unprocessed_03_R1_2011_MID--AUDIO_03_R1_2011_03_R1_2011_02_WAV",
52
+ "audio_path": "../../data/maestro-v3.0.0/2011/MIDI-Unprocessed_03_R1_2011_MID--AUDIO_03_R1_2011_03_R1_2011_02_WAV.wav",
53
+ "ground_truth_midi": "../../data/maestro-v3.0.0/2011/MIDI-Unprocessed_03_R1_2011_MID--AUDIO_03_R1_2011_03_R1_2011_02_WAV.midi",
54
+ "genre": "classical",
55
+ "difficulty": "hard",
56
+ "duration": null
57
+ },
58
+ {
59
+ "name": "MIDI-Unprocessed_20_R1_2013_MID--AUDIO_20_R1_2013_20_R1_2013_02_WAV",
60
+ "audio_path": "../../data/maestro-v3.0.0/2013/MIDI-Unprocessed_20_R1_2013_MID--AUDIO_20_R1_2013_20_R1_2013_02_WAV.wav",
61
+ "ground_truth_midi": "../../data/maestro-v3.0.0/2013/MIDI-Unprocessed_20_R1_2013_MID--AUDIO_20_R1_2013_20_R1_2013_02_WAV.midi",
62
+ "genre": "classical",
63
+ "difficulty": "hard",
64
+ "duration": null
65
  }
66
  ]