训练YOLOv9-e时train.py文件属性错误

问题描述 投票:0回答:1

开始训练 yolov9-e 或 yolov9-c 时,我总是收到此错误:

`your text`Traceback (most recent call last):
           File "/content/yolov9/train.py", line 634, in <module>
           main(opt)
           File "/content/yolov9/train.py", line 528, in main
           train(opt.hyp, opt, device, callbacks)
           File "/content/yolov9/train.py", line 304, in train
           loss, loss_items = compute_loss(pred, targets.to(device))  # loss scaled by batch_size
           File "/content/yolov9/utils/loss_tal.py", line 168, in __call__
           pred_distri, pred_scores = torch.cat([xi.view(feats[0].shape[0], self.no, -1) for xi in           feats], 2).split(
           File "/content/yolov9/utils/loss_tal.py", line 168, in <listcomp>
           pred_distri, pred_scores = torch.cat([xi.view(feats[0].shape[0], self.no, -1) for xi in  feats], 2).split(
           AttributeError: 'list' object has no attribute 'view'

我正在尝试使用 roboflow 平台的代码片段来训练它。根据我观看的视频,在使用 roboflow 的基本代码片段训练这两个模型时,没有人遇到此错误。

我尝试使用以下方法清除 GPU 内存:

import torch
import os

torch.cuda.empty_cache()
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True'
python pytorch yolo
1个回答
0
投票

如果是yolov9.c或e模型,你必须使用train_dual.py而不是train.py

© www.soinside.com 2019 - 2024. All rights reserved.