When I train on voc, it shows:
Traceback (most recent call last):
File "1train.py", line 60, in
model = Darknet(opt.model_config_path)
File "/public/home/G19850028/zheng/workspace/yolo-erik/models.py", line 241, in __init__
self.yolo_layers = [layer[0] for layer in self.module_list if hasattr(layer[0], "metrics")]
File "/public/home/G19850028/zheng/workspace/yolo-erik/models.py", line 241, in
self.yolo_layers = [layer[0] for layer in self.module_list if hasattr(layer[0], "metrics")]
File "/public/home/G19850028/zheng/Anacoda3/public/home/G19850028/anacoda35/lib/python3.6/site-packages/torch/nn/modules/container.py", line 68, in __getitem__
return self._get_item_by_idx(self._modules.values(), idx)
File "/public/home/G19850028/zheng/Anacoda3/public/home/G19850028/anacoda35/lib/python3.6/site-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
Anyone can help me! Thank you!
I have the same error,have you solved it ?! I'm also searching for the ways to solve it!
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 have the same error,have you solved it ?! I'm also searching for the ways to solve it!
Hi, Have you solved the problem?I want to train on VOC ,and I modified voc.data,voc.names and yolo.cfg.And I use voc_label.py to get 2007_train.text and 2007_test.text.
Traceback (most recent call last):
File "train.py", line 99, in
for batch_i, (_, imgs, targets) in enumerate(dataloader):
File "/home/yyx/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 582, in __next__
return self._process_next_batch(batch)
File "/home/yyx/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
TypeError: Traceback (most recent call last):
File "/home/yyx/.local/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/yyx/.local/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/yyx/PyTorch-YOLOv3-master/utils/datasets.py", line 130, in __getitem__
img, targets = horisontal_flip(img, targets)
File "/home/yyx/PyTorch-YOLOv3-master/utils/augmentations.py", line 8, in horisontal_flip
targets[:, 2] = 1 - targets[:, 2]
Is there anything else that needs to be changed?
There is a problem with your yolov3-custom.cfg!
Please delete it.
Then
Running script:create_custom_model.shI guess you ran this script twice or more。
thank you!
There is a problem with your yolov3-custom.cfg!
Please delete it.
Then
Running script:create_custom_model.shI 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.shI guess you ran this script twice or more。
@haibinwang9 Hi
I am facing the same problem with yolov5
i am also the same issue on yolo v5.
Has there been any solution?
also the same issue on yolo v5,
(pytorch) C:UsersashesDesktopbloodyolov5>python train.py --img 416 --batch 16 --epochs 100 --data ./data/blood_cell.yaml --cfg ./models/yolov5s_blood.yaml --weights weights/yolov5s.pt --name yolov5s_results --nosave --cache
Using CPU
Namespace(adam=False, batch_size=16, bucket='', cache_images=True, cfg='./models/yolov5s_blood.yaml', data='./data/blood_cell.yaml', device='', epochs=100, evolve=False, hyp='', img_size=[416, 416], local_rank=-1, multi_scale=False, name='yolov5s_results', noautoanchor=False, nosave=True, notest=False, rect=False, resume=False, single_cls=False, sync_bn=False, total_batch_size=16, weights='weights/yolov5s.pt', world_size=1)
Start Tensorboard with "tensorboard --logdir=runs", view at http://localhost:6006/
Hyperparameters {'lr0': 0.01, 'momentum': 0.937, 'weight_decay': 0.0005, 'giou': 0.05, 'cls': 0.5, 'cls_pw': 1.0, 'obj': 1.0, 'obj_pw': 1.0, 'iou_t': 0.2, 'anchor_t': 4.0, 'fl_gamma': 0.0, 'hsv_h': 0.015, 'hsv_s': 0.7, 'hsv_v': 0.4, 'degrees': 0.0, 'translate': 0.5, 'scale': 0.5, 'shear': 0.0, 'perspective': 0.0, 'flipud': 0.0, 'fliplr': 0.5, 'mixup': 0.0}
from n params module arguments
0 -1 1 3520 models.common.Focus [3, 32, 3]
1 -1 1 18560 models.common.Conv [32, 64, 3, 2]
2 -1 1 19904 models.common.BottleneckCSP [64, 64, 1]
3 -1 1 73984 models.common.Conv [64, 128, 3, 2]
4 -1 1 161152 models.common.BottleneckCSP [128, 128, 3]
5 -1 1 295424 models.common.Conv [128, 256, 3, 2]
6 -1 1 641792 models.common.BottleneckCSP [256, 256, 3]
7 -1 1 1180672 models.common.Conv [256, 512, 3, 2]
8 -1 1 656896 models.common.SPP [512, 512, [5, 9, 13]]
9 -1 1 1248768 models.common.BottleneckCSP [512, 512, 1, False]
10 -1 1 131584 models.common.Conv [512, 256, 1, 1]
11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
12 [-1, 6] 1 0 models.common.Concat [1]
13 -1 1 378624 models.common.BottleneckCSP [512, 256, 1, False]
14 -1 1 33024 models.common.Conv [256, 128, 1, 1]
15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
16 [-1, 4] 1 0 models.common.Concat [1]
17 -1 1 95104 models.common.BottleneckCSP [256, 128, 1, False]
18 -1 1 3096 torch.nn.modules.conv.Conv2d [128, 24, 1, 1]
19 -2 1 147712 models.common.Conv [128, 128, 3, 2]
20 [-1, 14] 1 0 models.common.Concat [1]
21 -1 1 313088 models.common.BottleneckCSP [256, 256, 1, False]
22 -1 1 6168 torch.nn.modules.conv.Conv2d [256, 24, 1, 1]
23 -2 1 590336 models.common.Conv [256, 256, 3, 2]
24 [-1, 10] 1 0 models.common.Concat [1]
25 -1 1 1248768 models.common.BottleneckCSP [512, 512, 1, False]
26 -1 1 12312 torch.nn.modules.conv.Conv2d [512, 24, 1, 1]
27 [] 1 0 models.yolo.Detect [3, [[116, 90, 156, 198, 373, 326], [30, 61, 62, 45, 59, 119], [10, 13, 16, 30, 33, 23]], []]
Traceback (most recent call last):
File "train.py", line 463, in
train(hyp, opt, device, tb_writer)
File "train.py", line 77, in train
model = Model(opt.cfg, nc=nc).to(device)
File "C:UsersashesDesktopbloodyolov5modelsyolo.py", line 70, in __init__
m.stride = torch.tensor([s / x.shape[-2] for x in self.forward(torch.zeros(1, ch, s, s))]) # forward
File "C:UsersashesDesktopbloodyolov5modelsyolo.py", line 100, in forward
return self.forward_once(x, profile) # single-scale inference, train
File "C:UsersashesDesktopbloodyolov5modelsyolo.py", line 120, in forward_once
x = m(x) # run
File "C:Usersashesanaconda3envspytorchlibsite-packagestorchnnmodulesmodule.py", line 722, in _call_impl
result = self.forward(input, *kwargs)
File "C:UsersashesDesktopbloodyolov5modelsyolo.py", line 27, in forward
x[i] = self.mi # conv
File "C:Usersashesanaconda3envspytorchlibsite-packagestorchnnmodulescontainer.py", line 164, in __getitem__
return self._modules[self._get_abs_string_index(idx)]
File "C:Usersashesanaconda3envspytorchlibsite-packagestorchnnmodulescontainer.py", line 154, in _get_abs_string_index
raise IndexError('index {} is out of range'.format(idx))
IndexError: index 0 is out of range
I think there might be a problem with the data, try with your own dataset and it should work. Or test with the default minst dataset
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。