SciSharp / SciSharp-Stack-Examples

Practical examples written in SciSharp's machine learning libraries
http://scisharpstack.org
Apache License 2.0
313 stars 100 forks source link

No operations detected in saved model when running Session.LoadFromSavedModel #47

Open ayadgithub opened 3 years ago

ayadgithub commented 3 years ago

Hello ,

I have trained a SSD MobileNet V2 FPNLite 640x640 pretrained model in Tensorflow 2.4 with my own data and exported as saved model .The inference and image object detection prediction is working perfectly fine in python . Im trying to do the same in Tensorflow.Net using the below code : Session session = Session.LoadFromSavedModel(@"........\saved_model"); Tensor tensorNum = graph.OperationByName("num_detections"); Tensor tensorBoxes = graph.OperationByName("detection_boxes"); Tensor tensorScores = graph.OperationByName("detection_scores"); Tensor tensorClasses = graph.OperationByName("detection_classes"); Tensor imgTensor = graph.OperationByName("image_tensor"); Tensor[] outTensorArr = new Tensor[] { tensorNum, tensorBoxes, tensorScores, tensorClasses };

Im getting below weird error:

Tensorflow.ValueError: 'Could not find operation "num_detections" inside graph "grap-key-1/".'

I tried to loop the graph operations of the session but there is nothing in there .

Why this is happening ,it is the same model Im using in python and giving correct results .

Appreciate any help

Regards Ayad

IamSierraCharlie commented 2 years ago

did you fix this?