'Net' object has no attribute '_blob_names_index'
vex1286 opened this issue · 15 comments
Hello,
I have one problem when running your code in train.py, line 60.
discr_loss_weight = discriminator.net._blob_loss_weights[discriminator.net._blob_names_index['discr_loss']]
I got AttributeError, 'Net' object has no attribute '_blob_names_index'
How can I run this code correctly?
@vex1286
You should use the https://github.com/dosovits/caffe-fr-chairs/tree/deepsim branch of caffe.
Just checkout the deepsim branch of caffe, and compile it. Then export PYTHONPATH=/path/to/deepsim/caffe/python:$PYTHONPATH
. The train.py should be running correctly then.
You'd better read the Dependency
section of the readme again.
@samson-wang
Thank you for your reply, I will use this branch and try again.
@vex1286
Have you got the train running?
@samson-wang
Yep. It works well now. Thank you very much.
Hi,
I tried to merge Dosovitskiy's code with Caffe on Windows and got this error when I tried to do training.
Has this merge been done before? I thought there aren't too much work. But obviously, I have missed a chunk of it. I could not find where "_blob_names_index" is defined. Can someone give me a pointer?
@pauldelmusica It's in python/caffe/_caffe.cpp
Thanks! It is training now.
Hi,
I still have problem while training.
My environment is Ubuntu 16, Cuda 8.0 , cudnn 5.1
I clone caffe from deepsim and switch to the branch.
To compile deepsim I disable cudnn and compiled well.
But the problem still occured.
Could you help me solve the problem?
@ming1144 Could you post your error message?
You'd better print your caffe.__file__
. And make sure you are using the right caffe lib.
python train.py error msg:
Traceback (most recent call last):
File "train.py", line 60, in
discr_loss_weight = discriminator.net._blob_loss_weights[discriminator.net._blob_names_index['discr_loss']]
AttributeError: 'Net' object has no attribute '_blob_names_index'
deepsim error msg:
print caffe.file
/home/mmplab/git/caffe-dcgan/python/caffe/init.pyc
I've replaced deepsim name as caffe-dcgan
@ming1144 It's weird.
caffe.file
is an invalid attribute.
It should be print caffe.__file__
and output should be /home/core/deploy/caffe/python/caffe/__init__.py
You can search in /home/mmplab/git/caffe-dcgan/python/caffe/_caffe.cpp
to make sure that _blob_names_index
exists.
@samson-wang
You are right.
_blob_names_index didn't show in _caffe.cpp
And the reason it didn't exist is that I clone the master branch of deepsim
_blob_names_index only appear in deepsim branch
This problem has been done.
Thanks to your supply.
i try to solve this in windows but the same problem it show
discr_loss_weight = discriminator.net._blob_loss_weights[discriminator.net._blob_names_index['discr_loss']]
AttributeError: 'Net' object has no attribute '_blob_names_index'
@2017develper Please refer to ming1144
's comments