Why is the Inceptionv3 Machine Learning model not recognized in my project?

I am building a basic pattern recognition application in Swift using the Inception v3 machine learning model. I dragged Inceptionv3.mlmelel inside my project folder and made sure that the option "Copy items if necessary" is checked.

Inside the detection function:

func detect(image: CIImage) { guard let model = try? VNCoreMLModel(for: Inceptionv3().model) else { fatalError("Loading CoreML Model Failed!") } let request = VNCoreMLRequest(model: model) { (request, error) in guard let results = request.results as? [VNClassificationObservation] else { fatalError("Model failed to process") } if let firstResult = results.first { self.navigationItem.title = firstResult.identifier } } 

I get the following message:

Using unresolved identifier 'Inceptionv3'

Also, when I click on the Inceptionv3.mlmel file in my project browser, I get this message:

Creating an interface is only available for an acceptable purpose.

But I know that he should read something like:

Inceptionv3 (source with fast generation)

With a small arrow next to it that allows you to access the class.

Any ideas?

+5
source share
5 answers

I had the same problem. I decided to add inceptionv3 to the header of the header.

+2
source

make sure your targeted membership is verified.

+8
source

Instead of dragging and dropping, right-click the project and select "Add Files to Project." Then add model files. It worked for me.

+3
source

It seems to be some kind of mistake. This may help, remove the file link and try adding it again.

It worked for me. Greetings

+1
source

The problem is that you cannot use an existing line of code before importing the model file.

Delete the model file, remove the links when prompted. Now add the model library file back. Go back to the commented line of code and right below the type of the same line of code and let xcode predict that you want to use the Incepetionv3 model file. The error will now disappear.

Xcode does not like to cut and paste lines of code when there is a link to a file, but, more importantly, the file must exist before writing a line of code.

0
source

Source: https://habr.com/ru/post/1270260/


All Articles