cwq159 / PyTorch-Spiking-YOLOv3

A PyTorch implementation of Spiking-YOLOv3. Two branches are provided, based on two common PyTorch implementation of YOLOv3(ultralytics/yolov3 & eriklindernoren/PyTorch-YOLOv3), with support for Spiking-YOLOv3-Tiny at present.
GNU General Public License v3.0
207 stars 58 forks source link

GPU训练下无法使用numpy #51

Open dnkscu opened 1 year ago

dnkscu commented 1 year ago

作者您好 训练一段时间之后出现这样的问题

截屏2022-10-14 下午2 03 06

TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() 就是说GPU环境没办法将tensor转换成numpy,需要在哪里添加".cpu()"呢

WuTi0525 commented 1 year ago

你可以尝试修改utils/utils.py line 819 中的 targets.append([i, cls, x, y, w, h, conf])为 targets.append([i, cls, x.cpu(), y.cpu(), w.cpu(), h.cpu(), conf.cpu()])