Skip to content

A lightweight yet powerful audio-to-MIDI converter with pitch bend detection

Include tensortype input for model

David Rubinsteina5ab7392dfb4
diff --git a/basic_pitch/inference.py b/basic_pitch/inference.py
index e97da12..eb08d01 100644
--- a/basic_pitch/inference.py
+++ b/basic_pitch/inference.py
@@ -156,7 +156,12 @@ class Model:
print(f"isfinite: {np.all(np.isfinite(x))}", flush=True)
print(f"shape: {x.shape}", flush=True)
print(f"dtype: {x.dtype}", flush=True)
- return cast(ct.models.MLModel, self.model).predict({"input": x}) # type: ignore
+ result = cast(ct.models.MLModel, self.model).predict({"input_2": x})
+ return {
+ "note": result["Identity_1"],
+ "onset": result["Identity_2"],
+ "contour": result["Identity"],
+ }
elif self.model_type == Model.MODEL_TYPES.TFLITE:
return self.model(input_2=x) # type: ignore
elif self.model_type == Model.MODEL_TYPES.ONNX:
diff --git a/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Data/com.apple.CoreML/model.mlmodel b/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Data/com.apple.CoreML/model.mlmodel
index 6abd661..4fa2f93 100644
Binary files a/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Data/com.apple.CoreML/model.mlmodel and b/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Data/com.apple.CoreML/model.mlmodel differ
diff --git a/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Data/com.apple.CoreML/weights/weight.bin b/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Data/com.apple.CoreML/weights/weight.bin
index 27dbd33..883fcaf 100644
Binary files a/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Data/com.apple.CoreML/weights/weight.bin and b/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Data/com.apple.CoreML/weights/weight.bin differ
diff --git a/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Manifest.json b/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Manifest.json
index e2ba7bb..37bfe14 100644
--- a/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Manifest.json
+++ b/basic_pitch/saved_models/icassp_2022/nmp.mlpackage/Manifest.json
@@ -1,18 +1,18 @@
{
"fileFormatVersion": "1.0.0",
"itemInfoEntries": {
- "5801BA7A-2770-4102-B305-47CD350ED73E": {
+ "7EB69391-53BD-4281-BFA1-831180579ABC": {
"author": "com.apple.CoreML",
"description": "CoreML Model Specification",
"name": "model.mlmodel",
"path": "com.apple.CoreML/model.mlmodel"
},
- "E537DFD0-055A-40BD-B5FB-6AD7A789DE75": {
+ "C784FB56-1BA8-4A0E-AC2A-F0388FE1A2DB": {
"author": "com.apple.CoreML",
"description": "CoreML Model Weights",
"name": "weights",
"path": "com.apple.CoreML/weights"
}
},
- "rootModelIdentifier": "5801BA7A-2770-4102-B305-47CD350ED73E"
+ "rootModelIdentifier": "7EB69391-53BD-4281-BFA1-831180579ABC"
}