Ask Your Question

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:

By using:


I'm getting an error:

Unknown layer type Sub in op module_apply_default/hub_input/Sub

So I was trying to use

py C:\tensorflow-master\tensorflow\python\tools\ --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 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 script which I cannot import to OpenCV:

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



@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

@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:!ApQufeJ9WomUgrhpF...

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

1 answer

Sort by ยป oldest newest most voted

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:

Not with and tensorflow hub.

Then I had to use, 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:

edit flag offensive delete link more


@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

Question Tools

1 follower


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

Seen: 969 times

Last updated: Apr 30 '18