Tianxiaomo / pytorch-YOLOv4

PyTorch ,ONNX and TensorRT implementation of YOLOv4
Apache License 2.0
4.48k stars 1.49k forks source link

ValueError: too many values to unpack (expected 2) #209

Closed hongrui16 closed 3 years ago

hongrui16 commented 4 years ago

Traceback (most recent call last): File "train.py", line 635, in device=device, ) File "train.py", line 425, in train evaluator = evaluate(eval_model, val_loader, config, device) File "/root/anaconda2/envs/pytorch_1_5/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 15, in decorate_context return func(*args, **kwargs) File "train.py", line 493, in evaluate for img, target, (boxes, confs) in zip(images, targets, outputs): ValueError: too many values to unpack (expected 2)

Is there any useful solution

YuzhouPeng commented 4 years ago

same problem, in the cfg.py I use Cfg.use_darknet_cfg = True and cfgfile I use yolov4.cfg. and I rewrite get_image_id like this: 捕获

cjh-lxq commented 4 years ago

SAME problem!

ersheng-ai commented 4 years ago

Inference output now is split into 2 tensors: boxes: [batch, num_boxes, 1, 4] and confs: [batch, num_boxes, num_classes].

The output used to be one compact tensor shaped like: [batch, num_boxes, 4 + num_classes] Please double check consistencies in your local source code.

YuzhouPeng commented 4 years ago

hello, I check the output using code "print(outputs[0].shape)" to get tensor shape, and following are my results and errors: Screenshot from 2020-08-07 17-01-50 Screenshot from 2020-08-07 17-01-21 the shape is [1,22743,1,4] I only got the bbox values and I can not see the confs values, is there any reason for this error? I changed the Cfg.use_darknet_cfg to False in cfg.py, Is there any relationship with this error? But if I change the value to True it will have error in this link: https://github.com/Tianxiaomo/pytorch-YOLOv4/issues/142

hongrui16 commented 4 years ago

same problem, in the cfg.py I use Cfg.use_darknet_cfg = True and cfgfile I use yolov4.cfg. and I rewrite get_image_id like this: 捕获

I have edited the ''get_image_id'' function. The error has nothing to do with the function.

YuzhouPeng commented 4 years ago

same problem, in the cfg.py I use Cfg.use_darknet_cfg = True and cfgfile I use yolov4.cfg. and I rewrite get_image_id like this: 捕获

I have edited the ''get_image_id'' function. The error has nothing to do with the function.

in fact this solution is to solve another problem: https://github.com/Tianxiaomo/pytorch-YOLOv4/issues/182, if you dont have that error you do not need to do that.

MBocchi commented 4 years ago

Hi, Try to replace this line for img, target, (boxes, confs) in zip(images, targets, outputs): by for img, target, boxes, confs in zip(images, targets, outputs[0], outputs[1]):

This solved my problem

klyjm commented 4 years ago

Hi, Try to replace this line for img, target, (boxes, confs) in zip(images, targets, outputs): by for img, target, boxes, confs in zip(images, targets, outputs[0], outputs[1]):

This solved my problem

I use the same way, but still has other error

hongrui16 commented 4 years ago

same problem, in the cfg.py I use Cfg.use_darknet_cfg = True and cfgfile I use yolov4.cfg. and I rewrite get_image_id like this: 捕获

I have edited the ''get_image_id'' function. The error has nothing to do with the function.

in fact this solution is to solve another problem: #182, if you dont have that error you do not need to do that.

I KNOW

YuzhouPeng commented 4 years ago

is there any one who have this problem? AssertionError: results do not correspond to current coco set https://github.com/Tianxiaomo/pytorch-YOLOv4/issues/219

zrqi commented 4 years ago

same problem, in the cfg.py I use Cfg.use_darknet_cfg = True and cfgfile I use yolov4.cfg. and I rewrite get_image_id like this: 捕获

I have edited the ''get_image_id'' function. The error has nothing to do with the function.

in fact this solution is to solve another problem: #182, if you dont have that error you do not need to do that.

I KNOW Hi,have you solved this problem?I also encountered this problem

hongrui16 commented 4 years ago

same problem, in the cfg.py I use Cfg.use_darknet_cfg = True and cfgfile I use yolov4.cfg. and I rewrite get_image_id like this: 捕获

I have edited the ''get_image_id'' function. The error has nothing to do with the function.

in fact this solution is to solve another problem: #182, if you dont have that error you do not need to do that.

I KNOW Hi,have you solved this problem?I also encountered this problem

I give up. The repo is bullshit. No specific introduction about how to implement the dataset. After I take many efforts to finish preparing the dataset to match this repo, more bugs emerge. If we put forward a repo on GitHub, we should make it work well at least, with a proper introduction, especially when the repo is a bit complicated, in my mind. Bullshit

fathia-ghribi commented 3 years ago

hello guys !! i try to implement lda2vec algorithm from (https://github.com/sebkim/lda2vec-pytorch) with my own data. when i try the model preprocess.py, i'm getting this error. image how to fix this error, someone help me