TianzhongSong / PSMNet-TensorFlow

A TensorFlow port of Pyramid Stereo Matching Network (CVPR2018)
MIT License
10 stars 3 forks source link

KeyError: "The name 'is_training:0' refers to a Tensor which does not exist. The operation, 'is_training', does not exist in the graph." #1

Open LeXiaoCCNU opened 5 years ago

LeXiaoCCNU commented 5 years ago

When I run train.py, the following error appears. Do you know why?

PSMNet-TensorFlow$ python train.py 2018-12-05 20:53:51.903970: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2018-12-05 20:53:51.903998: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2018-12-05 20:53:51.904002: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2018-12-05 20:53:51.904006: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2018-12-05 20:53:51.904009: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX512F instructions, but these are available on your machine and could speed up CPU computations. 2018-12-05 20:53:51.904013: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. Traceback (most recent call last): File "train.py", line 51, in main() File "train.py", line 23, in main max_disp=maxdisp, lr=0.001, cnn_3d_type='resnet_3d') File "/home/le/LeXiao_Project/PSMNet-TensorFlow/models/model.py", line 19, in init self.build_model() File "/home/le/LeXiao_Project/PSMNet-TensorFlow/models/model.py", line 27, in build_model conv4_left = self.CNN(self.left) File "/home/le/LeXiao_Project/PSMNet-TensorFlow/models/model.py", line 72, in CNN bottom = conv_block(tf.layers.conv2d, bottom, 32, 3, strides=2, name='conv0_1', reuse=reuse, reg=self.reg) File "/home/le/LeXiao_Project/PSMNet-TensorFlow/models/model_utils.py", line 23, in conv_block training=tf.get_default_graph().get_tensor_by_name('is_training:0'), File "/home/le/anaconda2/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2880, in get_tensor_by_name return self.as_graph_element(name, allow_tensor=True, allow_operation=False) File "/home/le/anaconda2/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2708, in as_graph_element return self._as_graph_element_locked(obj, allow_tensor, allow_operation) File "/home/le/anaconda2/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2750, in _as_graph_element_locked "graph." % (repr(name), repr(op_name))) KeyError: "The name 'is_training:0' refers to a Tensor which does not exist. The operation, 'is_training', does not exist in the graph."

IrvingMeng commented 5 years ago

"is_training" is not a tensor in the graph. You need to add a tensor named "is_training" to the graph and initialize it when building the model. The value should be set to 1 for training and 0 for testing (used for batch normalization). The model built in the code differs from the original PSMNet. The cost volume layer and stacked hourglass layers are built in a different way.

TianzhongSong commented 5 years ago

@LeXiaoCCNU
Hi, I have fixed this bug.

LeXiaoCCNU commented 5 years ago

@TianzhongSong

Thank you very much! I can run train.py now. The cnn_3d_type is "resnet_3d". But when I run the predict.py after training, a picture which only has a red point is generated. Can you run predict.py successfully? Or, would it be convenient for you to send me your trained model? I can use it to check if there is something wrong with the model training. My email is lexiao@mails.ccnu.edu.cn.

yangchao-up commented 5 years ago

Could you please tell me how do you use the KITTI2015 dataset?I download the dataset but the training and testing file all have image_2 and image_3,they all have 400 pictures.What is the difference between them and how can i use them?If you look this,please tell me,my email is 335092644@qq.com.Thank you!