Ask Your Question
0

ReadNetFromTensorflow - Unknown layer type problem

asked 2018-04-25 17:17:58 -0500

WWWW gravatar image

updated 2018-04-26 09:33:15 -0500

I have a problem...

I have generated model with this tutorial for my own classes: https://www.tensorflow.org/tutorials/...

By using:

ReadNetFromTensorflow("output_graph.pb");

I'm getting an error:

Unknown layer type Sub in op module_apply_default/hub_input/Sub

So I was trying to use freeze_graph.py

py C:\tensorflow-master\tensorflow\python\tools\freeze_graph.py --input_graph=output_graph.pb --input_checkpoint=C:/tmp/_retrain_checkpoint --output_graph=/tmp/frozen_graph.pb --output_node_names=softmax --input_binary=true

So error again:

Names_to_saveables must be a dict mapping string names to Tensors/Variables. Not a variable: Tensor("final_retrain_ops/biases/final_biases:0", shape=(6,), dtype=float32)

Then maybe optimize_for_inference.py Guess what...

Multiple error xD

WARNING:tensorflow:Didn't find expected Conv2D input to 'module_apply_default/MobilenetV2/expanded_conv_16/depthwise/BatchNorm/FusedBatchNorm'

Im trying to solve these problems from week. Can anyone help me with that?

Here is model files generated by retrain.py script which I cannot import to OpenCV: https://goo.gl/CPMPNY

These filse have been ganerated for flowers actually, not my own categories for now, becouse I haven't finished collectiong images, but it doesn't matter if its for cars or flowers, it still doesn't work with the same errors.

edit retag flag offensive close merge delete

Comments

1

@Swordancer, I'd be much more easier if you attached mentioned output_graph.pb.

dkurt gravatar imagedkurt ( 2018-04-26 01:00:22 -0500 )edit
1

@dkurt I've updated my post.

WWWW gravatar imageWWWW ( 2018-04-26 09:34:16 -0500 )edit

@dkurt Here I also have pbtxt filse so You can look inside: https://1drv.ms/u/s!ApQufeJ9WomUgrhpF...

WWWW gravatar imageWWWW ( 2018-04-29 12:09:07 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-04-30 11:44:42 -0500

WWWW gravatar image

updated 2018-04-30 11:46:17 -0500

It look like OpenCV do not fully support tensorflow models. I had to retrain model with: https://codelabs.developers.google.co...

Not with https://www.tensorflow.org/tutorials/... and tensorflow hub.

Then I had to use optimize_for_inference.py, and then tensorflow/tools/graph_transforms/transform_graph on Ubuntu, becouse compilation of this tool doesn't work on Windows.

bazel run //tensorflow/tools/graph_transforms:transform_graph -- --in_graph=opt_graph.pb --out_graph=final_graph.pb --inputs=input --outputs=final_result --transforms="remove_nodes(op=PlaceholderWithDefault) strip_unused_nodes(type=float, shape=\"1,299,299,3\") sort_by_execution_order"

Now it could be imported, but I have another problem: http://answers.opencv.org/question/19...

edit flag offensive delete link more

Comments

@WWWW, May I ask you to check a link? An archive has downloading troubles.

dkurt gravatar imagedkurt ( 2018-05-01 14:58:01 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-04-25 17:17:58 -0500

Seen: 721 times

Last updated: Apr 30 '18