Pytorch-yolov3: Training on custom data: Index out of range

Created on 30 Jul 2019  ·  3Comments  ·  Source: eriklindernoren/PyTorch-YOLOv3

Hello.
I was training my custom data on this model.
But here came this error.

/content/drive/My Drive/Colab Notebooks/PyTorch-YOLOv3
Namespace(batch_size=8, checkpoint_interval=1, compute_map=False, data_config='config/custom.data', epochs=100, evaluation_interval=1, gradient_accumulations=2, img_size=416, model_def='config/yolov3-custom.cfg', multiscale_training=True, n_cpu=8, pretrained_weights='weights/darknet53.conv.74')
WARNING: Logging before flag parsing goes to stderr.
W0730 18:40:17.464412 140054609725312 deprecation_wrapper.py:119] From /content/drive/My Drive/Colab Notebooks/PyTorch-YOLOv3/utils/logger.py:7: The name tf.summary.FileWriter is deprecated. Please use tf.compat.v1.summary.FileWriter instead.

Traceback (most recent call last):
  File "train.py", line 56, in <module>
    model = Darknet(opt.model_def).to(device)
  File "/content/drive/My Drive/Colab Notebooks/PyTorch-YOLOv3/models.py", line 241, in __init__
    self.yolo_layers = [layer[0] for layer in self.module_list if hasattr(layer[0], "metrics")]
  File "/content/drive/My Drive/Colab Notebooks/PyTorch-YOLOv3/models.py", line 241, in <listcomp>
    self.yolo_layers = [layer[0] for layer in self.module_list if hasattr(layer[0], "metrics")]
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/container.py", line 68, in __getitem__
    return self._get_item_by_idx(self._modules.values(), idx)
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/container.py", line 60, in _get_item_by_idx
    raise IndexError('index {} is out of range'.format(idx))
IndexError: index 0 is out of range

I look throught the related code and Google a lot. Now I am wondering whether _get_item_by_idx is correct

Most helpful comment

There is a problem with your yolov3-custom.cfg!
Please delete it.
Then
Running script:create_custom_model.sh

I guess you ran this script twice or more。

All 3 comments

There is a problem with your yolov3-custom.cfg!
Please delete it.
Then
Running script:create_custom_model.sh

I guess you ran this script twice or more。

There is a problem with your yolov3-custom.cfg!
Please delete it.
Then
Running script:create_custom_model.sh

I guess you ran this script twice or more。

Thank you! This problem has been solved thanks to your suggestion!
I couldn't imagine it was caused by this.
Thank you a lot!

There is a problem with your yolov3-custom.cfg!
Please delete it.
Then
Running script:create_custom_model.sh

I guess you ran this script twice or more。

i try it,but did not work,display same erro 。。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mwharton3 picture mwharton3  ·  3Comments

zhaowt61 picture zhaowt61  ·  4Comments

monteksingh picture monteksingh  ·  3Comments

a954217436 picture a954217436  ·  4Comments

codeyogi911 picture codeyogi911  ·  4Comments