ValueError:两个形状中的维度 0 必须相等,但在使用 tensorflow 2.2

时间:2021-06-28 08:56:04

标签: python-3.x tensorflow

我尝试运行 PFE 模型。当我使用 tensorflow 2.1 和 tensorflow 1.x 运行 eval_lfw 时,它运行良好,但是当我尝试使用 tensorflow 2.2 和更高版本运行它时,出现此错误: ValueError:节点“gradients/UncertaintyModule/fc_log_sigma_sq/BatchNorm/cond/FusedBatchNorm_1_grad/FusedBatchNormGrad”的_output_shapes 属性与输出#3 的GraphDef 不一致:两个形状中的维度0 必须相等,但分别为0 和50。 ] 和 [512]。 It happens when the model is loading when it does saver = tf.compat.v1.train.import_meta_graph(meta_file, clear_devices=True, import_scope=scope) to import the meta file of my model

要重现错误:下载 https://drive.google.com/drive/folders/10RnChjxtSAUc1lv7jbm3xkkmhFYyZrHP?usp=sharing 并使用参数 --model_dir pretrained/PFE_sphere64_msarcface_am --dataset_path data/Dataset --protocol_path ./proto/pairs_dataset.txt

运行 eval_lfw

感谢您的帮助

回溯(最近一次调用最后一次): 文件“/home/jordan/Bureau/Probabilistic-Face-Embeddings_new/evaluation/eval_lfw.py”,第78行,在 主要(参数) 文件“/home/jordan/Bureau/Probabilistic-Face-Embeddings_new/evaluation/eval_lfw.py”,第51行,主 network.load_model(args.model_dir) 文件“/home/jordan/Bureau/Probabilistic-Face-Embeddings_new/network.py”,第 169 行,在 load_model 保护程序 = tf.compat.v1.train.import_meta_graph(meta_file, clear_devices=True, import_scope=scope) 文件“/home/jordan/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py”,第 1462 行,在 import_meta_graph **kwargs)[0] 文件“/home/jordan/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py”,第 1486 行,在 _import_meta_graph_with_return_elements **夸格)) 文件“/home/jordan/.local/lib/python3.6/site-packages/tensorflow/python/framework/meta_graph.py”,第 799 行,在 import_scoped_meta_graph_with_return_elements return_elements=return_elements) 文件“/home/jordan/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py”,第507行,在new_func 返回 func(*args, **kwargs) 文件“/home/jordan/.local/lib/python3.6/site-packages/tensorflow/python/framework/importer.py”,第405行,在import_graph_def producer_op_list=producer_op_list) 文件“/home/jordan/.local/lib/python3.6/site-packages/tensorflow/python/framework/importer.py”,第 501 行,在 _import_graph_def_internal 引发 ValueError(str(e)) ValueError:节点“gradients/UncertaintyModule/fc_log_sigma_sq/BatchNorm/cond/FusedBatchNorm_1_grad/FusedBatchNormGrad”的_output_shapes 属性与输出#3 的GraphDef 不一致:两个形状中的维度0 必须相等,但分别为0 和50。 ] 和 [512]。

0 个答案:

没有答案