A lightweight yet powerful audio-to-MIDI converter with pitch bend detection
Python audiolightweightmachine-learningmidimusicpitch-detectionpolyphonicpythontranscriptiontypescript
Add some pre-generated outputs for prediction tests
David Rubinsteinca13028b4773
diff --git a/tests/resources/vocadito_10/model_output.npz b/tests/resources/vocadito_10/model_output.npznew file mode 100644index 0000000..8719f8aBinary files /dev/null and b/tests/resources/vocadito_10/model_output.npz differdiff --git a/tests/resources/vocadito_10/note_events.npz b/tests/resources/vocadito_10/note_events.npznew file mode 100644index 0000000..ffd860cBinary files /dev/null and b/tests/resources/vocadito_10/note_events.npz differdiff --git a/tests/test_inference.py b/tests/test_inference.pyindex 23a477e..2bc1607 100644--- a/tests/test_inference.py+++ b/tests/test_inference.py@@ -15,6 +15,7 @@# See the License for the specific language governing permissions and# limitations under the License.+import jsonimport osimport pathlibimport tempfile@@ -47,6 +48,18 @@ class TestPredict(unittest.TestCase):assert all(note_pitch_max)assert isinstance(note_events, list)+ expected_model_output = np.load("tests/resources/vocadito_10/model_output.npz")+ for k in expected_model_output.keys():+ np.testing.assert_allclose(expected_model_output[k], model_output[k], atol=1e-4, rtol=0)++ expected_note_events = np.load("tests/resources/vocadito_10/note_events.npz", allow_pickle=True)+ expected_note_events = expected_note_events.get("arr_0")++ assert len(expected_note_events) == len(note_events)+ for expected, calculated in zip(expected_note_events, note_events):+ for i in range(len(expected)):+ np.testing.assert_allclose(expected[i], calculated[i], atol=1e-4, rtol=0)+def test_predict_with_saves(self) -> None:test_audio_path = RESOURCES_PATH / "vocadito_10.wav"with tempfile.TemporaryDirectory() as tmpdir: