I'm getting a problem when building my ios app with CoreML model in it. I've used this example code for implementing coreML in my project. I can run the example code when cloning it from github with the given model in the repo, but when I paste in my own model I get an error:
lexical preprocessor issue
source file is not valid UTF-8
SSD_model.mlmodel
My model is an SSD model for generating bounding boxes, (and not just object detection like the repo's model), so that could make a problem maybe. I trained it using tensorflow object detection API, and exported it to coreML using this helpful blog post . I've verified that my model works well by testing it in another script made for SSD models. Here's a snippet from the first example how I import the model now:
#import <CoreML/CoreML.h>
#import <Vision/Vision.h>
#import "SSD_model.mlmodel"
- (void)viewDidLoad {
[super viewDidLoad];
model = [[[SSD_model alloc] init] model]
m = [VNCoreMLModel modelForMLModel: model error:nil];
Is there anything I need to change to this objective C code to make it work? Or any project settings that I might be forgetting? Thanks!
source file is not valid UTF-8
sounds like an encoding issue which is not necessarily related to the model itself but to the file format. Did you copy the model from another platform?