2

When I run train, I get this error:

I0522 17:28:07.201007  2378 layer_factory.hpp:77] Creating layer binary_sim
*** Aborted at 1495441687 (unix time) try "date -d @1495441687" if you are using GNU date ***
PC: @     0x7fde777fb873 std::_Hashtable<>::clear()
*** SIGSEGV (@0x9) received by PID 2378 (TID 0x7fe2afacd740) from PID 9; stack trace: ***
    @     0x7fe2accc44b0 (unknown)
    @     0x7fde777fb873 std::_Hashtable<>::clear()
    @     0x7fde777ed346 google::protobuf::DescriptorPool::FindFileByName()
    @     0x7fde777cbac8 google::protobuf::python::cdescriptor_pool::AddSerializedFile()
    @     0x7fe2ad32d7d0 PyEval_EvalFrameEx
    @     0x7fe2ad45601c PyEval_EvalCodeEx
    @     0x7fe2ad3ac3dd (unknown)
    @     0x7fe2ad37f1e3 PyObject_Call
    @     0x7fe2ad39fae5 (unknown)
    @     0x7fe2ad336123 (unknown)
    @     0x7fe2ad37f1e3 PyObject_Call
    @     0x7fe2ad32a13c PyEval_EvalFrameEx
    @     0x7fe2ad45601c PyEval_EvalCodeEx
    @     0x7fe2ad324b89 PyEval_EvalCode
    @     0x7fe2ad3b91b4 PyImport_ExecCodeModuleEx
    @     0x7fe2ad3b9b8f (unknown)
    @     0x7fe2ad3bb300 (unknown)
    @     0x7fe2ad3bb5c8 (unknown)
    @     0x7fe2ad3bc6db PyImport_ImportModuleLevel
    @     0x7fe2ad333698 (unknown)
    @     0x7fe2ad37f1e3 PyObject_Call
    @     0x7fe2ad455447 PyEval_CallObjectWithKeywords
    @     0x7fe2ad3285c6 PyEval_EvalFrameEx
    @     0x7fe2ad45601c PyEval_EvalCodeEx
    @     0x7fe2ad324b89 PyEval_EvalCode
    @     0x7fe2ad3b91b4 PyImport_ExecCodeModuleEx
    @     0x7fe2ad3b9b8f (unknown)
    @     0x7fe2ad3bb300 (unknown)
    @     0x7fe2ad3bb5c8 (unknown)
    @     0x7fe2ad3bc6db PyImport_ImportModuleLevel
    @     0x7fe2ad333698 (unknown)
    @     0x7fe2ad37f1e3 PyObject_Call

This is the python layer I have:

 import sys, os
 sys.path.insert(0,os.environ['CAFFE_ROOT'] + '/python')
 import caffe
 class BinarySimilarity(caffe.Layer):
   def setup(self, bottom, top):
     if(len(bottom) != 2):
        raise Exception('must have exactly two inputs')
     if(len(top) != 1):
        raise Exception('must have exactly one output')
   def reshape(self,bottom,top):
     top[0].reshape( *bottom[0].shape )
   def forward(self,bottom,top):
     top[0].data[...] = (bottom[0].data == bottom[1].data).astype('f4')
   def backward(self,top,propagate_down,bottom):
       # no back prop
       pass

This is the python layer in prototxt:

 layer {
   name: "binary_sim"
   type: "Python"
   bottom: "label"
   bottom: "label_pair"
   top: "sim"
   python_param {
     # the module name -- usually the filename -- that needs to be in $PYTHONPATH
     module: "binary_similarity"
     # the layer name -- the class name in the module
     layer: "BinarySimilarity"
   }
   propagate_down: false
   propagate_down: false
 }

Both python layer and the code is from Shai's post here. I am not sure why this error is happening. Any advice would be appreciated.

EDIT: I found a solution here but it didn't work for me. I am using protoc version 3.3. I tried every version of protoc for python but did nothing.

EDIT2: I downgraded protoc to 3.2 to follow this solution but I still get the error.

EDIT3: output when i run

$python -v -m ~/caffe/python/binary_similarity.py
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/lib/python2.7/site.pyc matches /usr/lib/python2.7/site.py
import site # precompiled from /usr/lib/python2.7/site.pyc
# /usr/lib/python2.7/os.pyc matches /usr/lib/python2.7/os.py
import os # precompiled from /usr/lib/python2.7/os.pyc
import errno # builtin
import posix # builtin
# /usr/lib/python2.7/posixpath.pyc matches /usr/lib/python2.7/posixpath.py
import posixpath # precompiled from /usr/lib/python2.7/posixpath.pyc
# /usr/lib/python2.7/stat.pyc matches /usr/lib/python2.7/stat.py
import stat # precompiled from /usr/lib/python2.7/stat.pyc
# /usr/lib/python2.7/genericpath.pyc matches /usr/lib/python2.7/genericpath.py
import genericpath # precompiled from /usr/lib/python2.7/genericpath.pyc
# /usr/lib/python2.7/warnings.pyc matches /usr/lib/python2.7/warnings.py
import warnings # precompiled from /usr/lib/python2.7/warnings.pyc
# /usr/lib/python2.7/linecache.pyc matches /usr/lib/python2.7/linecache.py
import linecache # precompiled from /usr/lib/python2.7/linecache.pyc
# /usr/lib/python2.7/types.pyc matches /usr/lib/python2.7/types.py
import types # precompiled from /usr/lib/python2.7/types.pyc
# /usr/lib/python2.7/UserDict.pyc matches /usr/lib/python2.7/UserDict.py
import UserDict # precompiled from /usr/lib/python2.7/UserDict.pyc
# /usr/lib/python2.7/_abcoll.pyc matches /usr/lib/python2.7/_abcoll.py
import _abcoll # precompiled from /usr/lib/python2.7/_abcoll.pyc
# /usr/lib/python2.7/abc.pyc matches /usr/lib/python2.7/abc.py
import abc # precompiled from /usr/lib/python2.7/abc.pyc
# /usr/lib/python2.7/_weakrefset.pyc matches /usr/lib/python2.7/_weakrefset.py
import _weakrefset # precompiled from /usr/lib/python2.7/_weakrefset.pyc
import _weakref # builtin
# /usr/lib/python2.7/copy_reg.pyc matches /usr/lib/python2.7/copy_reg.py
import copy_reg # precompiled from /usr/lib/python2.7/copy_reg.pyc
# /usr/lib/python2.7/traceback.pyc matches /usr/lib/python2.7/traceback.py
import traceback # precompiled from /usr/lib/python2.7/traceback.pyc
# /usr/lib/python2.7/sysconfig.pyc matches /usr/lib/python2.7/sysconfig.py
import sysconfig # precompiled from /usr/lib/python2.7/sysconfig.pyc
# /usr/lib/python2.7/re.pyc matches /usr/lib/python2.7/re.py
import re # precompiled from /usr/lib/python2.7/re.pyc
# /usr/lib/python2.7/sre_compile.pyc matches /usr/lib/python2.7/sre_compile.py
import sre_compile # precompiled from /usr/lib/python2.7/sre_compile.pyc
import _sre # builtin
# /usr/lib/python2.7/sre_parse.pyc matches /usr/lib/python2.7/sre_parse.py
import sre_parse # precompiled from /usr/lib/python2.7/sre_parse.pyc
# /usr/lib/python2.7/sre_constants.pyc matches /usr/lib/python2.7/sre_constants.py
import sre_constants # precompiled from /usr/lib/python2.7/sre_constants.pyc
import _locale # builtin
# /usr/lib/python2.7/_sysconfigdata.pyc matches /usr/lib/python2.7/_sysconfigdata.py
import _sysconfigdata # precompiled from /usr/lib/python2.7/_sysconfigdata.pyc
# /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.pyc matches /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.py
import _sysconfigdata_nd # precompiled from /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.pyc
# /usr/lib/python2.7/sitecustomize.pyc matches /usr/lib/python2.7/sitecustomize.py
import sitecustomize # precompiled from /usr/lib/python2.7/sitecustomize.pyc
import encodings # directory /usr/lib/python2.7/encodings
# /usr/lib/python2.7/encodings/__init__.pyc matches /usr/lib/python2.7/encodings/__init__.py
import encodings # precompiled from /usr/lib/python2.7/encodings/__init__.pyc
# /usr/lib/python2.7/codecs.pyc matches /usr/lib/python2.7/codecs.py
import codecs # precompiled from /usr/lib/python2.7/codecs.pyc
import _codecs # builtin
# /usr/lib/python2.7/encodings/aliases.pyc matches /usr/lib/python2.7/encodings/aliases.py
import encodings.aliases # precompiled from /usr/lib/python2.7/encodings/aliases.pyc
# /usr/lib/python2.7/encodings/utf_8.pyc matches /usr/lib/python2.7/encodings/utf_8.py
import encodings.utf_8 # precompiled from /usr/lib/python2.7/encodings/utf_8.pyc
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
# /usr/lib/python2.7/runpy.pyc matches /usr/lib/python2.7/runpy.py
import runpy # precompiled from /usr/lib/python2.7/runpy.pyc
import imp # builtin
# /usr/lib/python2.7/pkgutil.pyc matches /usr/lib/python2.7/pkgutil.py
import pkgutil # precompiled from /usr/lib/python2.7/pkgutil.pyc
/usr/bin/python: Import by filename is not supported.
Community
  • 1
  • 1
MoneyBall
  • 2,343
  • 5
  • 26
  • 59
  • are you sure binary_similarity.py is in your PYTHONPATH? – Shai May 22 '17 at 10:02
  • @Shai Yes. I can tell by binary_similarity.pyc it generated. I've been stuck on this for days. It would be great if you can provide any advice... so i'd know where to start debugging... – MoneyBall May 22 '17 at 10:03
  • try adding log prints in the Python file. it seems like some of the sub modules you are trying to.import is upsetting the protobuf.... – Shai May 22 '17 at 11:26
  • have you looked at http://stackoverflow.com/q/7332299/1714410? – Shai May 22 '17 at 11:50
  • @Shai ah okay. I'll take a look at those. But the only python file I have is the one that I posted. I'm not sure how import can be a problem. – MoneyBall May 22 '17 at 12:19
  • you'll be amazed... there are three imports in your file. each of which also.imports.... – Shai May 22 '17 at 12:20
  • @Shai it seems like pkgutil issue. Plus if i'm remembering it correctly, i seem to remember sth about gcc 5.4 not being compatible and had to downgrade it to gcc 4.x. Is this the problem? – MoneyBall May 23 '17 at 03:35
  • I have no idea. – Shai May 23 '17 at 03:43

0 Answers0