Pytorch目标检测算法遇到的问题总结

记录一下自己遇到的问题和在网上查到的解决办法(更新中。。。如有侵权,请联系博主删除)

1、OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

解决方式:

在train.py中导入库的位置添加代码:

import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'

2、UserWarning: This call to matplotlib.use() has no effect because the backend has already been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,or matplotlib.backends is imported for the first time.

解决方式:

在最开头添加以下代码:

import matplotlib
matplotlib.use('Agg')

3、yolov5训练时出现_pickle.UnpicklingError: STACK_GLOBAL requires str

解决办法:

​​​​​​yolov5训练时出现_pickle.UnpicklingError: STACK_GLOBAL requires str的解决办法_!传深的博客-CSDN博客4

 4、RuntimeError: cannot perform reduction function max on tensor with no elements because the operation

解决方法:

将标签中的difficult节点为1的改为0

5、ERROR: Could not build wheels for pycocotools

解决方法:

下载Visual,在visual安装时要勾选c++和python。

如果已经安装了visual,想补充安装的话,首先找到开始菜单中的visual studio installer,打开后选择修改,再选择c++和python即可。如下图:

6、mmrotate报错:ModuleNotFoundError: No module named ‘mmcv._ext‘

 解决方法:

更换mmcv-full版本,以下版本供参考:

cuda=10.1       torch=1.6.0  torchvision=0.7.0

mmcv-full==1.5.3   mmdet==2.25.0  mmrotate==0.3.2

安装mmcv采用如下命令:(cu101表示cuda10.1,torch1.6.0,都换成自己的版本)

pip install mmcv-full==1.5.3 -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html

7、EOFError: Ran out of input

检查一下权重文件是否为空

8、cv2.imshow报错

cv2.error: OpenCV(4.5.4-dev) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1274: error: (-2:Unspecified e
rror) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'

解决方法:

pip install opencv-contrib-python

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值