TypeError: bbox_iou() got an unexpected keyword argument 'x1y1x2y2' in python 3

277 Views Asked by At
    Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size
  0%|          | 0/203 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "train.py", line 691, in <module>
    main(opt)
  File "train.py", line 580, in main
    train(opt.hyp, opt, device, callbacks)
  File "train.py", line 343, in train
    loss, loss_items = compute_loss(pred, targets.to(device))  # loss scaled by batch_size
  File "/root/All Projects/yolov5KD1st/utils/loss.py", line 215, in __call__
    iou = bbox_iou(pbox.T, tbox[i], x1y1x2y2=False, CIoU=True)  # iou(prediction, target)
TypeError: bbox_iou() got an unexpected keyword argument 'x1y1x2y2'
wandb: Waiting for W&B process to finish... (failed 1). Press Control-C to abort syncing.
wandb:  View run swept-glitter-8 at: https://wandb.ai/my-research-project/YOLOv5/runs/2x6b5tqs
wandb: Synced 6 W&B file(s), 0 media file(s), 0 artifact file(s) and 0 other file(s)
wandb: Find logs at: ./wandb/run-20230509_024133-2x6b5tqs/logs

The above is error show when I try to run yolov5 model below is screen shot which show this error in details .if anyone has idea please help. enter image description here The above error as for lines refered are below. enter image description here

 # Forward
            with torch.cuda.amp.autocast(amp):
                pred = model(imgs)  # forward
                #Introduction of Teacher Model
                if opt.distill:
                    with torch.no_grad():
                        t_pred = t_model(imgs)
                        loss, loss_items = compute_loss(pred, targets.to(device))  # loss scaled by batch_size
                # distillation
                if opt.distill:
                    dloss = compute_distillation_output_loss(
                        pred, t_pred, model, opt.dist_loss, opt.temperature)
                else:
                    dloss = 0
                loss += dloss
                loss_items[-1] = loss
                # loss, loss_items = compute_loss(pred, targets.to(device))  # loss scaled by batch_size
                #above statement used by default line 352
                # End of Teacher Model
                if RANK != -1:
                    loss *= WORLD_SIZE  # gradient averaged between devices in DDP mode
                if opt.quad:
                    loss *= 4.

            # Backward

Below is how i was running my model.

** python train.py --weights weights/yolov5m.pt \
        --cfg models/yolov5m.yaml --data data/VisDrone.yaml --epochs 100 \
        --batch-size 32  --hyp data/hyps/hyp.scratch-med.yaml **

below is the link to code on github

https://github.com/ashymuzuro/yolov5-pure-kd

As to what I expect is for the model to run instead of showing errors.

0

There are 0 best solutions below