caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Invalid python code: len > 0

Open ijsmallman opened this issue 9 years ago • 5 comments

Issue summary

caffe/python/caffe/model_libs.py line 16: assert len > 0

Steps to reproduce

python examples/ssd/ssd_pascall.py
Traceback (most recent call last):
  File "examples/ssd/ssd_pascal.py", line 438, in <module>
    AddExtraLayers(net, use_batchnorm, lr_mult=lr_mult)
  File "examples/ssd/ssd_pascal.py", line 25, in AddExtraLayers
    lr_mult=lr_mult)
  File "/caffe/python/caffe/model_libs.py", line 93, in ConvBNLayer
    [kernel_h, kernel_w] = UnpackVariable(kernel_size, 2)
  File "/caffe/python/caffe/model_libs.py", line 16, in UnpackVariable
    assert len > 0
TypeError: unorderable types: builtin_function_or_method() > int()

Your system configuration

Operating system: Ubuntu 16.04 LTS Compiler: Not relevant CUDA version (if applicable): Not relevant CUDNN version (if applicable): Not relevant BLAS: Not relevant Python or MATLAB version (for pycaffe and matcaffe respectively): Python 3.5.2

ijsmallman avatar Oct 05 '17 13:10 ijsmallman

Hey,bro! I met the same problem,have you solve it?

FloraBF avatar Dec 13 '17 04:12 FloraBF

Just delete it or change len so that it checks the length of the relevant vector.

I had so many issues getting caffe to run with python 3 that I gave up in the end and just went with darknet/tensorflow.

ijsmallman avatar Dec 13 '17 07:12 ijsmallman

There are lots of issues that python 2 let slip through the net but python 3 wont. Good luck

ijsmallman avatar Dec 13 '17 08:12 ijsmallman

@ijsmallman thank you very much! I had delete len>0;but there is another problem TypeError: 0.0 has type <class 'float'>, but expected one of: (<class 'int'>,)

FloraBF avatar Dec 13 '17 11:12 FloraBF

I had exactly that problem. You can cast it to an int but then you will have problems later. Like I said, I gave up with Caffe, it is just a mess.

ijsmallman avatar Dec 13 '17 12:12 ijsmallman