Syn-McJ / TFClassify-Unity

An example of using Tensorflow with Unity for image classification and object detection.
MIT License
167 stars 47 forks source link

Freeze when use another model? #5

Closed HappyModeOn closed 6 years ago

HappyModeOn commented 6 years ago

I change some code in Classifier.cs

private static string INPUT_NAME = "input"; private static string OUTPUT_NAME = "final_result"; here are log

Unable to lookup library path for 'libtensorflow', native render plugin support disabled.

Unable to find libtensorflow TFException: NodeDef mentions attr 'dilations' not in

TFException: NodeDef mentions attr 'dilations' not in Op<name=Conv2D; signature=input:T, filter:T -> output:T; attr=T:type,allowed=[DT_HALF, DT_FLOAT]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]>; NodeDef: MobilenetV1/MobilenetV1/Conv2d_0/convolution = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true](input, MobilenetV1/Conv2d_0/weights). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).

Syn-McJ commented 6 years ago

Judging by what the error says, there is mismatch between TF version that Unity plugin uses and TF version that you used to train your model. Try to downgrade your TF to 1.4.

This might be of help as well.

HappyModeOn commented 6 years ago

Thanks I downgrade it and it it not freeze now camera get picture But I got this error instead

3-21 18:54:19.718 30735 30757 E Unity : IndexOutOfRangeException: Index was outside the bounds of the array. 03-21 18:54:19.718 30735 30757 E Unity : at TFClassify.Classifier+cAnonStorey0.<>m0 () [0x00127] in /Users/dev1/Downloads/Test/Assets/Scripts/Classifier.cs:69 03-21 18:54:19.718 30735 30757 E Unity : at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in :0 03-21 18:54:19.718 30735 30757 E Unity : at System.Threading.Tasks.Task.Execute () [0x00010] in :0 03-21 18:54:19.718 30735 30757 E Unity : --- End of stack trace from previous location where exception was thrown --- 03-21 18:54:19.718 30735 30757 E Unity : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0 03-21 18:54:19.718 30735 30757 E Unity : at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0 03-21 18:54:19.718 30735 30757 E Unity : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0

HappyModeOn commented 6 years ago

Label that generate from my retrain scripts have 1 line with empty string. OK Thanks a lot This issue closed!

Syn-McJ commented 6 years ago

It means that the amount of labels you have is different from amount of probabilities that your model produce. This most likely indicates error somewhere in the process of training your models. I bet if you check your model with Python you'll get same error.

I suggest you to recheck your labels and categories and try to train your model from scratch in clean TF session.

EDIT: Ok great, glad it is resolved.