caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Python3 examples/ssd/ssd_pascal.py

Open zmnh2003 opened this issue 5 years ago • 6 comments

Issue summary

I made all systems work. Import caffe is working now. But when i execute ssd_pascal.py it makes error about xrange. I think it occurs because code is made with PYTHON2. i fixed it to 'range' function but now from model_libs.py file makes errors. Are there any python3 example?

Your system configuration

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

zmnh2003 avatar May 23 '19 16:05 zmnh2003

Do you fix the problem now? I have the same question as you.

gjogjreiogjwer avatar Dec 25 '19 22:12 gjogjreiogjwer

Do you fix the problem now? I have the same question as you.

Because it has been long age, I don't remember exactly. But I suppose I changed every Python2 syntax (ex. xrange, xlist) to Python3 syntax. Or you can use Python2 with future module

Lee-daeho avatar Jan 06 '20 07:01 Lee-daeho

I have the same problem with this files wrritten in python2: ssd_pascal.py model_libs.py net_spec.py

and if i use python2 the command make pycaffe doesnt work, i'm trying to change the py script to python3.

robotgruntxd avatar Jan 08 '20 21:01 robotgruntxd

Did someone succeed in changing the scripts to python3? I really need it and will start to try now.

Rjlmota avatar Mar 03 '20 15:03 Rjlmota

Did someone succeed in changing the scripts to python3? I really need it and will start to try now.

There is a module that named as 2to3. It makes python2 file into python3 file. Let me know if it works.

Lee-daeho avatar Mar 04 '20 02:03 Lee-daeho

Hello @Lee-daeho I converted ssd_pascal.py and model_libs.py scripts to python3 language.. but still when I run ssd_pascal.py command I get this error: Traceback (most recent call last): File "examples/ssd/ssd_pascal_p3.py", line 438, in AddExtraLayers(net, use_batchnorm, lr_mult=lr_mult) File "examples/ssd/ssd_pascal_p3.py", line 25, in AddExtraLayers lr_mult=lr_mult) File "/home/emilion/Desktop/TL-SSD/caffe/python/caffe/model_libs_py3.py", line 93, in ConvBNLayer [kernel_h, kernel_w] = UnpackVariable(kernel_size, 2) File "/home/emilion/Desktop/TL-SSD/caffe/python/caffe/model_libs_py3.py", line 16, in UnpackVariable assert len > 0 TypeError: '>' not supported between instances of 'builtin_function_or_method' and 'int'

Can someone manage to give me some help?

EmilCreatePro avatar Apr 26 '20 11:04 EmilCreatePro