asus4 / tf-lite-unity-sample

TensorFlow Lite Samples on Unity
861 stars 252 forks source link

Yolov4-tiny-416.tflite custom trained model not working in SSD scene #89

Closed syedali1621 closed 3 years ago

syedali1621 commented 3 years ago

I have trained my own dataset using Yolov4tiny darknet and converted the .weight file into .pb file then further converted .pb to .tflite i am trying to run my .tflite file on unity ssd scene but facing below errors. I have changed the label file path to my label file and also changed .tffile path.

Exception: TensorFlowLite operation failed. TensorFlowLite.Interpreter.ThrowIfError (TensorFlowLite.Interpreter+Status status) (at Packages/com.github.asus4.tflite/Runtime/Interpreter.cs:181) TensorFlowLite.Interpreter.SetInputTensorData (System.Int32 inputTensorIndex, System.Array inputTensorData) (at Packages/com.github.asus4.tflite/Runtime/Interpreter.cs:97) TensorFlowLite.SSD.Invoke (UnityEngine.Texture inputTex) (at Assets/Samples/SSD/SSD.cs:32) SsdSample.Update () (at Assets/Samples/SSD/SsdSample.cs:58)

asus4 commented 3 years ago

Need more detail about this issue. Please refer #7 and confirm the model input/output and type/size are correct.

syedali1621 commented 3 years ago

416 Well my model properties are different do i need same properties to run my model in unity SSD scene? i trained using Alexab darknet then convert into .tflite i can change input size to 300*300 but i don't know how to change other properties. How you trained coco_ssd_mobilenet_quant.tflite model which repository you have used i think i need to train with same repository to get same model properties?

asus4 commented 3 years ago

This repo contains samples of only pre-traind models in the TensorFlow/MediaPipe official repo. If you wanted to use the same SSD model, please refer the link

You can modify the code to adapt your model. The input/output format should be like this:

syedali1621 commented 3 years ago

Thank you for your answer could you please explain which script do I need to modify?

syedali1621 commented 3 years ago

300300 I have trained another model with same 300*300 image size. converted .pb file into tflite but still model is not running in unity . Could you please tell me which script do I need to modify to run it in unity ?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

bertafmorena commented 2 years ago

Could you pls specify which scripts do I have to modify to use my custom model with input_type = float32[1,640,640,3]