CoreML predicts incorrectly on simulator but works fine on device

The CoreML model worked correctly in the “Preview” of “CreateML”.

However, after it is put into the Xcode project and replaced the “MobileNetV2” , it did not classify the images correctly, it returned one image with high confidence all the time no matter what image it is .

The same code works fine when executed on real device.

Can someone please assist on this ?

I am using iOS 17.2 and Xcode version 15.1

CoreML predicts incorrectly on simulator but works fine on device
 
 
Q