question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

kitti_train.py cannot initialize weights from downloaded data

See original GitHub issue

Hi, I am currently trying to run your model using Python 2.7 and Theano==0.9.0 (using a GPU with pygpu==0.6.2). I am skipping the first step (by executing download_data.sh) and going straight to training (python kitti_train.py).

I initially tried using keras==2.0.2, but saw this error:

Traceback (most recent call last):
  File "kitti_train.py", line 59, in <module>
    errors = prednet(inputs)  # errors will be (batch_size, nt, nb_layers)
  File "/home/arvoelke/.virtualenvs/CTN/local/lib/python2.7/site-packages/keras/layers/recurrent.py", line 252, in __call__
    return super(Recurrent, self).__call__(inputs, **kwargs)
  File "/home/arvoelke/.virtualenvs/CTN/local/lib/python2.7/site-packages/keras/engine/topology.py", line 528, in __call__
    self.build(input_shapes[0])
  File "/home/arvoelke/prednet/prednet.py", line 216, in build
    if self.initial_weights is not None:
AttributeError: 'PredNet' object has no attribute 'initial_weights'

Then I noticed you suggest keras==1.2.0, so I downgraded, and retried, but saw a different error:

python kitti_train.py
Using Theano backend.
Can not use cuDNN on context None: Device not supported
Mapped name None to device cuda: Tesla C2075 (0000:02:00.0)
Traceback (most recent call last):
  File "kitti_train.py", line 60, in <module>
    errors_by_time = TimeDistributed(Dense(1, weights=[layer_loss_weights, np.zeros(1)], trainable=False), trainable=False)(errors)  # calculate weighted error by layer
  File "/home/arvoelke/.virtualenvs/CTN/local/lib/python2.7/site-packages/keras/engine/topology.py", line 543, in __call__
    self.build(input_shapes[0])
  File "/home/arvoelke/.virtualenvs/CTN/local/lib/python2.7/site-packages/keras/layers/wrappers.py", line 98, in build
    self.layer.build(child_input_shape)
  File "/home/arvoelke/.virtualenvs/CTN/local/lib/python2.7/site-packages/keras/layers/core.py", line 763, in build
    self.set_weights(self.initial_weights)
  File "/home/arvoelke/.virtualenvs/CTN/local/lib/python2.7/site-packages/keras/engine/topology.py", line 966, in set_weights
    str(weights)[:50] + '...')
ValueError: You called `set_weights(weights)` on layer "dense_1" with a  weight list of length 2, but the layer was expecting 0 weights. Provided weights: [array([[ 1.],
       [ 0.],
       [ 0.],
       ...

Any tips for things I could try? Thanks, Aaron

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
bill-lottercommented, Apr 11, 2017

Hi, sorry about the versioning trouble. I’m going to try to make it compatible with Keras 2.0 now, so all of this might be moot point, but it looks like I was using Keras 1.2.0 a few commits ahead of the official 1.2.0 release (specifically I was on 3a7cd05b488e327c1adccaaff10c78390d53b5a8) and it worked on that commit and 1.0.8 but not on the official 1.2.0 commit in-between. Sorry about that! Keras 2.0 is supposed to be stable release, so hopefully there won’t be these issues in the future once I finish the upgrade.

0reactions
bill-lottercommented, Aug 15, 2017

See cc76248 for downloading weights that are compatible with Keras 2.0. You can also convert old PredNet weights for Keras 2.0 by using convert_model_to_keras2 in keras_utils.py.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NVlabs/neuralrgbd: Neural RGB→D Sensing: Per-pixel depth ...
download weights cd saved_models && sh download_weights.sh && cd . ... For training and evaluation, we use the raw data from the KITTI...
Read more >
Preparing State-of-the-Art Models for Classification and Object ...
After you have the ImageNet-based classification model, you then use the pretrained weights from the ImageNet-trained models to train Faster R- ...
Read more >
PyTorch Lightning - Lightning Flash
Init your task with pretrained weights using a checkpoint (a checkpoint is ... Download and organize the data ... First, download and unzip...
Read more >
exploration of deep learning applications on an
Weights are adjusted according to labels of data to learn and approximate the inference. y = f(P[xi × wi] + b). (2.3). Fig....
Read more >
Beginner's guide to Photoshop's Lasso Tool - Morioh
A lightwieght image inpainting tool written in python. Simple and effective tool to remove scratches, bruises and small holes in images. Could be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found