wolterlw / hand_tracking

Minimal Python interface for Google's Mediapipe HandTracking pipeline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

imLogM opened this issue · comments

Thank for your guide! :)
But when completed, I got an error "cannot find operation Convolution2DTransposeBias". It seems "CustomOperations" not participating in the compilation.
Could you please share your files which modified compared to tensorflow's source, include "CustomOperations" files and "BUILD" files ?

The error is
"Didn't find custom op for name 'Convolution2DTransposeBias' with version 1
Registration failed."

I have solved this problem.


My method is more complex.
The official source code has some "offical custom ops" in tensorflow/lite/kernels, showing how to add custom_ops.

So I used the following steps:

  1. According to tensorflow/lite/kernels/relu1.cc , revise the new custom_ops codes ( *.cc files );
  2. Put new custom_ops *.cc files into tensorflow/lite/kernels/;
  3. Modify tensorflow/lite/kernels/register.cc to register new custom_ops;
  4. Modify tensorflow/lite/kernels/BUILD, Bazel will compile custom_ops *.cc files into library builtin_op_kernels.
  5. Recompile the whole project.

Official guide maybe useful: https://www.tensorflow.org/lite/guide/ops_custom

Great, just came across your issue.
In case anybody needs it - here's the full git diff and the BUILD file in the custom_ops directory
https://gist.github.com/wolterlw/767a467d6f75b3533cd49482ba25ae7e

I have solved this problem.

My method is more complex.
The official source code has some "offical custom ops" in tensorflow/lite/kernels, showing how to add custom_ops.

So I used the following steps:

  1. According to tensorflow/lite/kernels/relu1.cc , revise the new custom_ops codes ( *.cc files );
  2. Put new custom_ops *.cc files into tensorflow/lite/kernels/;
  3. Modify tensorflow/lite/kernels/register.cc to register new custom_ops;
  4. Modify tensorflow/lite/kernels/BUILD, Bazel will compile custom_ops *.cc files into library builtin_op_kernels.
  5. Recompile the whole project.

Official guide maybe useful: https://www.tensorflow.org/lite/guide/ops_custom

Could you please share your files which modified compared to tensorflow's source? I have the same problem

I have solved this problem.
My method is more complex.
The official source code has some "offical custom ops" in tensorflow/lite/kernels, showing how to add custom_ops.
So I used the following steps:

  1. According to tensorflow/lite/kernels/relu1.cc , revise the new custom_ops codes ( *.cc files );
  2. Put new custom_ops *.cc files into tensorflow/lite/kernels/;
  3. Modify tensorflow/lite/kernels/register.cc to register new custom_ops;
  4. Modify tensorflow/lite/kernels/BUILD, Bazel will compile custom_ops *.cc files into library builtin_op_kernels.
  5. Recompile the whole project.

Official guide maybe useful: https://www.tensorflow.org/lite/guide/ops_custom

Could you please share your files which modified compared to tensorflow's source? I have the same problem

oh, my method is too complex, you can use @wolterlw 's method.

@wolterlw
Thanks for sharing.
I followed these changes : https://gist.github.com/wolterlw/767a467d6f75b3533cd49482ba25ae7e. Additionally I had to change the include path in each *.cc. I am stuck with this error.
tensorflow/lite/python/interpreter_wrapper/interpreter_wrapper.cc: In static member function 'static tflite::interpreter_wrapper::InterpreterWrapper* tflite::interpreter_wrapper::InterpreterWrapper::CreateInterpreterWrapper(std::unique_ptr<tflite::FlatBufferModel>, std::unique_ptr<tflite::interpreter_wrapper::PythonErrorReporter>, std::__cxx11::string*)': tensorflow/lite/python/interpreter_wrapper/interpreter_wrapper.cc:207:13: error: 'tflite_operations' has not been declared tflite_operations::RegisterMaxPoolingWithArgmax2D()); ^ tensorflow/lite/python/interpreter_wrapper/interpreter_wrapper.cc:209:13: error: 'tflite_operations' has not been declared tflite_operations::RegisterMaxUnpooling2D()); ^ tensorflow/lite/python/interpreter_wrapper/interpreter_wrapper.cc:211:13: error: 'tflite_operations' has not been declared tflite_operations::RegisterConvolution2DTransposeBias());

I figured out the namespace mediapipe has to be appended in interpreter_wrapper.cc

I figured out the namespace mediapipe has to be appended in interpreter_wrapper.cc
tflite_operations::RegisterMaxUnpooling2D() should be mediapipe::tflite_operations::RegisterMaxUnpooling2D()