When I perform command ./data/VOC0712/create_data.sh, it report
Traceback (most recent call last):
File "/root/lishengxi/caffe/data/VOC0712/../../scripts/create_annoset.py", line 103, in
label_map = caffe_pb2.LabelMap()
AttributeError: 'module' object has no attribute 'LabelMap' error
I am guessing you didn't setup the PYTHONPATH environment variable correctly.
You can either try:
export PYTHONPATH=$CAFFE_ROOT/python:$PYTHONPATH
where CAFFE_ROOT is the directory you have the code
or put it in your ~/.bashrc and run:
source ~/.bashrc
Wei, thanks a lot.
I solve the problem according to your solution.
Hi, I'm still getting this error though I've already added $CAFFE_ROOT/python to my PYTHONPATH.
But I've built caffe from a master tree rather than from ssd tree. Might it be the case why I'm getting AttributeError: 'module' object has no attribute 'LabelMap' error, in other words, does master's and ssd's caffe installations differ?
You have to build the ssd branch.
Hi, I still get this problem though I have already added $CAFFE_ROOT/python to my PYTHONPATH and updated the ssd branch then rebuilt it just a few days ago. I named the ssd branch 'caffe-ssd' .
lab@lab:~/caffe-ssd$ echo $PYTHONPATH
:/home/lab/py-faster-rcnn/lib:/home/lab/py-faster-rcnn/caffe-fast-rcnn/python:/home/lab/caffe-ssd/python
I did:
make py
make test -j8
make runtest -j8
and my ~/.bashrc:
export PATH=$PATH:/usr/local/cuda-8.0/bin
export LD_LIBRARY_PATH=:/usr/local/cuda-8.0/lib64
export PYTHONPATH=/home/fuming/caffe/python:$PYTHONPATH
still got
'module' object has no attribute 'LabelMap'
@FumingX you solved this?
i got this problem now,can you give me some advice?
@wishinger-li I just restarted the computer after installation, and it worked.
@FumingX I have solved this problem following these steps:
1, open this file, ~/caffe-ssd/scripts/create_annoset.py
2,edit the file in path between [import sys] and [from caffe.proto import caffe_pb2].add this
sys.path.insert(0,'/home/xxx/caffe_ssd/python’)
beside add the /caffe-ssd/python to the bashrc way,this way work for me, hope it can help others.
sys.path.insert(0,'/home/xxx/caffe_ssd/python’) . This works for me while "adding to .bashrc" not.
Most helpful comment
I am guessing you didn't setup the PYTHONPATH environment variable correctly.
You can either try:
export PYTHONPATH=$CAFFE_ROOT/python:$PYTHONPATHwhere
CAFFE_ROOTis the directory you have the codeor put it in your
~/.bashrcand run:source ~/.bashrc