THU-MIG / yolov10

YOLOv10: Real-Time End-to-End Object Detection [NeurIPS 2024]
https://arxiv.org/abs/2405.14458
GNU Affero General Public License v3.0
9.91k stars 978 forks source link

(TypeError: list indicators must be integers or slices, not str) This issue cannot be resolved. Dear developer, can you provide a solution. #370

Open KaiChenNJ opened 3 months ago

KaiChenNJ commented 3 months ago

D:\anaconda\envs\chat\python.exe D:/biyesheji/yolov10/yolov10/yolov10/yolov10-main/train.py New https://pypi.org/project/ultralytics/8.2.66 available πŸ˜ƒ Update with 'pip install -U ultralytics' Ultralytics YOLOv8.1.34 πŸš€ Python-3.9.16 torch-2.0.1 CUDA:0 (NVIDIA GeForce RTX 2070, 8192MiB) engine\trainer: task=detect, mode=train, model=D:\biyesheji\yolov10\yolov10\yolov10\yolov10-main\yolov8n.pt, data=D:\biyesheji\yolov10\yolov10\yolov10\xray\data.yaml, epochs=500, time=None, patience=100, batch=8, imgsz=640, save=True, save_period=-1, val_period=1, cache=False, device=0, workers=0, project=None, name=train_yolov10s14, exist_ok=False, pretrained=True, optimizer=auto, verbose=True, seed=0, deterministic=True, single_cls=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, amp=True, fraction=1.0, profile=False, freeze=None, multi_scale=False, overlap_mask=True, mask_ratio=4, dropout=0.0, val=True, split=val, save_json=False, save_hybrid=False, conf=None, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=None, vid_stride=1, stream_buffer=False, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, embed=None, show=False, save_frames=False, save_txt=False, save_conf=False, save_crop=False, show_labels=True, show_conf=True, show_boxes=True, line_width=None, format=torchscript, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=None, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, pose=12.0, kobj=1.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, bgr=0.0, mosaic=1.0, mixup=0.0, copy_paste=0.0, auto_augment=randaugment, erasing=0.4, crop_fraction=1.0, cfg=None, tracker=botsort.yaml, save_dir=runs\detect\train_yolov10s14 Overriding model.yaml nc=80 with nc=12

               from  n    params  module                                       arguments                     

0 -1 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2]
1 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2]
2 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True]
3 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
4 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True]
5 -1 1 73984 ultralytics.nn.modules.conv.Conv [64, 128, 3, 2]
6 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
7 -1 1 295424 ultralytics.nn.modules.conv.Conv [128, 256, 3, 2]
8 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True]
9 -1 1 164608 ultralytics.nn.modules.block.SPPF [256, 256, 5]
10 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
11 [-1, 6] 1 0 ultralytics.nn.modules.conv.Concat [1]
12 -1 1 148224 ultralytics.nn.modules.block.C2f [384, 128, 1]
13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
14 [-1, 4] 1 0 ultralytics.nn.modules.conv.Concat [1]
15 -1 1 37248 ultralytics.nn.modules.block.C2f [192, 64, 1]
16 -1 1 36992 ultralytics.nn.modules.conv.Conv [64, 64, 3, 2]
17 [-1, 12] 1 0 ultralytics.nn.modules.conv.Concat [1]
18 -1 1 123648 ultralytics.nn.modules.block.C2f [192, 128, 1]
19 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2]
20 [-1, 9] 1 0 ultralytics.nn.modules.conv.Concat [1]
21 -1 1 493056 ultralytics.nn.modules.block.C2f [384, 256, 1]
22 [15, 18, 21] 1 753652 ultralytics.nn.modules.head.Detect [12, [64, 128, 256]]
Model summary: 225 layers, 3013188 parameters, 3013172 gradients, 8.2 GFLOPs

Transferred 319/355 items from pretrained weights Freezing layer 'model.22.dfl.conv.weight' AMP: running Automatic Mixed Precision (AMP) checks with YOLOv8n... AMP: checks passed βœ… train: Scanning D:\biyesheji\yolov10\yolov10\yolov10\xray\labels\train.cache... 135 images, 2 backgrounds, 0 corrupt: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 135/135 [00:00<?, ?it/s] val: Scanning D:\biyesheji\yolov10\yolov10\yolov10\xray\labels\val.cache... 34 images, 1 backgrounds, 0 corrupt: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 34/34 [00:00<?, ?it/s] Plotting labels to runs\detect\train_yolov10s14\labels.jpg... 0%| | 0/17 [00:00<?, ?it/s]module 'backend_interagg' has no attribute 'FigureCanvas' optimizer: 'optimizer=auto' found, ignoring 'lr0=0.01' and 'momentum=0.937' and determining best 'optimizer', 'lr0' and 'momentum' automatically... optimizer: AdamW(lr=0.000625, momentum=0.9) with parameter groups 57 weight(decay=0.0), 64 weight(decay=0.0005), 63 bias(decay=0.0) Image sizes 640 train, 640 val Using 0 dataloader workers Logging results to runs\detect\train_yolov10s14 Starting training for 500 epochs...

  Epoch    GPU_mem     box_om     cls_om     dfl_om     box_oo     cls_oo     dfl_oo  Instances       Size

0%| | 0/17 [00:00<?, ?it/s] Traceback (most recent call last): File "D:\biyesheji\yolov10\yolov10\yolov10\yolov10-main\train.py", line 31, in results = model.train(data=data_yaml_path, File "D:\biyesheji\yolov10\yolov10\yolov10\yolov10-main\ultralytics\engine\model.py", line 657, in train self.trainer.train() File "D:\biyesheji\yolov10\yolov10\yolov10\yolov10-main\ultralytics\engine\trainer.py", line 213, in train self._do_train(world_size) File "D:\biyesheji\yolov10\yolov10\yolov10\yolov10-main\ultralytics\engine\trainer.py", line 381, in _do_train self.loss, self.loss_items = self.model(batch) File "D:\anaconda\envs\chat\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, *kwargs) File "D:\biyesheji\yolov10\yolov10\yolov10\yolov10-main\ultralytics\nn\tasks.py", line 93, in forward return self.loss(x, args, **kwargs) File "D:\biyesheji\yolov10\yolov10\yolov10\yolov10-main\ultralytics\nn\tasks.py", line 275, in loss return self.criterion(preds, batch) File "D:\biyesheji\yolov10\yolov10\yolov10\yolov10-main\ultralytics\utils\loss.py", line 726, in call one2many = preds["one2many"] TypeError: list indices must be integers or slices, not str

Process finished with exit code 1

wys2641970184 commented 3 months ago

Pls check your weight file, maybe use old

long1109 commented 3 months ago

I have a same below issue while training Yolov10 with default configuration.

Jazzy0302 commented 3 months ago

i have the same problem,how to solve it

lowhuang commented 1 month ago

me too

WoWoGG commented 4 weeks ago

yolov8 ranther than yolov10! you should

from ultralytics import YOLO if name == 'main': model = YOLO(model=r'D:\pythonProject5\ultralytics\cfg\models\v8\yolov8n-p2.yaml')

not

from ultralytics import YOLOv10

if name == 'main': model = YOLOv10(model=r'D:\pythonProject5\ultralytics\cfg\models\v8\yolov8n-p2.yaml')

WoWoGG commented 4 weeks ago

actually, one2many = preds["one2many"] looks only in yolov10