tensorflow / models

Models and examples built with TensorFlow
Other
77.15k stars 45.75k forks source link

How can we test the model using the pb file ? #6690

Closed YasineNifa closed 4 years ago

YasineNifa commented 5 years ago

Hey,

I trained this model with my datasets and I generated the graph.pb file.

Now I would like to test my model based on this pb file.

Is there any method or script that may help me to do so?

Thanks

tensorflowbutler commented 5 years ago

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. What is the top-level directory of the model you are using Have I written custom code OS Platform and Distribution TensorFlow installed from TensorFlow version Bazel version CUDA/cuDNN version GPU model and memory Exact command to reproduce

ambarishgurjar commented 5 years ago

There is a script named label_image.py Mention the file location of your .pb file in the --graph argument

ryan1051 commented 5 years ago

There is a script named label_image.py Mention the file location of your .pb file in the --graph argument

How to find the input_layer and output_layer name as the label_image.py need? Thank you.

ambarishgurjar commented 5 years ago

There is a script named label_image.py Mention the file location of your .pb file in the --graph argument

How to find the input_layer and output_layer name as the label_image.py need? Thank you.

@ryan1051 if you are using tensorflow hub retraining then the name of the input layer is "Placeholder" and output layer is "final_result"

However while using tensorflow for poets I found that

for mobilenet input layer is named "input" and output layer is named "final_result" But if you try out any other network like Inception then the input layer changed to "Mul"

Please also make sure that you change the image Input_width and height for every network you use For mobilenet it is 224, for inception v3 it is 299 and for NASnet PNASnet it is 331

ryan1051 commented 5 years ago

There is a script named label_image.py Mention the file location of your .pb file in the --graph argument

How to find the input_layer and output_layer name as the label_image.py need? Thank you.

@ryan1051 if you are using tensorflow hub retraining then the name of the input layer is "Placeholder" and output layer is "final_result"

However while using tensorflow for poets I found that

for mobilenet input layer is named "input" and output layer is named "final_result" But if you try out any other network like Inception then the input layer changed to "Mul"

Please also make sure that you change the image Input_width and height for every network you use For mobilenet it is 224, for inception v3 it is 299 and for NASnet PNASnet it is 331

Is there any other scripts to test a model using a image without texting the net input and output layers?

ambarishgurjar commented 5 years ago

There is a script named label_image.py Mention the file location of your .pb file in the --graph argument

How to find the input_layer and output_layer name as the label_image.py need? Thank you.

@ryan1051 if you are using tensorflow hub retraining then the name of the input layer is "Placeholder" and output layer is "final_result" However while using tensorflow for poets I found that for mobilenet input layer is named "input" and output layer is named "final_result" But if you try out any other network like Inception then the input layer changed to "Mul" Please also make sure that you change the image Input_width and height for every network you use For mobilenet it is 224, for inception v3 it is 299 and for NASnet PNASnet it is 331

Is there any other scripts to test a model using a image without texting the net input and output layers?

Apologies. There might be but I am not aware about it.

However, what you can do is, use the command

tensorboard --logdir tf_files/training_summaries

Then go to the graph and try to figure out the name of the layer.

ambarishgurjar commented 5 years ago

@ryan1051 Are you trying to attempt Image retraining???

ryan1051 commented 5 years ago

@ryan1051 Are you trying to attempt Image retraining???

I trained a model using slim in tensorflow, just like the example showed, flowers classification with inception_v3 net. Now I want to get a classification result using a image.

ambarishgurjar commented 5 years ago

https://www.tensorflow.org/hub/tutorials/image_retraining

Please refer to the "using the retrained model" section

tensorflowbutler commented 4 years ago

Hi There, We are checking to see if you still need help on this, as this seems to be an old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing. If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.