Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

difficulty generating correct frozen .pb #7

Closed
LukeAI opened this issue Feb 25, 2019 · 2 comments
Closed

difficulty generating correct frozen .pb #7

LukeAI opened this issue Feb 25, 2019 · 2 comments

Comments

@LukeAI
Copy link

LukeAI commented Feb 25, 2019

I understand that you generated the provided yolov3_gpu_nms.pb using the pretrained coco weights from https://pjreddie.com/media/files/yolov3.weights placed in the checkpoint dir in this repo https://github.com/ardianumam/tensorflow-yolov3

My question is, what exactly did you run in order to generate the .pb? I generated my .pb with python convert_weight.py --convert --freeze but it doesn't give the correct output tensors as illustrated below.

  input_tensor, output_tensors = \
  utils.read_pb_return_tensors(tf.get_default_graph(),
                               GIVEN_ORIGINAL_YOLOv3_MODEL,
                               ["Placeholder:0", "concat_9:0", "mul_9:0"])
  print("\n\ninput_tensor\n", input_tensor)
  print("\n\noutput_tensors\n", output_tensors)

** Output for provided .pb (this works) **
input_tensor
 Tensor("import/Placeholder:0", shape=(1, 416, 416, 3), dtype=float32)

output_tensors
 [<tf.Tensor 'import/concat_9:0' shape=(1, 10647, 4) dtype=float32>, <tf.Tensor 'import/mul_9:0' shape=(1, 10647, 80) dtype=float32>]

** Output for my .pb (this doesn't work - see the output tensors shape)**
input_tensor
 Tensor("import/Placeholder:0", shape=(1, 416, 416, 3), dtype=float32)

output_tensors
 [<tf.Tensor 'import/concat_9:0' shape=(1, 10647, 4) dtype=float32>, <tf.Tensor 'import/mul_9:0' shape=(?,) dtype=int32>]

[ I've tried this conversion using TF 1.11, 1.12, 1.13rc2 - all give the same results]

@LukeAI
Copy link
Author

LukeAI commented Feb 26, 2019

OK, I have resolved this by specifying: "["Placeholder:0", "concat_9:0", "mul_6:0"]" as the return_elements arg for utils.read_pb_return_tensors()
I guess that ["Placeholder:0", "concat_9:0", "mul_9:0"] was an older definition for the outputs here https://github.com/ardianumam/tensorflow-yolov3 which was used to generate your provided .pb and has now changed?

@ardianumam
Copy link
Owner

Hi,

Sorry for late response, was quite crowded recently. But glad that you already solve the issue. Yes, you might be right, those new tensor names may be already changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants