asus4 / tf-lite-unity-sample

TensorFlow Lite Samples on Unity
869 stars 254 forks source link

SSD Demo is not working with Teachable Exports #25

Closed tholmgren closed 4 years ago

tholmgren commented 4 years ago

Thank you for posting this example and plugin. It's a great addition for Unity3d.

I'm having a small problem with using custom data from Google's Teachable. The Exported Tensorflow Lite quantized models are showing an error in Unity.

I've tested a few test exports using TensorFlow Lite > image_classification IOS example and they all work without an issue.

Any idea why these exported models won't work in Unity with the plug-In?

The following are my steps with more details:

Teachable: https://teachablemachine.withgoogle.com/train/image

  1. Creating 3 classes with 20 photos in each class
  2. Training the model with their default settings
  3. Selecting "Export Model"
  4. Select 3rd tab (Tensorflow Lite) with Quantized selected
  5. Select "Download my model"

It'll only take about 5 minutes to create a sample model for a test.

Unity Error

Exception: TensorFlowLite operation failed. TensorFlowLite.Interpreter.ThrowIfError (TensorFlowLite.Interpreter+Status status) (at Assets/TensorFlowLite/SDK/Scripts/Interpreter.cs:196) TensorFlowLite.Interpreter.GetOutputTensorData (System.Int32 outputTensorIndex, System.Array outputTensorData) (at Assets/TensorFlowLite/SDK/Scripts/Interpreter.cs:147) TensorFlowLite.SSD.Invoke (UnityEngine.Texture inputTex) (at Assets/Samples/SSD/SSD.cs:34) SsdSample.Update () (at Assets/Samples/SSD/SsdSample.cs:62)

Thanks in advance for your help.

asus4 commented 4 years ago

Hi @tholmgren I have not tested Teachable Machine yet. but it seems a sort of image classification program. SSD.cs is a port of Object Detection in TensorFlow examples