跑yolov5-obb时的错误

前言.

最近因为项目的原因,要使用检测斜框的模型,就学习了一下yolov5-obb。

当然,在配置环境和使用时也是遇到了许多问题,记下了一些认为比较重要的,

使用的代码是这个大佬的:https://github.com/hukaixuan19970627/yolov5_obb


1. AttributeError: module 'numpy' has no attribute 'int'.

原因:np.int在NumPy 1.20中已弃用,在NumPy 1.24中已删除。

解决方式把有报错的文件里的np.int更改为np.int_。。或者改成int也是可以

2.RuntimeError: result type Float can't be cast to the desired output type __int64

解决方法修改【utils】中的【loss.py】里面的两处内容

          1)打开你的【utils】文件下的【loss.py】

        2)按【Ctrl】+【F】打开搜索功能,输入【for i in range(self.nl)】找到后将anchors = self.anchors[i]替换为 anchors, shape = self.anchors[i], p[i].shape。输入【indices.append】找到下面的一行内容: 替换为以下内容indices.append((b, a, gj.clamp_(0, shape[2] - 1), gi.clamp_(0, shape[3] - 1)))  # image, anchor, grid

3.RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

解决方法在nms_rotated_wrapper.py中把ori_inds = torch.arange(dets_th.size(0)) # 0 ~ n-1

替换为ori_inds = torch.arange(dets_th.size(0)).to('cuda') # 0 ~ n-1。即把数据也放到GPU中

4.AttributeError: 'FreeTypeFont' object has no attribute 'getsize' AttributeError: 'FreeTypeFont' object has no attribute 'getsize' Results saved to runs\train\exp

原因:安装了新版本的Pillow。

解决方法降到9.5即可----pip install Pillow==9.5

5.RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

原因:下载yolov5x.pt这个权重文件的时候没有下载完。

解决方法:可以自己手动下载,下载完即可。

6.运行这句话python setup.py build_ext --inplace出现了error: command 'D:\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

解决方法:DOTA_devkit-master文件夹根目录的polyiou.cppNotepad打开,然后将编码改为UTF-8 BOM格式,再重新执行之前的代码就OK


记录的就暂时只有这些,如果有其它的问题,可以去开头的github链接中的issue中查找遇到的问题。


笔者也是小白一枚,有错误欢迎指正.

  • 20
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
YOLOV5-OBB是一种用于斜框目标检测的神经网络模型。它是基于YOLOv5框架改写而来的,主要用于检测倾斜的目标物体。YOLOV5-OBB的原理和细节可以在相关的文博客和知乎文章找到详细介绍。 要使用YOLOV5-OBB,首先需要将yolov5s.wts文件复制到工程目录下的Yolov5_obb_Tensorrt_Infer文件夹。然后,可以根据需求对YOLOV5-OBB进行进一步的剪枝和优化,比如使用yolov8_obb旋转框检测或者yolov8_obb旋转框跟踪等技术。 总结来说,YOLOV5-OBB是一种用于斜框目标检测的网络模型,它可以通过TensorRT进行部署和推理。通过遵循相应的教程和步骤,你可以学习如何使用YOLOV5-OBB,并将其应用到你的目标检测项目。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Yolov5旋转框(斜框)检测tensorrt部署(C++)从入门到入坟](https://blog.csdn.net/qq_41043389/article/details/127777272)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [yolov5_obb旋转框检测(kld loss、probloss),剪枝,跟踪](https://blog.csdn.net/qq_39128381/article/details/131570890)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值