I'm working on an iOS project with TFLite model. For initializing the model, I did:
var options = Interpreter.Options()
options.threadCount = 2
interpreter = try Interpreter(modelPath: modelPath, options: options, delegates: nil)
try interpreter?.allocateTensors()
But received an error:
TensorFlow Lite Error: Select TensorFlow op(s), included in the given model, is(are) not supported by this interpreter. Make sure you apply/link the Flex delegate before inference. For the Android, it can be resolved by adding "org.tensorflow:tensorflow-lite-select-tf-ops" dependency. See instructions: https://www.tensorflow.org/lite/guide/ops_select
For resolving the issue, I want to use both TensorFlowLiteSwift and TensorFlowLiteSelectTfOps. I installed them via CocoaPods by including the following in my Podfile:
pod 'TensorFlowLiteSwift'
pod 'TensorFlowLiteSelectTfOps'
The pods are installed successfully. However, when I try to import both modules into a Swift file:
import TensorFlowLite
import TensorFlowLiteSelectTfOps
I get the following error:
Could not build Objective-C module 'TensorFlowLiteSelectTfOps'
Also in module.modulemap file:
framework module TensorFlowLiteSelectTfOps {
export *
module * { export * }
link "dl"
link "m"
link "pthread"
link "z"
link framework "CoreFoundation"
}
shows error:
Inferred submodules require a module with an umbrella
I've cleaned the build folder, deleted DerivedData, restarted Xcode and my Mac, deintegrated & reinstalled cocoapods, based on the previous responses (1, 2 and so on), applied on a new XCode project, but still facing the issue.
Has anyone successfully used TensorFlowLiteSelectTfOps with TensorFlowLiteSwift in a Swift project? How can I resolve the "Could not build Objective-C module" error and use both libraries together? Any insights or working configurations would be greatly appreciated! Above all of them, I am eager to know how I can integrate the ML model properly in my iOS project.