Azure-Samples / cognitive-services-android-customvision-sample

Sample Anroid app for image classification using a TensorFlow model exported from Microsoft Cognitive Services Custom Vision
58 stars 57 forks source link

Error building project - No Operation named [loss] in the Graph #20

Open sachin-ranka opened 5 years ago

sachin-ranka commented 5 years ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Clone repo, replace exported pb files. Run the project on a phone.

Any log messages given by the failure

12-19 15:16:07.174 8182-8182/? I/Zygote: seccomp disabled by setenforce 0
12-19 15:16:07.184 8182-8182/? I/omvision_sampl: Late-enabling -Xcheck:jni
12-19 15:16:07.727 8182-8182/demo.tensorflow.org.customvision_sample W/omvision_sampl: JIT profile information will not be recorded: profile file does not exits.
12-19 15:16:07.734 8182-8182/demo.tensorflow.org.customvision_sample I/chatty: uid=10139(demo.tensorflow.org.customvision_sample) identical 10 lines
12-19 15:16:07.734 8182-8182/demo.tensorflow.org.customvision_sample W/omvision_sampl: JIT profile information will not be recorded: profile file does not exits.
12-19 15:16:07.778 8182-8182/demo.tensorflow.org.customvision_sample I/InstantRun: starting instant run server: is main process
12-19 15:16:07.868 8182-8182/demo.tensorflow.org.customvision_sample D/tensorflow: CameraActivity: onCreate demo.tensorflow.org.customvision_sample.ClassifierActivity@ecaa1d5
12-19 15:16:07.946 8182-8182/demo.tensorflow.org.customvision_sample I/CameraManagerGlobal: Connecting to camera service
12-19 15:16:07.994 8182-8182/demo.tensorflow.org.customvision_sample I/tensorflow: CameraActivity: Camera API lv2?: true
12-19 15:16:08.122 8182-8182/demo.tensorflow.org.customvision_sample D/tensorflow: CameraActivity: onStart demo.tensorflow.org.customvision_sample.ClassifierActivity@ecaa1d5
12-19 15:16:08.124 8182-8182/demo.tensorflow.org.customvision_sample D/tensorflow: CameraActivity: onResume demo.tensorflow.org.customvision_sample.ClassifierActivity@ecaa1d5
12-19 15:16:08.144 8182-8182/demo.tensorflow.org.customvision_sample D/OpenGLRenderer: Skia GL Pipeline
12-19 15:16:08.213 8182-8227/demo.tensorflow.org.customvision_sample I/Adreno: QUALCOMM build                   : a5b4970, If5818605d9
Build Date                       : 10/12/16
OpenGL ES Shader Compiler Version: XE031.09.00.04
Local Branch                     : N24D
Remote Branch                    : 
Remote Branch                    : 
Reconstruct Branch               : 
12-19 15:16:08.221 8182-8227/demo.tensorflow.org.customvision_sample I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
12-19 15:16:08.223 8182-8227/demo.tensorflow.org.customvision_sample I/OpenGLRenderer: Initialized EGL, version 1.4
12-19 15:16:08.223 8182-8227/demo.tensorflow.org.customvision_sample D/OpenGLRenderer: Swap behavior 1
12-19 15:16:08.302 8182-8182/demo.tensorflow.org.customvision_sample I/tensorflow: CameraConnectionFragment: Desired size: 720x480, min size: 480x480
12-19 15:16:08.304 8182-8182/demo.tensorflow.org.customvision_sample I/tensorflow: CameraConnectionFragment: Valid preview sizes: [4160x3120, 4160x2774, 4160x2340, 4000x3000, 3840x2160, 3264x2176, 3200x2400, 3200x1800, 2592x1944, 2592x1728, 2048x1536, 1920x1440, 1920x1080, 1280x960, 1280x768, 1280x720, 1024x768, 800x600, 800x480, 720x480, 640x480]
12-19 15:16:08.305 8182-8182/demo.tensorflow.org.customvision_sample I/tensorflow: CameraConnectionFragment: Rejected preview sizes: [352x288, 320x240, 176x144]
CameraConnectionFragment: Exact size match found.
12-19 15:16:08.429 8182-8182/demo.tensorflow.org.customvision_sample I/TensorFlowInferenceInterface: Checking to see if TensorFlow native methods are already loaded
12-19 15:16:08.430 8182-8182/demo.tensorflow.org.customvision_sample I/TensorFlowInferenceInterface: TensorFlow native methods already loaded
12-19 15:16:08.836 8182-8182/demo.tensorflow.org.customvision_sample I/TensorFlowInferenceInterface: Model load took 218ms, TensorFlow version: 1.12.0
12-19 15:16:08.842 8182-8182/demo.tensorflow.org.customvision_sample I/TensorFlowInferenceInterface: Successfully loaded model from 'file:///android_asset/model.pb'
12-19 15:16:08.861 8182-8182/demo.tensorflow.org.customvision_sample I/tensorflow: ClassifierActivity: Sensor orientation: 90, Screen orientation: 0
12-19 15:16:08.862 8182-8182/demo.tensorflow.org.customvision_sample I/tensorflow: ClassifierActivity: Initializing at size 720x480
12-19 15:16:08.996 8182-8225/demo.tensorflow.org.customvision_sample I/tensorflow: CameraConnectionFragment: Opening camera preview: 720x480
12-19 15:16:09.003 8182-8227/demo.tensorflow.org.customvision_sample D/vndksupport: Loading /vendor/lib/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace.
12-19 15:16:09.004 8182-8227/demo.tensorflow.org.customvision_sample D/vndksupport: Loading /vendor/lib/hw/gralloc.msm8084.so from current namespace instead of sphal namespace.
12-19 15:16:09.017 8182-8211/demo.tensorflow.org.customvision_sample I/Gralloc2: Adding additional valid usage bits: 0x2000000
12-19 15:16:09.056 8182-8227/demo.tensorflow.org.customvision_sample I/OpenGLRenderer: Davey! duration=790ms; Flags=0, IntendedVsync=1066622849972, Vsync=1066622849972, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1066623404403, AnimationStart=1066623488362, PerformTraversalsStart=1066623503570, DrawStart=1066624443258, SyncQueued=1067357094789, SyncStart=1067357286351, IssueDrawCommandsStart=1067357412601, SwapBuffers=1067407803388, FrameCompleted=1067413289951, DequeueBufferDuration=189000, QueueBufferDuration=633000, 
12-19 15:16:09.058 8182-8182/demo.tensorflow.org.customvision_sample I/Choreographer: Skipped 44 frames!  The application may be doing too much work on its main thread.
12-19 15:16:09.089 8182-8227/demo.tensorflow.org.customvision_sample I/OpenGLRenderer: Davey! duration=773ms; Flags=0, IntendedVsync=1066673156648, Vsync=1067406489996, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1067415435888, AnimationStart=1067415549586, PerformTraversalsStart=1067415563597, DrawStart=1067421412139, SyncQueued=1067422931045, SyncStart=1067423007400, IssueDrawCommandsStart=1067423080420, SwapBuffers=1067446068131, FrameCompleted=1067446886204, DequeueBufferDuration=157000, QueueBufferDuration=459000, 
12-19 15:16:09.436 8182-8225/demo.tensorflow.org.customvision_sample D/tensorflow: CameraActivity: Initializing buffer 0 at size 353264
12-19 15:16:09.442 8182-8225/demo.tensorflow.org.customvision_sample D/tensorflow: CameraActivity: Initializing buffer 1 at size 176623
12-19 15:16:09.444 8182-8225/demo.tensorflow.org.customvision_sample D/tensorflow: CameraActivity: Initializing buffer 2 at size 176623
12-19 15:16:09.848 8182-8224/demo.tensorflow.org.customvision_sample E/AndroidRuntime: FATAL EXCEPTION: inference
Process: demo.tensorflow.org.customvision_sample, PID: 8182
java.lang.IllegalArgumentException: No Operation named [loss] in the Graph
at org.tensorflow.Session$Runner.operationByName(Session.java:372)
at org.tensorflow.Session$Runner.fetch(Session.java:181)
at org.tensorflow.contrib.android.TensorFlowInferenceInterface.run(TensorFlowInferenceInterface.java:209)
at org.tensorflow.contrib.android.TensorFlowInferenceInterface.run(TensorFlowInferenceInterface.java:197)
at org.tensorflow.contrib.android.TensorFlowInferenceInterface.run(TensorFlowInferenceInterface.java:187)
at demo.tensorflow.org.customvision_sample.MSCognitiveServicesClassifier.classifyImage(MSCognitiveServicesClassifier.java:135)
at demo.tensorflow.org.customvision_sample.ClassifierActivity$2.run(ClassifierActivity.java:101)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)
12-19 15:16:09.878 8182-8224/demo.tensorflow.org.customvision_sample I/Process: Sending signal. PID: 8182 SIG: 9

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?) Win 10, Android Studio 3, gradle 3.1.1

Versions

Latest commit 57cf02d

Mention any other details that might be useful


Thanks! We'll be in touch soon.

sachin-ranka commented 5 years ago

Nudging contributors - @delfu @shonohs

shonohs commented 5 years ago

Thanks for the bug report. Could you give us more details about the pb file you used? which domain and which classification type?

sachin-ranka commented 5 years ago

I've used only the tensorflow android export from CustomVision - General (compact) - Object detection.

shonohs commented 5 years ago

Sorry, unfortunately this sample project doesn't support Object Detection.

sachin-ranka commented 5 years ago

@shonohs Pls help me out on how to do object detection with the trained model, the problem mainly is output and input node names, which are not working even for classification. It would be nice to have object detection sample as well. Or any tutorial or steps to do/guidance would be appreciated.

shonohs commented 5 years ago

The input name of the object detection model is 'Placeholder:0', and the output name is 'model_outputs:0'. To extract bounding boxes, you will need to postprocess the model output. Please see the sample python scripts for the detail.

We are working on documentation.

sherkon18 commented 5 years ago

The input name of the object detection model is 'Placeholder:0', and the output name is 'model_outputs:0'. To extract bounding boxes, you will need to postprocess the model output. Please see the sample python scripts for the detail.

We are working on documentation.

Any update on this? Looking forward to the documentation.

vishalrsingh commented 5 years ago

Any update on sample for object detection?