Pytorch-yolov3: ValueError: not enough values to unpack (expected 3, got 0)

Created on 16 May 2019  ·  21Comments  ·  Source: eriklindernoren/PyTorch-YOLOv3

I use the yolove-tiny to train, but have this problem. I think maybe I run the wrong command or there is any other problem.
error

Most helpful comment

Maybe consider add this piece of little dirty code into test.py in evaluation() before # concatenate sample statistics?

if len(sample_metrics) == 0:
    return np.array([0]), np.array([0]), np.array([0]), np.array([0]), np.array([0], dtype=np.int)

All 21 comments

i have the same problem, how to deal with? my Python3.7 torch1.10

Same issue please help. Does it mean that there is something wrong with the data?
Note that i have checked that my annotation is correct. by following this tutorial:
https://blog.goodaudience.com/part-1-preparing-data-before-training-yolo-v2-and-v3-deepfashion-dataset-3122cd7dd884

I use the yolove-tiny to train, but have this problem. I think maybe I run the wrong command or there is any other problem.
error

hey,have you work out this problem?

I can train with one picture but failed to train two same pictures
QQ截图20190517154351

maybe:
1.resize the images to 416*416,
2.englarge the valid.txt,(or just copy the content of train.txt and delete some),
3.use Windows cmd instead of anaconda prompt.
I did the three things and no more value error
by https://github.com/eriklindernoren/PyTorch-YOLOv3/issues/159
I think this error is caused by detecting no object in the pictures of valid.txt,NO object and NO value to unpack.

OS:Ubuntu18.04
pytorch:1.1.0
python:3.6.8

Got same error, the valid.txt was duplicated from train.txt, 25 images , labels are generated by labelImg using yolo format. The code batch_size=opt.batch_size had been corrected. Is there anyone solved this problem?

My advice would be to skip evaluation for the first run if you are using costum train data etc. because then you'll need to retrain the model / weights. For the first run, your might not do any detections (which is causing this issue).

Is the problem solved? I also encountered this situation

I have the same problem too, have anyone work out this problem?

Maybe consider add this piece of little dirty code into test.py in evaluation() before # concatenate sample statistics?

if len(sample_metrics) == 0:
    return np.array([0]), np.array([0]), np.array([0]), np.array([0]), np.array([0], dtype=np.int)

The issue was solved by doing the multiscale training to false in line no. 38 train.py scripts. By default its True, you can change it to false and the issue will be solved.

The issue was solved by doing the multiscale training to false in line no. 38 train.py scripts. By default its True, you can change it to false and the issue will be solved.

I have tried,but useless

The issue can be solved by change the value in line numbers 150. You can change 0 to 1 and the issue will be solved. For example:
if epoch % opt.evaluation_interval == 0:
print("n---- Evaluating Model ----")
change to
if epoch % opt.evaluation_interval == 1:
print("n---- Evaluating Model ----")

oh,thank you so much,I will try it------------------ 原始邮件 ------------------
发件人: "hyhyni"notifications@github.com
发送时间: 2019年7月28日(星期天) 中午11:06
收件人: "eriklindernoren/PyTorch-YOLOv3"PyTorch-YOLOv3@noreply.github.com;
抄送: "yhx0105"1370117133@qq.com;"Comment"comment@noreply.github.com;
主题: Re: [eriklindernoren/PyTorch-YOLOv3] ValueError: not enough values tounpack (expected 3, got 0) (#178)

The issue can be solved by change the value in line numbers 150. You can change 0 to 1 and the issue will be solved. For example:
if epoch % opt.evaluation_interval == 0:
print("n---- Evaluating Model ----")
change to
if epoch % opt.evaluation_interval == 1:
print("n---- Evaluating Model ----")


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@hyhyni Thank you~ I solved this problem by your way.

@hyhyni Thank you~ I solved this problem by your way.

You are welcome.

@hyhyni ,for the way you proposal,why do you do in this way ?

I think @xiayanqian's reply is more correct answer -->"I think this error is caused by detecting no object in the pictures of valid.txt,NO object and NO value to unpack."
In evaluation, model no any prediction in certain image, so will error.
@hyhyni's method is let no evaluate in training time, so this error will not happen~
I think @imkzh method will fix this error.

@imkzh could you provide a pull request with this fix?

My pleasure, but i think that kind of fix is not clean enough, i will take a look into this, in maybe one or two days @Flova

I know @imkzh. The current master version of it isn't clean either. ^^
But if you have a cleaner solution let me know. Even if it's in a week :D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

codeyogi911 picture codeyogi911  ·  4Comments

mayaghaei picture mayaghaei  ·  4Comments

MAP
nationalflag picture nationalflag  ·  5Comments

stadtgiraffe picture stadtgiraffe  ·  3Comments

MessiahChen picture MessiahChen  ·  3Comments