Closed osianSmith closed 2 years ago
We are looking into this. In the meanwhile, could you please file a bug report at bugreport.apple.com?
Sure! I have submitted it to bugreport.apple.com with reference code FB7702029.
Hey, I've had this back from bugreport.apple.com:
Engineering has provided the following information regarding this issue:
There are three issues going on here:
1. This is not a classifier model, it's a feature extractor model. I don’t expect it to work with SNClassifySoundRequest since it doesn’t output a classification dictionary like the SoundAnalysis documentation states for SNClassifySoundRequest: “The provided model must accept audio data as input, and output a classification dictionary containing the probability of each category.”
If the intention is to use SoundAnalysis to perform feature extraction instead of classification, then that sounds like a feature request for a new type of API.
If the intention is to use SoundAnalysis to perform classification, then the model provided should output a classification dictionary.
2. When printing the model description...
po model.model.modelDescription
inputs: (
"audioSamples : MultiArray (Float32, 15600)"
)
outputs: (
"vggishFeature : MultiArray (Float32, 12288)"
)
predictedFeatureName: classLabel
predictedProbabilitiesName: classLabelProbs
...the model claims to have predictedFeatureName "classLabel" and predictedProbabilitiesName "classLabelProbs". However, the model does not actually provide output features with these names.
3. SoundAnalysis should return an error in SNClassifySoundRequest initWithMLModel when the user's model is malformed. This would prevent the exception thrown later by the framework at inference time. This third issue is tracked internally.
From my understanding that SoundAnalysis needs its class label changed but SoundAnalysis as that is what is throwing the error? But based on "The provided model must accept audio data as input, and output a classification dictionary containing the probability of each category" we cannot use SoundAnalysis as a feature Extractor right?
Thanks
Osian
Hi @osianSmith
From my understanding that SoundAnalysis needs its class label changed but SoundAnalysis as that is what is throwing the error?
Correct. The error is because the API you are using (SNClassifySoundRequest) requires a classifier model (that outputs class and classProbabilities). That said, it should not have crashed. We are using the bug report you filed to address that.
But based on "The provided model must accept audio data as input, and output a classification dictionary containing the probability of each category" we cannot use SoundAnalysis as a feature Extractor right?
That is correct as well. I'd encourage you to file a feature request if you'd like to use sound analysis framework for feature extraction.
Hi @anilkatti
Thank you! I have submitted this as a feature request to the feedback assistant.
@osianSmith
We have a workaround for you. Things will need to do if we wants to implement your own front-end:
You will need to modify the model to expose the feature extractor output as the pipeline model's output. Here's an example of dealing with pipeline models. https://github.com/apple/coremltools/blob/master/examples/updatable_models/updatable_tiny_drawing_classifier.ipynb
Also, you can use Netron to visualize the model and understand sub-model's output. Let me know if you run into any issues.
@osianSmith I would still keep the feature request open since what I provided is a workaround. We could use your feature request to track a more natural solution to your problem.
Sure @anilkatti! I haven't had the chance to test it yet but will keep you updated as soon as I get around to! Hoping to be able to try it by the end of next week!
Hi @anilkatti That documentation is no longer available, do you know where it has moved to?
Thank you
Osian
Since we have not heard back here, I am going to close this issue.
In the future, please report issues with the Core ML Framework to bugreport.apple.com.
❓When using SoundAnalysis on a model that takes in audio samples and returns MultiArray (Float32 12288) I received the error DSPGraph:: Exception.
I am using a different model that takes in an audioSample (MultiArray (Float32 15600)) and returns the vggishFeature (MultiArray (Float32 12288)). You can download the model here We want it as a feature extractor as we want a different inference model. When using SoundAnalysis I receive this stack:
And Recieve the error on this line:
Steps to debug:
System Information