xamarin / XamarinComponents

Plugins for Xamarin
MIT License
1.99k stars 692 forks source link

Request: TensorFlow.Lite Flex delegate #867

Open nexxuno opened 4 years ago

nexxuno commented 4 years ago

Are you planning on supporting the Flex deleagte for tensor flow lite? It's needed by the interpreter to correctly load models from microsoft customvision's exported models for example.

moljac commented 4 years ago

@nexxuno

I'm not familiar with Flex delegate. Maybe some links. Is that separate lib?

Minimal sample, please?

It would help us/me to bind it faster and test it.

nexxuno commented 4 years ago

@moljac Is this of any help?

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/java/src/test/java/org/tensorflow/lite/InterpreterFlexTest.java

  public void testFlexModel() throws Exception {
    FlexDelegate delegate = new FlexDelegate();
    Interpreter.Options options = new Interpreter.Options().addDelegate(delegate);
    try (Interpreter interpreter = new Interpreter(FLEX_MODEL_BUFFER, options)) {
      testCommon(interpreter);
    } finally {
      delegate.close();
    }
  }
moljac commented 4 years ago

@nexxuno I have decompiled version 2.2.0 and there is no FlexDelegate

Google search: tensorflow flexdelegate

Results in this:

https://www.tensorflow.org/lite/guide/ops_select

Caution: This feature is experimental.

We do bindings for previews in some exceptional cases and I'm not sure this will be such. Sorry.

Please close this one and reopen new issue, when FlexDelegate comes out as stable.

nexxuno commented 4 years ago

@moljac thanks.

The problem is that the tf lite model exported with microsoft's custom vision service needs this kind of experimental feature to work. The custom vision team said they would try and remove this need from their model (see #54529 linked above) but there's no guarantee. If they'll keep using this functionality then I think it should be considered for integration even if it's in preview. Could you try and understand with them how to get out of the deadlock?