Core Ml Model, labels probabilities returning nan

Hi, I have a core ml model that when I try to print the:
Code Block
modelPrediction?.labelProbability

which is of type
Code Block
String:Double
and contains all the features with their corresponding probabilities, the value of type double comes with nan

rest = nan
right = nan
up = nan

Sometimes restarting makes it work again.
Sometimes it can take a lot of restarts to start working again.
Even when deleting the app and installing again the same thing happens.
Also tried changing the deployment version but didn't seem to fix it.

Any help is appreciated.

Replies

Forgot to mention, the core ml model i'm using is a activity classifier
I finally found what the problem was.
Just had to start my stateIn multi array with full of zeros and restart the state after not needing it.
After this no more label probability came with nan.

May I know the exact solution of it. I am getting the similar issue.

I have the same problem. Exact solution would be very much appreciated.

hey, i have the same issue, did you had any success in finding a solution?

I fixed this issue as well by following @jessylol suggestion. All you have to do is declare the stateIn param like this


 let array = Array(repeating: 0, count: 400)
 let stateIn = try MLMultiArray(array)