SciSharp-Stack-Examples icon indicating copy to clipboard operation
SciSharp-Stack-Examples copied to clipboard

No operations detected in saved model when running Session.LoadFromSavedModel

Open ayadgithub opened this issue 4 years ago • 1 comments

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

ayadgithub avatar Mar 26 '21 13:03 ayadgithub

did you fix this?

IamSierraCharlie avatar Jan 02 '22 02:01 IamSierraCharlie