ImportError: No module named caffe.proto [How to Solve]

 

When training SSD model based on cafe with our own data, we need to convert the image data into LMDB format. The script file used is create provided in SSD source code_ Data.sh (specific location is in $Cafe)_ ROOT/data/VOC0712/create_ Take a copy of it and give it its own name, such as create_ scenetext_ Data. Sh, and then modify the path according to your actual situation

After modification, execute the command shcreate_ Data.sh, the following error may appear:

[lisiqi@l22-240-142 caffe]$ sh create_lmdbdata_scenetext.sh 
Traceback (most recent call last):
  File "/data/home/lisiqi/my_SSD/caffe/scripts/create_annoset.py", line 7, in <module> from caffe.proto import caffe_pb2 ImportError: No module named caffe.proto Traceback (most recent call last): File "/data/home/lisiqi/my_SSD/caffe/scripts/create_annoset.py", line 7, in <module> from caffe.proto import caffe_pb2 ImportError: No module named caffe.proto

Possible reason: in this case, the path of Python related content in cafe is not added to the compile path of Python

Solution:

Execute the order

export PYTHONPATH=$CAFFE_ROOT/python:$PYTHONPATH

Of which, $Cafe_ Root is the path to download SSD source code. For example, mine is/data/home/lisiqi/my_ SSD/caffe

Note: the above method is only one-time, run create again next time_ scenetext_ Data. Sh, you need to do the above operation

Similar Posts: