Pytorch-yolov3: Training on Custom Data issue

Created on 4 May 2019  路  14Comments  路  Source: eriklindernoren/PyTorch-YOLOv3

I am having an issue while training a custom model using pretrained weights
Command

!python3 train.py --batch_size 4 --model_def config/yolov3-custom.cfg --data_config config/custom.data --pretrained_weights weights/darknet53.conv.74

Error Log

---- Evaluating Model ----
Detecting objects: 100%|##########################| 2/2 [00:07<00:00,  4.11s/it]
[]
Traceback (most recent call last):
  File "train.py", line 160, in <module>
    batch_size=8,
  File "/home/ubuntu/PyTorch-YOLOv3/test.py", line 54, in evaluate
    true_positives, pred_scores, pred_labels = [np.concatenate(x, 0) for x in list(zip(*sample_metrics))]
ValueError: not enough values to unpack (expected 3, got 0)

Most helpful comment

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 ----")

All 14 comments

I am having an issue while training a custom model using pretrained weights
Command

!python3 train.py --batch_size 4 --model_def config/yolov3-custom.cfg --data_config config/custom.data --pretrained_weights weights/darknet53.conv.74

Error Log

---- Evaluating Model ----
Detecting objects: 100%|##########################| 2/2 [00:07<00:00,  4.11s/it]
[]
Traceback (most recent call last):
  File "train.py", line 160, in <module>
    batch_size=8,
  File "/home/ubuntu/PyTorch-YOLOv3/test.py", line 54, in evaluate
    true_positives, pred_scores, pred_labels = [np.concatenate(x, 0) for x in list(zip(*sample_metrics))]
ValueError: not enough values to unpack (expected 3, got 0)

I had the same problem. @eriklindernoren

I also have the same issue in the second epoch of training @eriklindernoren

precision, recall, AP, f1, ap_class = evaluate(
model,
...,
batch_size=opt.batch_size,
)
He set the default batch_size as fixed value 8, try to change "batch_size=8" to "batch_size=opt.batch_size"

@codeyogi911 @Ecalpal @Somoina

I also have the same issue in the second epoch of training @eriklindernoren

precision, recall, AP, f1, ap_class = evaluate(
model,
...,
batch_size=opt.batch_size,
)
He set the default batch_size as fixed value 8, try to change "batch_size=8" to "batch_size=opt.batch_size"
same error after changing those argument values

precision, recall, AP, f1, ap_class = evaluate(
model,
...,
batch_size=opt.batch_size,
)
He set the default batch_size as fixed value 8, try to change "batch_size=8" to "batch_size=opt.batch_size"

I tried it a few days ago, but it doesn't work.

I ran into this issue as well; it may very well be that no objects were detected during the test step. That's what occurred for me, anyway (I noticed the recall rates for all yolo layers were 0.00 just before the error)

In a sense, I have solved this problem. I cut the picture to 416*416, and cleaned the training data. Then the problem never happened again.

In a sense, I have solved this problem. I cut the picture to 416*416, and cleaned the training data. Then the problem never happened again.

I cut the images to 832X832 but what do you mean by cleaning the data?
I am still facing the same issue.

@eriklindernoren can you please help us with this issue?

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 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 ----")

Try to the issue be solved by change the value in line numbers 150. Change 0 to 1and the same issue.
if epoch % opt.evaluation_interval == 1:
1.python train.py
Then 2. python test.py",
line 53, in evaluate
true_positives, pred_scores, pred_labels = [np.concatenate(x, 0) for x in list(zip(*sample_metrics))]
ValueError: not enough values to unpack (expected 3, got 0)

Thanks!

I am having an issue while training a custom model using pretrained weights
Command

!python3 train.py --batch_size 4 --model_def config/yolov3-custom.cfg --data_config config/custom.data --pretrained_weights weights/darknet53.conv.74

Error Log

---- Evaluating Model ----
Detecting objects: 100%|##########################| 2/2 [00:07<00:00,  4.11s/it]
[]
Traceback (most recent call last):
  File "train.py", line 160, in <module>
    batch_size=8,
  File "/home/ubuntu/PyTorch-YOLOv3/test.py", line 54, in evaluate
    true_positives, pred_scores, pred_labels = [np.concatenate(x, 0) for x in list(zip(*sample_metrics))]
ValueError: not enough values to unpack (expected 3, got 0)

Hi, I changed the evaluation_interval 1 to 10. By default, it was 1. It was running successfully

I am closing this because it is a duplicate of #178. Let's discuss it there.

Was this page helpful?
0 / 5 - 0 ratings