bostondiditeam / MV3D

Multi-View 3D Object Detection Network for Autonomous Driving
480 stars 181 forks source link

run train.py : At least two variables have the same name #35

Open BoomFan opened 6 years ago

BoomFan commented 6 years ago

Thanks for your work.

I managed to ./make.sh and then run data.py

When I try to run train.py file for KITTI dataset, errors like this shows up:

Use fusion-feature-2fc
Traceback (most recent call last):
  File "train.py", line 275, in <module>
    fast_test_mode=True if max_iter == 1 else False)
  File "/home/boom/MV3D/src/MV3D/src/mv3d.py", line 492, in __init__
    MV3D.__init__(self, top_shape, front_shape, rgb_shape, log_tag=log_tag)
  File "/home/boom/MV3D/src/MV3D/src/mv3d.py", line 156, in __init__
    checkpoint_dir=self.ckpt_dir)
  File "/home/boom/MV3D/src/MV3D/src/mv3d.py", line 86, in __init__
    self.saver=  tf.train.Saver(self.variables)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1338, in __init__
    self.build()
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1347, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1384, in _build
    build_save=build_save, build_restore=build_restore)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 813, in _build_internal
    saveables = self._ValidateAndSliceInputs(names_to_saveables)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 661, in _ValidateAndSliceInputs
    names_to_saveables = BaseSaverBuilder.OpListToDict(names_to_saveables)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 638, in OpListToDict
    name)
ValueError: At least two variables have the same name: MV3D/top_view_rpn/feature-extract-resnet/MV3D/top_view_rpn/feature-extract-resnet/batch_normalization_1/moving_mean/biased

Could anyone offer me a help, please? I'm using Tensorflow 1.8.0 by the way. Is it because of the new version of Tensorflow?

YizhouFan commented 5 years ago

Same problem here... Still working to solve it.

hz-fengpeng commented 5 years ago

Do you fix the problem, I meet the same problem. I find where is the problem. In the src/mv3d.py file, the Net.get_variables() function is wrong. def get_variables(self, scope_names): variables=[] for scope in scope_names: variables = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope=scope) assert len(variables) != 0 variables += variables return variables the right code is variable = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope=scope) assert len(variable) != 0 variables += variable pay attention to variables and variable!!!

DonghoonPark12 commented 5 years ago

@hz-fengpeng Thanks a lot!