weiliu89 / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
4.77k stars 1.68k forks source link

Invalid python code: len > 0 #754

Open ijsmallman opened 7 years ago

ijsmallman commented 7 years ago

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

FloraBF commented 6 years ago

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

ijsmallman commented 6 years ago

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 commented 6 years ago

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

FloraBF commented 6 years ago

@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'>,)

ijsmallman commented 6 years ago

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.