代码报错整理

OpenCV(4.1.0) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function ‘cvtColor’

读取图片的路径不对,更改路径后便正确
我的是在votdataset.py中读取图片中出错,数据集是图片直接在序列文件夹中,然而代码中是图片在序列文件夹/color/下,因此对照自己的数据集进行更正即可
frames = [’{base_path}/{sequence_path}/color/{frame:0{nz}}.{ext}’.format(base_path=self.base_path,
sequence_path=sequence_path, frame=frame_num, nz=nz, ext=ext)
for frame_num in range(start_frame, end_frame+1)]
我直接把color去掉就对了。

ModuleNotFoundError: No module named ‘modules’

File “run_tracker.py”, line 17, in
from modules.model import MDNet, BCELoss, set_optimizer
ModuleNotFoundError: No module named ‘modules’
第二次遇到这个问题,我真是猪脑子,以为是我配置的环境的问题,各种install,最后import的时候都有呀,,,其实不是,在run_tracker.py代码中调用了modules文件中的代码,可是我进入了tracking目录,肯定找不到modules, 所以要到和modules同一个目录下,这样运行就对了

Strat Failed:Failed to initialize graphics environment

这是我第n次启动pycharm遇到的问题,第一次我用的是./pycharm.sh命令,然后闪了一下没有进去,师兄让我换sh pycharm.sh命令,奇迹般的进去了;第二次又进不去了,报错如下,师兄说试试bash pycharm.sh命令,真的就可以了;第三次又遇到和第二次的错误,这下命令都试完了,怎么办呢?我跳出了tmux返回到原来的shell环境,就可以了。我不知道问什么,百度了也无果,如果哪位小伙伴知道了,欢迎留言。
在这里插入图片描述

pycharm already running

查看运行pycharm的进程
ps u # ps命令用于显示当前进程 (process) 的状态,这里可以看到对应命令中的PID
杀死进程
kill -9 PID

OMP: Error #13: Assertion failure at z_Linux_util.cpp(2361).

OMP: Hint Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see http://www.intel.com/software/products/support/.
谷歌一下,得到multi-gpu training problem,但是我用的是多线程呢,有点没懂,给出的解决方案为:
So the suggested solution would be downgrading the intel-openmp version by
conda install -y intel-openmp-2019.4
我没有试,直接注释了,下次再看

DeprecationWarning:‘imsave’ is deprecated! ‘imsave’ is deprecated in SciPy 1.0.0 ,and will be removed in 1.2.0

在这里插入图片描述
use ‘imageio.imwrite’ instead 所以直接安装imageio 然后导入即可
在这里插入图片描述

ValueError: Wrong number of columns at line 496

这里不得不说计算机的严谨,真的是超赞,少一个逗号都会报错
报错的代码为:

ground_truth_rect=np.loadtxt(str(anno_path),delimiter=',',dtype=np.float64)

原因是第496行和其他的不一样,一去看数据集的真值文件.txt,确实,是按空格隔开的并不是逗号。

SyntaxError:invalid syntax

在这里插入图片描述
python3.7已经移除了async关键字,去掉async就可以解决
参考博客

OMP: Error #13: Assertion failure at z_Linux_util.cpp(2361). OMP: …

在这里插入图片描述
使用 conda install -y intel-openmp=2019.4 此命令降低版本,详细参考,我随后再研究

RuntimeError: The size of tensor a (64) must match the size of tensor b (288) at non-singleton dimension 3

维度不匹配,*操作,解决办法粗暴简单,直接把两个维度扩展为一样的

cond=cond.unsqueeze(1).unsqueeze(2).unsqueeze(3)#之前维度为[64]
cond=cond.expand(64,1,288,288)

RuntimeError:_thnn_conv2d_forward not supported on CUPType for Byte

It seems you are trying to pass an input as a ByteTensor (uint8), which is not supported.
Could you call input = input.float() before passing it to the model

RuntimeError:Input type(torch.FloatTensor) and weight tpye (torch.cuda.FloatTensor) should be the same

错误内容大概就是指输入类型是CPU(torch.FloatTensor),而参数类型是GPU(torch.cuda.FloatTensor)

data = data.to(self.device)

参考博客

TypeError: ‘builtin_function_or_method’ object is not subscriptable

把() 写成了 [] 眼太瞎

ValueError: only 2 non-keyword arguments accepted

>>> y=np.array([1,2,3,4,0.4],[2,4,5,7,0.1],[4,2,3,5,0.2])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: only 2 non-keyword arguments accepted
#仅仅接受两个非关键字参数,原因是缺少中括号[]
>>> y=np.array([[1,2,3,4,0.4],[2,4,5,7,0.1],[4,2,3,5,0.2]])
>>> y
array([[1. , 2. , 3. , 4. , 0.4],
       [2. , 4. , 5. , 7. , 0.1],
       [4. , 2. , 3. , 5. , 0.2]])

IndentationError:unexpected indent 缩进错误

NameError:name ‘xxx’ is not defined 名称错误

一般是拼写错误

配置vot-toolkit-python报错

这是官方给出的配置步骤
我的报错如下:
在这里插入图片描述
这个看了log日志后,就是 no module named ‘pytracking’,也就是没有这个环境路径,用export PYTHONPATH 导入此项目的路径可以解决。
第二个问题:
在这里插入图片描述
一直中断,看了log日志,如下:
在这里插入图片描述
发现在跟丢跳过5帧并初始化的时候,就断,之前没有注意这个,以为就是会断,不稳定,师兄就写了个死循环,让它断了再跑,一晚上就会跑完,but并没有,在另一个小哥哥的帮助下找到了错误:
在trackers.ini 下加入 restart = true 就正确了,太难了

  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值