问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
在facenet的这一句报错了
saver = tf.train.import_meta_graph(os.path.join(model_exp, meta_file), input_map=input_map)
运行结果及报错内容
Traceback (most recent call last):
File "C:\Users\28783\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\framework\importer.py", line 500, in _import_graph_def_internal
graph._c_graph, serialized, options) # pylint: disable=protected-access
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 128. Shapes are [0] and [128].
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/28783/Desktop/mask/detect-and-recognize-mask-face-master/real_time.py", line 81, in <module>
main()
File "C:/Users/28783/Desktop/mask/detect-and-recognize-mask-face-master/real_time.py", line 39, in main
face_recognition = face2.Recognition()
File "C:\Users\28783\Desktop\mask\detect-and-recognize-mask-face-master\face2.py", line 42, in __init__
self.encoder = Encoder()
File "C:\Users\28783\Desktop\mask\detect-and-recognize-mask-face-master\face2.py", line 100, in __init__
facenet.load_model(facenet_model_checkpoint)
File "C:\Users\28783\Desktop\mask\detect-and-recognize-mask-face-master\facenet_src\facenet.py", line 363, in load_model
saver = tf.train.import_meta_graph(os.path.join(model_exp, meta_file), input_map=input_map)
File "C:\Users\28783\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\training\saver.py", line 1584, in import_meta_graph
**kwargs)[0]
File "C:\Users\28783\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\training\saver.py", line 1608, in _import_meta_graph_with_return_elements
**kwargs))
File "C:\Users\28783\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\framework\meta_graph.py", line 809, in import_scoped_meta_graph_with_return_elements
return_elements=return_elements)
File "C:\Users\28783\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\util\deprecation.py", line 561, in new_func
return func(*args, **kwargs)
File "C:\Users\28783\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\framework\importer.py", line 408, in import_graph_def
producer_op_list=producer_op_list)
File "C:\Users\28783\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\framework\importer.py", line 504, in _import_graph_def_internal
raise ValueError(str(e))
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 128. Shapes are [0] and [128].
[ WARN:0@9.709] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (539) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback