ML Model Shows Wrong output or predictions

Hi, I am trying to implement shape classification or drawing classification in swift playgrounds app. It basically has a Image classifier which is trained on different hand drawn shapes and once the user stops drawing on the canvas the ML model is called to predict the shape but I am getting poor results while running the app in Xcode but when I try the predict the same image with the create ML preview tab the model works perfectly fine.

I tried to convert the image to cvPixelBuffer with the specific parameters given by the model such as

Input image to be classified as color (kCVPixelFormatType_32BGRA) image buffer, 299 pixels wide by 299 pixels high

So what could be the Issue, I even tried to use Vision but I didn't work too. Any help would be appreciated.

Thanks.

Sanjiv A

Answered by in 747231022

Hey Sanjiv,

Could you share a sample image or code that you're running into this issue with? It would help a lot in reproducing the issue and helping guide you to a fix. It's hard to tell exactly what the issue is, but since you're getting a prediction in the app, it seems possible that the error is on the conversion to cvPixelBuffer, and resolving that might resolve your issue.

Thanks, Jack

Accepted Answer

Hey Sanjiv,

Could you share a sample image or code that you're running into this issue with? It would help a lot in reproducing the issue and helping guide you to a fix. It's hard to tell exactly what the issue is, but since you're getting a prediction in the app, it seems possible that the error is on the conversion to cvPixelBuffer, and resolving that might resolve your issue.

Thanks, Jack

ML Model Shows Wrong output or predictions
 
 
Q