YOLOv3的训练、测试、fine-tuning过程中遇到的问题

在使用YOLOv3进行目标检测时,遇到train时UserWarning提示索引类型过时,以及CUDA错误device-side assert triggered。解决办法包括更新索引类型为torch.bool和在utils/utils.py中修正索引越界问题,同时降低学习率避免报错。数据集中更改类别数也可能导致问题,但通过检查和调整可以避免。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

先占个坑。

  1. train时遇到错误:UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead
    在这里插入图片描述
    解决方法: https://blog.youkuaiyun.com/BBZZ2/article/details/101022935

  2. 用自己的数据集训练,改变了类别数。训练时会出现错误如下:

    RuntimeError: CUDA error: device-side assert triggered.
    在这里插入图片描述
    目前找到的有效的解决方法有两个:

    1. 在utils/utils.py中,在相应位置添加下面代码:
      https://github.com/eriklindernoren/PyTorch-YOLOv3/issues/157
      b, target_labels = target[:, :2].long().t()
      gx, gy = gxy.t()
      gw, gh = gwh.t()
      gi, gj

用自有数据集 YOLO-World -s 用自有 yolo格式的热成像 人脸检测 训练数据集 微调 s_stage2-4466ab94.pth的背景下, 以下是 官方微调教程 Fine-tuning YOLO-World Fine-tuning YOLO-World is easy and we provide the samples for COCO object detection as a simple guidance. Fine-tuning Requirements Fine-tuning YOLO-World is cheap: it does not require 32 GPUs for multi-node distributed training. 8 GPUs or even 1 GPU is enough. it does not require the long schedule, e.g., 300 epochs or 500 epochs for training YOLOv5 or YOLOv8. 80 epochs or fewer is enough considering that we provide the good pre-trained weights. Data Preparation The fine-tuning dataset should have the similar format as the that of the pre-training dataset. We suggest you refer to docs/data for more details about how to build the datasets: if you fine-tune YOLO-World for close-set / custom vocabulary object detection, using MultiModalDataset with a text json is preferred. if you fine-tune YOLO-World for open-vocabulary detection with rich texts or grounding tasks, using MixedGroundingDataset is preferred. Hyper-parameters and Config Please refer to the config for fine-tuning YOLO-World-L on COCO for more details. Basic config file: If the fine-tuning dataset contains mask annotations: base = ('…/…/third_party/mmyolo/configs/yolov8/yolov8_l_mask-refine_syncbn_fast_8xb16-500e_coco.py') 复制 base = (‘…/…/third_party/mmyolo/configs/yolov8/yolov8_l_mask-refine_syncbn_fast_8xb16-500e_coco.py’) python If the fine-tuning dataset doesn’t contain mask annotations: base = ('…/…/third_party/mmyolo/configs/yolov8/yolov8_l_syncbn_fast_8xb16-500e_coco.py') 复制 base = (‘…/…/third_party/mmyolo/configs/yolov8/yolov8_l_syncbn_fast_8xb16-500e_coco.py’) python Training Schemes: Reducing the epochs and adjusting the learning rate _base_.val_interval_stage2)]) 复制 _base_.val_interval_stage2)]) python Datasets: _delete_=True, type='MultiModalDataset', type='YOLOv5CocoDataset', data_r
最新发布
03-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值