Giter Site home page Giter Site logo

Comments (31)

junhwanjang avatar junhwanjang commented on April 27, 2024 23

@shoutOutYangJie I closed my repo because of some private reason.
You can use "palm_detection_without_custom_op.tflite" in the below link.
https://github.com/metalwhale/hand_tracking

from mediapipe.

akamzin avatar akamzin commented on April 27, 2024 12

Can any one give a little bit more details on how to incorporate these custom ops to be able to run it in regular python enviroment.

from mediapipe.

Anton-Prab avatar Anton-Prab commented on April 27, 2024 5

Got the same error in python when I tried to load the tflite model into the Interpreter.

ValueError: Didn't find custom op for name 'Convolution2DTransposeBias' with version 1
Registration failed. 

Code:

import tensorflow as tf
interpreter = tf.lite.Interpreter(model_path="palm_detection.tflite")

I can see that it can be resolved using the tflite::InterpreterBuilder in C api
but in python tf.lite.Interpreter alone is available InterpreterBuilder is not available

Environment:
Python - 3.7
Tensorflow - 1.14

from mediapipe.

lamarrr avatar lamarrr commented on April 27, 2024 3

I really don't think so because it's a Tensorflow lite package and not Tensorflow's.
And I don't think there is an API for loading ops into TensorFlow lite yet in Python, but you can do your research
cc: @fanzhanggoogle @jiuqiant

from mediapipe.

caocao1989 avatar caocao1989 commented on April 27, 2024 3

Thanks to @junhwanjang and his awesome repo, now I can load palm detection model without custom op.

It is work for me. That is important to use python3.7 and install specified version of tensorflow

the [repo] has been deleted,can you tell me what is the 'specified version of tensorflow' please?

from mediapipe.

metalwhale avatar metalwhale commented on April 27, 2024 2

Thanks to @junhwanjang and his awesome repo, now I can load palm detection model without custom op.

from mediapipe.

manchengfenxu avatar manchengfenxu commented on April 27, 2024 2

Thanks to @junhwanjang and his awesome repo, now I can load palm detection model without custom op.

@junhwanjang , except for the 'specified version of tensorflow', is there any other modifications of the usage of tflite intenpreter? I still encountered this error:unresolved custom op: Convolution2DTransposeBias using "tensorflow-lite:1.13.0".

from mediapipe.

kulievvitaly avatar kulievvitaly commented on April 27, 2024 1

Thanks to @junhwanjang and his awesome repo, now I can load palm detection model without custom op.

It is work for me. That is important to use python3.7 and install specified version of tensorflow

from mediapipe.

jiuqiant avatar jiuqiant commented on April 27, 2024

We have some custom ops in mediapipe/util/tflite/operations.

from mediapipe.

srishtigoelroposo avatar srishtigoelroposo commented on April 27, 2024

Is their any way i can use these custom operations and include them in my tflite setup.

i am very new to this and want help to up the model on android device.

from mediapipe.

fanzhanggoogle avatar fanzhanggoogle commented on April 27, 2024

You may find the creation of the custom op resolver here:

std::unique_ptr<tflite::ops::builtin::BuiltinOpResolver> op_resolver;

And how to use it instead builtin op resolver is here:

tflite::InterpreterBuilder(*model_, op_resolver)(&interpreter_);

from mediapipe.

mmxuan18 avatar mmxuan18 commented on April 27, 2024

will is possible i compile only the tflite in mediapipe, and use this as instead of offfical tflite?

from mediapipe.

lamarrr avatar lamarrr commented on April 27, 2024

To avoid stress you can use it with Tensorflow C++ Lite. And build with Bazel.
It's faster than compiling the whole Tensorflow. I've done that and it works fine for me.
Just copy the custom op from mediapipe's tensorflow sub folder.
Then Create a class to inherit from the BuiltinOpResolver and add the Custom Op from there just as in mediapipe.

from mediapipe.

metalwhale avatar metalwhale commented on April 27, 2024

To avoid stress you can use it with Tensorflow C++ Lite. And build with Bazel.
It's faster than compiling the whole Tensorflow. I've done that and it works fine for me.
Just copy the custom op from mediapipe's tensorflow sub folder.
Then Create a class to inherit from the BuiltinOpResolver and add the Custom Op from there just as in mediapipe.

@lamarrr, and then can I load the compiled op in python by using tf.load_op_library like that?

from mediapipe.

junhwanjang avatar junhwanjang commented on April 27, 2024

Thanks to @junhwanjang and his awesome repo, now I can load palm detection model without custom op.

It is work for me. That is important to use python3.7 and install specified version of tensorflow

the [repo] has been deleted,can you tell me what is the 'specified version of tensorflow' please?

@caocao1989 Tensorflow - 1.13.1 and python 3.7.3

from mediapipe.

caocao1989 avatar caocao1989 commented on April 27, 2024

@junhwanjang thank you very much!!!

from mediapipe.

scm-ns avatar scm-ns commented on April 27, 2024

@jiuqiant The ops in mediapipe/util/tflite/operations seems to the cpu impls. I am wondering how the model works on the GPU?

@fanzhanggoogle I looked at the op_resolver, which seems to be used by mediapipe when it is using the GPU delegate. But the registrations for ConvTranspose is (nullptr, nullptr, nullptr, nullptr). Which means there is no function in the registration. I am curious as to where the ConvTranspose GPU kernel is implemented.

I am trying to run the TFLite model using the GPU delegate, and I am running into some errors. I am running in a EXC_BAD_ACCESS in the function Convolution2DTransposeBianParser::IsSupported. Do you guys have any info?

from mediapipe.

shoutOutYangJie avatar shoutOutYangJie commented on April 27, 2024

Thanks to @junhwanjang and his awesome repo, now I can load palm detection model without custom op.

@junhwanjang , except for the 'specified version of tensorflow', is there any other modifications of the usage of tflite intenpreter? I still encountered this error:unresolved custom op: Convolution2DTransposeBias using "tensorflow-lite:1.13.0".

do you solve this problem? I meet the same question.

from mediapipe.

shoutOutYangJie avatar shoutOutYangJie commented on April 27, 2024

To avoid stress you can use it with Tensorflow C++ Lite. And build with Bazel.
It's faster than compiling the whole Tensorflow. I've done that and it works fine for me.
Just copy the custom op from mediapipe's tensorflow sub folder.
Then Create a class to inherit from the BuiltinOpResolver and add the Custom Op from there just as in mediapipe.

Can tensorflow lite C++ depoly on Visual studio project and windows system?

from mediapipe.

shoutOutYangJie avatar shoutOutYangJie commented on April 27, 2024

Thanks to @junhwanjang and his awesome repo, now I can load palm detection model without custom op.

can you tell me how to solve the problem, I meet same error when running "interpreter.allocate_tensors()". The repo has been deleted, Please tell me how to avoid the problem or can you share me your tflite which can directly be used to tflite python API without C++.

from mediapipe.

shoutOutYangJie avatar shoutOutYangJie commented on April 27, 2024

@junhwanjang thank you very much!!!

can you share how to resolve this problem?

from mediapipe.

shoutOutYangJie avatar shoutOutYangJie commented on April 27, 2024

Can any one give a little bit more details on how to incorporate these custom ops to be able to run it in regular python enviroment.

have you solved this difficult question?

from mediapipe.

shoutOutYangJie avatar shoutOutYangJie commented on April 27, 2024

Got the same error in python when I tried to load the tflite model into the Interpreter.

ValueError: Didn't find custom op for name 'Convolution2DTransposeBias' with version 1
Registration failed. 

Code:

import tensorflow as tf
interpreter = tf.lite.Interpreter(model_path="palm_detection.tflite")

I can see that it can be resolved using the tflite::InterpreterBuilder in C api
but in python tf.lite.Interpreter alone is available InterpreterBuilder is not available

Environment:
Python - 3.7
Tensorflow - 1.14

So if I just want to run this tflite model on python environment, How to avoid this problem

from mediapipe.

shoutOutYangJie avatar shoutOutYangJie commented on April 27, 2024

@shoutOutYangJie I closed my repo because of some private reason.
You can use "palm_detection_without_custom_op.tflite" in the below link.
https://github.com/metalwhale/hand_tracking

Thanks you very much. You save my life!! Could you introduce roughly what important steps you did ? How to generate this new tflite model without custom ops.

from mediapipe.

shoutOutYangJie avatar shoutOutYangJie commented on April 27, 2024

from mediapipe.

lip-realmax avatar lip-realmax commented on April 27, 2024

lo

@lamarrr Hi, could you please share a little bit more on the TF Lite C++ part? E.g. how to build and be linked with applications for C++ usage?

from mediapipe.

Akshaysharma29 avatar Akshaysharma29 commented on April 27, 2024

@junhwanjang
Hi Thanks for sharing model. I have same question
#35 (comment)

from mediapipe.

ragavendranbala avatar ragavendranbala commented on April 27, 2024

@Akshaysharma29 @shoutOutYangJie Did you find the solution?

from mediapipe.

Akshaysharma29 avatar Akshaysharma29 commented on April 27, 2024

@ragavendranbala No I have not changed there custom_ops have you tried that?

from mediapipe.

junhwanjang avatar junhwanjang commented on April 27, 2024

@Akshaysharma29 @shoutOutYangJie @ragavendranbala
Sorry for late reply first.
As I checked their operations manually, actually their custom ops (Conv2dTransposeBiasAdd) was combined with Conv2DTranspose and BiasAdd. So I "rephrased" it as Conv2DTranspose and BiasAdd separately. It was simple solution I found.

from mediapipe.

smahadwale2001 avatar smahadwale2001 commented on April 27, 2024

@Akshaysharma29 @shoutOutYangJie @ragavendranbala
Sorry for late reply first.
As I checked their operations manually, actually their custom ops (Conv2dTransposeBiasAdd) was combined with Conv2DTranspose and BiasAdd. So I "rephrased" it as Conv2DTranspose and BiasAdd separately. It was simple solution I found.

Can you share your code

from mediapipe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.