MuhammadMoinFaisal/yolov7-segmentation-with-DeepSORT-Tracking

AttributeError: 'list' object has no attribute 'shape'?

Opened this issue · 1 comments

anchors, shape = self.anchors[i], p[i].shape,code error'list' object has no attribute 'shape'。

I trained with the coco dataset, taking into account the conversion problem, using the following code:
anchors, shape = self.anchors[i],torch.tensor(list((p.cpu().detach().numpy() for p in p[i]))).cuda().shape

But an error was reported ValueError: expected sequence of length 80 at dim 3 (got 40),What is the solution?

hi i also got some what same error is issue been solved

Starting training for 300 epochs...

      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size
  0%|          | 0/225 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "train.py", line 630, in <module>
    main(opt)
  File "train.py", line 526, in main
    train(opt.hyp, opt, device, callbacks)
  File "train.py", line 308, in train
    loss, loss_items = compute_loss(pred, targets.to(device))  # loss scaled by batch_size
  File "./utils/loss.py", line 125, in __call__
    tcls, tbox, indices, anchors = self.build_targets(p, targets)  # targets
  File "./utils/loss.py", line 198, in build_targets
    anchors, shape = self.anchors[i], p[i].shape
AttributeError: 'list' object has no attribute 'shape'