Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kitti_multiloss.py generates ValueError: inputs must be a list of at least one Tensor with the same dtype and shape #31

Closed
wenouyang opened this issue Apr 2, 2017 · 6 comments

Comments

@wenouyang
Copy link

Hi Marvin,

I have gotten the the demo.py running successfully, and now I am trying to experimenting with train.py. However, I got the following error message

File "/home/ decoder/kitti_multiloss.py", line 86, in loss
name='reg_loss')
File "/devl /tensorflow/tf/lib/python3.4/site-packages/tensorflow/python/ops/math_ops.py", line 1827, in add_n
raise ValueError("inputs must be a list of at least one Tensor with the "
ValueError: inputs must be a list of at least one Tensor with the same dtype and shape

It is caused by reg_loss_col = tf.GraphKeys.REGULARIZATION_LOSSES weight_loss = tf.add_n(tf.get_collection(reg_loss_col),name='reg_loss') in kitti_multiloss.py Are there any ways to print out the information of tf.get_collection(reg_loss_col) to figure out why the error was generated.

@MarvinTeichmann
Copy link
Owner

Have you tried:
print( "Regression loss collection: {}".format(tf.get_collection(reg_loss_col))) or
logging.info( "Regression loss collection: {}".format(tf.get_collection(reg_loss_col)))

@wenouyang
Copy link
Author

wenouyang commented Apr 4, 2017

Hi Marvin,

Thanks for your reply. I am trying to print out the related information in kitti_multiloss.py, as follows.

    ```

reg_loss_col = tf.GraphKeys.REGULARIZATION_LOSSES
print('*'10)
print('loss type ',hypes['loss'])
print('type ', type(tf.get_collection(reg_loss_col)))
print( "Regression loss collection: {}".format(tf.get_collection(reg_loss_col)))
print('
'*10)




     



The output information is as follows


`************************************************************`
` loss type  xentropy`
 `type  <class 'list'>`
 Regression loss collection: []
 `************************************************************`

I am thinking that maybe I did not put data in the right location. I will give it a second try, and will let you know my observation. Thanks a lot.

wenouyang

@wenouyang
Copy link
Author

wenouyang commented Apr 5, 2017

Hi Marvin,

I checked the data set location and also exported $TV_DIR_DATA as suggested. It still has the same error.
The regression loss collection is printed out as

Regression loss collection: []

I went back to see the code logic again, and it seems to me that the problem happens at building_training_graph, which has not reached the step of requiring the training data. So my original guess that it might be related to training data should not be correct.

I am confused about what causes this error, thanks.

Traceback (most recent call last):
File "train.py", line 119, in
tf.app.run()
File "/devl/tensorflow/tf/lib/python3.4/site-packages/tensorflow/python/platform/app.py", line 43, in run
sys.exit(main(sys.argv[:1] + flags_passthrough))
File "train.py", line 117, in main
train.do_training(hypes)
File "/home/GPU-Study/keras/FCN/kittiseg/tensorvision/train.py", line 386, in do_training
tv_graph = core.build_training_graph(hypes, queue, modules)
File "/home/GPU-Study/keras/FCN/kittiseg/tensorvision/core.py", line 93, in build_training_graph
labels)
File "/home/GPU-Study/keras/FCN/kittiseg/hypes/../decoder/kitti_multiloss.py", line 94, in loss
weight_loss = tf.add_n(tf.get_collection(reg_loss_col))
File "/devl/tensorflow/tf/lib/python3.4/site-packages/tensorflow/python/ops/math_ops.py", line 1827, in add_n
raise ValueError("inputs must be a list of at least one Tensor with the "
ValueError: inputs must be a list of at least one Tensor with the same dtype and shape

@MarvinTeichmann
Copy link
Owner

Have you tried git submodule update and made sure, that all submodules are on the newest version? It seems to me, that no regression losses are added to the collection. This should happen in the following line.

@MarvinTeichmann
Copy link
Owner

My suggestion should fix this. So I will close this for now.

@ishay2b
Copy link

ishay2b commented Feb 2, 2018

While importing a new encoder into the project I encountered the same error.
Registering a batch norm to REGULARIZATION_LOSSES collection resolved my issue.

self.conv_1_batch_norm = slim.batch_norm(self.conv_1, scope='conv_1/batch_norm') tf.add_to_collection(tf.GraphKeys.REGULARIZATION_LOSSES, self.conv_1_batch_norm)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants