Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No OpKernel was registered to support Op 'Switch' with these attributes while using SSD_mobilenet models in Android tensorflow-demo #1740

Closed
genminm opened this issue Jun 22, 2017 · 8 comments

Comments

@genminm
Copy link

genminm commented Jun 22, 2017

I am trying to use SSD_mobilenet model in the Android tensor flow demo to do object detection and tracking

I already followed the instructions here to transform the graph:#1609

but I get the following error: "No OpKernel was registered to support Op 'Switch' with these attrs. "

org.tensorflow.demo E/AndroidRuntime: FATAL EXCEPTION: inference
Process: org.tensorflow.demo, PID: 31398
java.lang.IllegalArgumentException: No OpKernel was registered to support Op 'Switch' with these attrs. Registered devices: [CPU], Registered kernels:
device='GPU'; T in [DT_STRING]
device='GPU'; T in [DT_BOOL]
device='GPU'; T in [DT_INT32]
device='GPU'; T in [DT_FLOAT]
device='CPU'; T in [DT_FLOAT]
device='CPU'; T in [DT_INT32]

                                                                 	 [[Node: Postprocessor/BatchMultiClassNonMaxSuppression/PadOrClipBoxList/cond/Switch = Switch[T=DT_BOOL](Postprocessor/BatchMultiClassNonMaxSuppression/PadOrClipBoxList/Greater, Postprocessor/BatchMultiClassNonMaxSuppression/PadOrClipBoxList/Greater)]]
@genminm genminm closed this as completed Jun 23, 2017
@qhutch
Copy link

qhutch commented Jun 27, 2017

hi @genminm
I have exactly the same issue with ssd_mobilenet on android, did you manage to find a solution for that ?

@genminm
Copy link
Author

genminm commented Jun 27, 2017

I followed the instructions here:

https://stackoverflow.com/a/43627334

change all occurrences of the following in tensorflow/core/framework/register_types.h
#define TF_CALL_bool(m)
to
#define TF_CALL_bool(m) m(bool)

@cheeselover1
Copy link

I have exactly the same issue with facenet on android, did you manage to find a solution for that ?

@lucasjinreal
Copy link

@genminm There is no TF_CALL_bool(m) in tensorflow/core/framework/register_types.h at all...

@hashimshafiq
Copy link

The above solution is not working at all.

@mpeniak
Copy link

mpeniak commented Oct 13, 2017

I got the same issue...it was working fine last week...now I checkout a fresh copy on a different machine and tried doing exactly the same thing as before. The app now compiles after I added:

repositories {
    jcenter()
    maven {
        url 'https://google.bintray.com/tensorflow'
    }
}

To build.gradle.... but the app crashes upon start with the following dump:

Any got a solution???

10-13 10:19:44.727 20504-20504/? I/zygote: Late-enabling -Xcheck:jni
10-13 10:19:44.888 20504-20504/org.tensorflow.demo I/InstantRun: starting instant run server: is main process
10-13 10:19:44.929 20504-20504/org.tensorflow.demo D/tensorflow: CameraActivity: onCreate org.tensorflow.demo.DetectorActivity@d97a4c5
10-13 10:19:44.949 20504-20504/org.tensorflow.demo I/CameraManagerGlobal: Connecting to camera service
10-13 10:19:44.977 20504-20504/org.tensorflow.demo I/tensorflow: CameraActivity: Camera API lv2?: true
10-13 10:19:45.012 20504-20504/org.tensorflow.demo D/tensorflow: CameraActivity: onStart org.tensorflow.demo.DetectorActivity@d97a4c5
10-13 10:19:45.014 20504-20504/org.tensorflow.demo D/tensorflow: CameraActivity: onResume org.tensorflow.demo.DetectorActivity@d97a4c5
10-13 10:19:45.025 20504-20539/org.tensorflow.demo D/OpenGLRenderer: HWUI GL Pipeline
10-13 10:19:45.053 20504-20539/org.tensorflow.demo I/Adreno: QUALCOMM build : 7142022, Ib5823dd10c
Build Date : 06/23/17
OpenGL ES Shader Compiler Version: EV031.18.00.00
Local Branch : O11A
Remote Branch :
Remote Branch :
Reconstruct Branch :
10-13 10:19:45.059 20504-20539/org.tensorflow.demo I/Adreno: PFP: 0x005ff087, ME: 0x005ff063
10-13 10:19:45.061 20504-20539/org.tensorflow.demo I/OpenGLRenderer: Initialized EGL, version 1.4
10-13 10:19:45.061 20504-20539/org.tensorflow.demo D/OpenGLRenderer: Swap behavior 2
10-13 10:19:45.084 20504-20504/org.tensorflow.demo I/tensorflow: CameraConnectionFragment: Desired size: 640x480, min size: 480x480
10-13 10:19:45.085 20504-20504/org.tensorflow.demo I/tensorflow: CameraConnectionFragment: Valid preview sizes: [4048x3036, 4000x3000, 3840x2160, 3264x2448, 3200x2400, 2976x2976, 2592x1944, 2688x1512, 2048x1536, 1920x1080, 1600x1200, 1440x1080, 1280x960, 1280x768, 1280x720, 1024x768, 800x600, 800x480, 720x480, 640x480, 480x640]
10-13 10:19:45.086 20504-20504/org.tensorflow.demo I/tensorflow: CameraConnectionFragment: Rejected preview sizes: [640x360, 480x360, 480x320, 352x288, 320x240, 240x320, 176x144, 160x120, 144x176]
10-13 10:19:45.086 20504-20504/org.tensorflow.demo I/tensorflow: CameraConnectionFragment: Exact size match found.
10-13 10:19:45.094 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: ???
10-13 10:19:45.094 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: person
10-13 10:19:45.094 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: bicycle
10-13 10:19:45.094 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: car
10-13 10:19:45.094 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: motorcycle
10-13 10:19:45.094 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: airplane
10-13 10:19:45.094 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: bus
10-13 10:19:45.094 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: train
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: truck
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: boat
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: traffic light
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: fire hydrant
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: ???
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: stop sign
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: parking meter
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: bench
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: bird
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: cat
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: dog
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: horse
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: sheep
10-13 10:19:45.095 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: cow
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: elephant
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: bear
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: zebra
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: giraffe
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: ???
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: backpack
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: umbrella
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: ???
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: ???
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: handbag
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: tie
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: suitcase
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: frisbee
10-13 10:19:45.096 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: skis
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: snowboard
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: sports ball
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: kite
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: baseball bat
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: baseball glove
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: skateboard
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: surfboard
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: tennis racket
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: bottle
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: ???
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: wine glass
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: cup
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: fork
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: knife
10-13 10:19:45.097 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: spoon
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: bowl
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: banana
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: apple
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: sandwich
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: orange
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: broccoli
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: carrot
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: hot dog
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: pizza
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: donut
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: cake
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: chair
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: couch
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: potted plant
10-13 10:19:45.098 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: bed
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: ???
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: dining table
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: ???
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: ???
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: toilet
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: ???
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: tv
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: laptop
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: mouse
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: remote
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: keyboard
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: cell phone
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: microwave
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: oven
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: toaster
10-13 10:19:45.099 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: sink
10-13 10:19:45.100 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: refrigerator
10-13 10:19:45.100 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: ???
10-13 10:19:45.100 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: book
10-13 10:19:45.100 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: clock
10-13 10:19:45.100 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: vase
10-13 10:19:45.100 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: scissors
10-13 10:19:45.100 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: teddy bear
10-13 10:19:45.100 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: hair drier
10-13 10:19:45.100 20504-20504/org.tensorflow.demo W/tensorflow: TensorFlowObjectDetectionAPIModel: toothbrush
10-13 10:19:45.102 20504-20504/org.tensorflow.demo I/TensorFlowInferenceInterface: Checking to see if TensorFlow native methods are already loaded
10-13 10:19:45.102 20504-20504/org.tensorflow.demo E/zygote: No implementation found for long org.tensorflow.contrib.android.RunStats.allocate() (tried Java_org_tensorflow_contrib_android_RunStats_allocate and Java_org_tensorflow_contrib_android_RunStats_allocate__)
10-13 10:19:45.102 20504-20504/org.tensorflow.demo I/TensorFlowInferenceInterface: TensorFlow native methods not found, attempting to load via tensorflow_inference
10-13 10:19:45.133 20504-20504/org.tensorflow.demo I/TensorFlowInferenceInterface: Successfully loaded TensorFlow native methods (RunStats error may be ignored)
10-13 10:19:46.277 20504-20504/org.tensorflow.demo I/TensorFlowInferenceInterface: Model load took 1118ms, TensorFlow version: 1.3.0-rc2
10-13 10:19:46.279 20504-20504/org.tensorflow.demo I/TensorFlowInferenceInterface: Successfully loaded model from 'file:///android_asset/ssd_mobilenet_v1_android_export.pb'
10-13 10:19:46.282 20504-20504/org.tensorflow.demo I/tensorflow: DetectorActivity: Sensor orientation: 90, Screen orientation: 0
10-13 10:19:46.282 20504-20504/org.tensorflow.demo I/tensorflow: DetectorActivity: Initializing at size 640x480
10-13 10:19:46.330 20504-20538/org.tensorflow.demo I/tensorflow: CameraConnectionFragment: Opening camera preview: 640x480
10-13 10:19:46.349 20504-20504/org.tensorflow.demo I/Choreographer: Skipped 74 frames! The application may be doing too much work on its main thread.
10-13 10:19:46.618 20504-20538/org.tensorflow.demo D/tensorflow: CameraActivity: Initializing buffer 0 at size 307200
10-13 10:19:46.619 20504-20538/org.tensorflow.demo D/tensorflow: CameraActivity: Initializing buffer 1 at size 153599
10-13 10:19:46.620 20504-20538/org.tensorflow.demo D/tensorflow: CameraActivity: Initializing buffer 2 at size 153599
10-13 10:19:46.624 20504-20538/org.tensorflow.demo I/tensorflow: MultiBoxTracker: Initializing ObjectTracker: 640x480
10-13 10:19:46.624 20504-20538/org.tensorflow.demo I/native: Initializing object tracker. 320x240 @0xd7e3817c
10-13 10:19:46.627 20504-20538/org.tensorflow.demo I/native: Initialized!
10-13 10:19:46.630 20504-20538/org.tensorflow.demo I/tensorflow: DetectorActivity: Preparing image 1 for detection in bg thread.
10-13 10:19:46.664 20504-20537/org.tensorflow.demo I/tensorflow: DetectorActivity: Running detection on image 1
10-13 10:19:47.004 20504-20537/org.tensorflow.demo E/TensorFlowInferenceInterface: Failed to run TensorFlow inference with inputs:[image_tensor], outputs:[detection_boxes, detection_scores, detection_classes, num_detections]
10-13 10:19:47.006 20504-20537/org.tensorflow.demo E/AndroidRuntime: FATAL EXCEPTION: inference
Process: org.tensorflow.demo, PID: 20504
java.lang.IllegalArgumentException: No OpKernel was registered to support Op 'Switch' with these attrs. Registered devices: [CPU], Registered kernels:
device='GPU'; T in [DT_STRING]
device='GPU'; T in [DT_BOOL]
device='GPU'; T in [DT_INT32]
device='GPU'; T in [DT_FLOAT]
device='CPU'; T in [DT_FLOAT]
device='CPU'; T in [DT_INT32]

                                                                 	 [[Node: Postprocessor/BatchMultiClassNonMaxSuppression/map/while/PadOrClipBoxList/cond/Switch = Switch[T=DT_BOOL](Postprocessor/BatchMultiClassNonMaxSuppression/map/while/PadOrClipBoxList/Greater, Postprocessor/BatchMultiClassNonMaxSuppression/map/while/PadOrClipBoxList/Greater)]]
                                                                     at org.tensorflow.Session.run(Native Method)
                                                                     at org.tensorflow.Session.access$100(Session.java:48)
                                                                     at org.tensorflow.Session$Runner.runHelper(Session.java:295)
                                                                     at org.tensorflow.Session$Runner.run(Session.java:245)
                                                                     at org.tensorflow.contrib.android.TensorFlowInferenceInterface.run(TensorFlowInferenceInterface.java:143)
                                                                     at org.tensorflow.demo.TensorFlowObjectDetectionAPIModel.recognizeImage(TensorFlowObjectDetectionAPIModel.java:158)
                                                                     at org.tensorflow.demo.DetectorActivity$3.run(DetectorActivity.java:292)
                                                                     at android.os.Handler.handleCallback(Handler.java:789)
                                                                     at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                     at android.os.Looper.loop(Looper.java:164)
                                                                     at android.os.HandlerThread.run(HandlerThread.java:65)

10-13 10:19:47.473 20504-20504/org.tensorflow.demo D/tensorflow: CameraActivity: onPause org.tensorflow.demo.DetectorActivity@d97a4c5

@sufish
Copy link

sufish commented Oct 17, 2017

@mpeniak if you download latest aar from http://ci.tensorflow.org/view/Nightly/job/nightly-android/ and import into your project, this issue will be gone. i guess the one in jcenter does not contain fix for this issue

@vvkv
Copy link

vvkv commented May 10, 2018

@sufish Could you outline the steps to accomplish this please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants