zhanght021 / RPT

RPT: Learning Point Set Representation for Siamese Visual Tracking
MIT License
86 stars 16 forks source link

ImportError: cannot import name '_C' #4

Open songh11 opened 3 years ago

songh11 commented 3 years ago

作者你好,当我运行 cd siamreppoints/tools python test.py \ --snapshot ./snapshot/siamreppoints.model \ #model path --dataset VOT2018 \ #dataset name --config ./experiments/siamreppoints/config_vot2018_offline.yaml #config file 这里时,一直会报这个错,请问这个是哪里没有配置好吗还是其他原因,谢谢

zhanght021 commented 3 years ago

因为我们用到了可变形卷积,我感觉你是没有编译那一部分,编译之后会在models文件下下面生成一个类似 _C.cpython-37m-x86_64-linux-gnu.so的文件 你需要进入siamreppoints编译一下 @songh11

zhanght021 commented 3 years ago

python setup.py build_ext --inplace

python ./siamreppoints/setup.py build_ext --inplace

songh11 commented 3 years ago

执行python ./siamreppoints/setup.py build_ext --inplace时会报错

assert len(sources) > 0

AssertionError

感谢作者热心答复,我再看看是哪里错了

zhanght021 commented 3 years ago

可以尝试一下先进入siamreppoints文件夹,然后编译,感觉是源文件没找到 cd siamreppoints python setup.py build_ext --inplace

要是还不行,明天我会公司看看 @songh11

songh11 commented 3 years ago

谢谢作者,我从头再配置一下,看看还会不会报错

laisimiao commented 3 years ago

执行python ./siamreppoints/setup.py build_ext --inplace时会报错

assert len(sources) > 0

AssertionError

感谢作者热心答复,我再看看是哪里错了

好像pytorch版本过高就会出现这个错误吧?

shlsp commented 3 years ago

遇到同样问题,运行python ./siamreppoints/setup.py build_ext --inplace报错如下: error: could not create 'models/_C.cpython-37m-x86_64-linux-gnu.so': No such file or directory

zhanght021 commented 3 years ago

@ping-shu
cd siamreppoints python setup.py build_ext --inplace

shlsp commented 3 years ago

又报错了,报错如下: cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from models/csrc/nms.h:3:0, from models/csrc/vision.cpp:2: models/csrc/cpu/vision.h:3:10: fatal error: torch/extension.h: 没有那个文件或目录

include <torch/extension.h>

      ^~~~~~~~~~~~~~~~~~~

compilation terminated. error: command 'gcc' failed with exit status 1

shlsp commented 3 years ago

@ping-shu cd siamreppoints python setup.py build_ext --inplace

我用的是pytorch0.4.1

zhanght021 commented 3 years ago

可能也有问题吧,我自己这里测试了一下,这样子是没有问题的,pytorch1.0-pytorch1.3都是能够成功的,再高的版本可能出问题,可能低的版本也是会出问题的,还有就是gcc是需要5.0以上的 ,别的应该没啥问题@ping-shu

shlsp commented 3 years ago

可能也有问题吧,我自己这里测试了一下,这样子是没有问题的,pytorch1.0-pytorch1.3都是能够成功的,再高的版本可能出问题,可能低的版本也是会出问题的,还有就是gcc是需要5.0以上的 ,别的应该没啥问题@ping-shu

好的,我再试试,非常感谢。

shlsp commented 3 years ago

可能也有问题吧,我自己这里测试了一下,这样子是没有问题的,pytorch1.0-pytorch1.3都是能够成功的,再高的版本可能出问题,可能低的版本也是会出问题的,还有就是gcc是需要5.0以上的 ,别的应该没啥问题@ping-shu 好了,使用torch1.1没问题。