../aten/src/ATen/native/cuda/IndexKernel.cu:92: operator(): block: [651,0,0], thread: [127,0,0] Asse

文章讲述了CUDA运行时错误的原因,主要是由于数据集标签超出预设模型类别数。解决方案包括检查class_map中的类别设置,修正错误标签(如02标签),并提供了一些Linux命令用于数据处理和监控Nvidia显存。

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

RuntimeError: CUDA error: device-side assert triggered

问题

在这里插入图片描述

原因

Assertion `index >= -sizes[i] && index < sizes[i] && “index out of bounds”

数据超出了边界。在给出label的时候,我的数据集在某个标签上会给进去一个小于零或者大于类别数的一个标签,大白话就是设定了模型分类数量为4,但是数据集中有大于4个类别则会报错,少于4个是不会报错。

解决方法:修改预设的类别数量,class_map里面预先写好的类别个数和实际的数据集里面的标签种类和个数不同。可以要修改class_map或者修改数据集。

在这里插入图片描述
这里有96的类别
但是,代码中最高95.。。

在这里插入图片描述
是之前02标签转换的时候类别错了。。。
参考1

一样的问题

解决方案

删掉02的图像和标签

rm -r 00000061*

显示文件夹下jpg图像数量

ls -lR | grep ".*jpg" | wc -l

在这里插入图片描述

Linux上统计文件夹下文件个数以及目录个数

数据处理过程

实时查看nvidia显卡显存

watch -n 1 nvidia-smi 

#其中,1表示每隔1(可改)秒刷新一次终端的显示结果

./aten/src/ATen/native/cuda/IndexKernel.cu:93: operator(): block: [246,0,0], thread: [41,0,0] Assertion `-sizes[i] <= index && index < sizes[i] && "index out of bounds"` failed. ../aten/src/ATen/native/cuda/IndexKernel.cu:93: operator(): block: [246,0,0], thread: [42,0,0] Assertion `-sizes[i] <= index && index < sizes[i] && "index out of bounds"` failed. ../aten/src/ATen/native/cuda/IndexKernel.cu:93: operator(): block: [246,0,0], thread: [43,0,0] Assertion `-sizes[i] <= index && index < sizes[i] && "index out of bounds"` failed. ../aten/src/ATen/native/cuda/IndexKernel.cu:93: operator(): block: [246,0,0], thread: [44,0,0] Assertion `-sizes[i] <= index && index < sizes[i] && "index out of bounds"` failed. ../aten/src/ATen/native/cuda/IndexKernel.cu:93: operator(): block: [246,0,0], thread: [45,0,0] Assertion `-sizes[i] <= index && index < sizes[i] && "index out of bounds"` failed. ../aten/src/ATen/native/cuda/IndexKernel.cu:93: operator(): block: [246,0,0], thread: [46,0,0] Assertion `-sizes[i] <= index && index < sizes[i] && "index out of bounds"` failed. ../aten/src/ATen/native/cuda/IndexKernel.cu:93: operator(): block: [246,0,0], thread: [47,0,0] Assertion `-sizes[i] <= index && index < sizes[i] && "index out of bounds"` failed. 0%| | 0/19 [00:00<?, ?it/s] Traceback (most recent call last): File "/kangzhe.ma/code/yolov8_idcard_seg/ultralytics-main/ultralytics/train_idcard_ps_detc.py", line 8, in <module> results = model.train(data='./cfg/datasets/idcard_ps_detc.yaml', epochs=100, imgsz=640) File "/kangzhe.ma/code/yolov8_idcard_seg/ultralytics-main/ultralytics/engine/model.py", line 650, in train self.trainer.train() File "/kangzhe.ma/code/yolov8_idcard_seg/ultralytics-main/ultralytics/engine/trainer.py", line 204, in train self._do_train(world_size) File "/kangzhe.ma/code/yolov8_idcard_seg/ultralytics-main/ultralytics/engine/trainer.py", line 381, in _do_train self.loss, self.loss_items = self.model(batch) File "/usr/local/con
03-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值