wolterlw / hand_tracking

Minimal Python interface for Google's Mediapipe HandTracking pipeline
Apache License 2.0
148 stars 37 forks source link

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

Closed imLogM closed 5 years ago

imLogM commented 5 years ago

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 ?

imLogM commented 5 years ago

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

imLogM commented 5 years ago

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

wolterlw commented 5 years ago

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

DmitryRyumin commented 5 years ago

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

imLogM commented 5 years ago

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.

aashish-kumar commented 5 years ago

@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, std::unique_ptr, 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()); `

aashish-kumar commented 5 years ago

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

LeeYongchao commented 4 years ago

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