facenet
facenet copied to clipboard
Workaround for tensorflow 2.0
Is there any workaround for tensorflow 2.0?
+1
+1
I found the problem to be with loading the facenet model, did you find a workaround?
error message
ValueError: Node 'gradients/InceptionResnetV1/Bottleneck/BatchNorm/cond/FusedBatchNorm_1_grad/FusedBatchNormGrad' has an _output_shapes attribute inconsistent with the GraphDef for output #3: Dimension 0 in both shapes must be equal, but are 0 and 512. Shapes are [0] and [512].
update: you can simply run the code for inference on tf2 using
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
and the frozen model provided.
@Alloooshe Hi, could you share your solution with more details?same issue with you.
@github2016-yuan just use the frozen model pb, if you don't have it then I didn't find a work around
I solved it by using the pb files instead of ckpt file in tf2.x (I am using tf2.2.0) Here is my code and hope it helps someone who has the same issue.
with tf.gfile.FastGFile("20180402-114759.pb", 'rb') as f: graph_def = tf.GraphDef() graph_def.ParseFromString(f.read()) _ = tf.import_graph_def(graph_def, name='')
images_placeholder = tf.get_default_graph().get_tensor_by_name("input:0") embeddings = tf.get_default_graph().get_tensor_by_name("embeddings:0") phase_train_placeholder = tf.get_default_graph().get_tensor_by_name("phase_train:0")
Still facing the same issue got error like below
results = c_api.TF_GraphImportGraphDefWithResults( tensorflow.python.framework.errors_impl.InvalidArgumentError: Node 'gradients/InceptionResnetV1/Bottleneck/BatchNorm/cond/FusedBatchNorm_1_grad/FusedBatchNormGrad' has an _output_shapes attribute inconsistent with the GraphDef for output #3: Dimension 0 in both shapes must be equal, but are 0 and 512. Shapes are [0] and [512].
@github2016-yuan Which Python file should be modified with the code you told us?
Hi, which python file and on wich location should we update?
im having a similar problem to @rohitdoddapani, trying to load in my .meta file and I get error
ValueError: Node 'gradients/UNet/conv0_up/batch_normalization_3/FusedBatchNorm_grad/FusedBatchNormGrad' has an _output_shapes attribute inconsistent with the GraphDef for output # 3: Dimension 0 in both shapes must be equal, but are 0 and 16. Shapes are [0] and [16].