JieHe96 / iOS_Tensorflow_ObjectDetection_Example

An iOS application of Tensorflow Object Detection with different models: SSD with Mobilenet, SSD with InceptionV2, Faster-RCNN-resnet101

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Encounting No OpKernel problem, try the solutions offered in the readme.m but faild

KindleHe opened this issue · comments

I use the pb file(in ssd_mobilenet_v1_coco_11_06_2017) offerd by author, and set the right environment. But encounted the following problem. Upon I add the "tensorflow/core/kernels/cwise_op_xxx.cc" into "tensorflow/contrib/makefile/tf_op_files.txt". Other "Op ' xxx'" problems will occurs, so I don't think the solutions presented by author is the best, if anyone can give some help, I will be appreciated of that!!!
No OpKernel was registered to support Op 'Equal' with these attrs. Registered devices: [CPU], Registered kernels:

 [[Node: Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Equal = Equal[T=DT_INT32](Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/strided_slice, Postprocessor/

You could try the below solutions:

First delete the following folders in "tensorflow/contrib/makefile/gen" :

bin/
dep/
lib/
obj/

Then make sure you put the "ops_to_register.h" to $TF_ROOT/tensorflow/core/framework.

Also, in the Makefile, make sure to delete the line "-D__ANDROID_TYPES_SLIM__ " under "# Settings for iOS." for all "$(IOS_ARCH)".

Finally recompile the ios dependencies:

cd $TF_ROOT
tensorflow/contrib/makefile/build_all_ios_ssd.sh

@JieHe96 I'm recompiling now. If succeed, I'll tell you. But before that, I have two questions to ask:

  1. why should I delete line "-D__ANDROID_TYPES_SLIM__ " under "# Settings for iOS." for all "$(IOS_ARCH)".
  2. Should I set the output_node_name in Xcode the same as that of frozen_inference_graph.pb file? If so, how can I get the output_node_name of frozen_inference_graph.pb?

@JieHe96 I'm sorry to trouble for the No OpKernel problem again. "No Op 'Conv2D' " problem occurs instead of "Equal", after I recompiled the ios dependencied following your instructions. "Invalid argument: No OpKernel was registered to support Op 'Conv2D' with these attrs. Registered devices: [CPU], Registered kernels:

 [[Node: FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/convolution = Conv2D[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true](Preprocessor/sub, FeatureExtractor/MobilenetV1/Conv2d_0/weights/read, ^FeatureExtractor/Assert/Assert)]]" 

I mentioned this problem in the FAQ section
screen shot 2017-07-20 at 2 49 46 pm

Also for the first question you asked, I answered it in this issue: tensorflow/tensorflow#9476

For the second question, yes you need to set the output node name the same as that of pb files. In order to check the name of output node name, you could use the Tensorboard by following the Google official instruction.

@JieHe96 Thank you very much, It does work ! I think the crucial steps are followings: 1. put "ops_to_register.h" generated from your own pb file to $TF_ROOT/tensorflow/core/framework. 2. replace the "Conv2DOp" line in the ops_toregister.h with "Conv2DUsingGemmOp<..........>>>" 3.delete line "-D__ANDROID_TYPES_SLIM__ " under "# Settings for iOS." for all "$(IOS_ARCH)". 4 tensorflow/contrib/makefile/compile_ios_tensorflow.sh "-O3 -DANDROID_TYPES=ANDROID_TYPES_FULL -DSELECTIVE_REGISTRATION -DSUPPORT_SELECTIVE_REGISTRATION"
Thanks again for your kind-heart

No problem, thanks for trying my example :)