YOLOv11训练时出现'No Labels found in cache'错误的解决求助
YOLOv11训练时出现'No Labels found in cache'错误的解决求助
嘿,各位大佬!我现在在Google Colab上用YOLOv11训练一个坦克分类模型(一共9个标签),遇到了个棘手的问题,想请大家帮忙排查下~
我从Roboflow上下载了坦克数据集,用的是网站提供的下载代码,数据集的文件夹结构如图所示:
我的初始化代码是这样的:
!mkdir {HOME}/datasets %cd {HOME}/datasets from google.colab import userdata from roboflow import Roboflow ROBOFLOW_API_KEY = userdata.get('ROBOFLOW_API_KEY') rf = Roboflow(api_key=ROBOFLOW_API_KEY) workspace = rf.workspace("liangdianzhong") project = rf.workspace("capstoneproject").project("russian-military-annotated") version = project.version(4) dataset = version.download("yolov11")
接着运行训练命令:
%cd {HOME} !yolo task=detect mode=train model=yolo11s.pt data={dataset.location}/data.yaml epochs=1 batch=60 imgsz=640 plots=True
结果训练时抛出了警告,最后验证集的指标全为0,错误日志如下:
Transferred 493/499 items from pretrained weights TensorBoard: Start with 'tensorboard --logdir runs/detect/train7', view at http://localhost:6006/ Freezing layer 'model.23.dfl.conv.weight' AMP: running Automatic Mixed Precision (AMP) checks... AMP: checks passed ✅ train: Scanning /content/datasets/Russian-military-annotated-4/train/labels... 1026 images, 33 backgrounds, 0 corrupt: 100% 1026/1026 [00:00<00:00, 1995.16it/s] train: New cache created: /content/datasets/Russian-military-annotated-4/train/labels.cache albumentations: Blur(p=0.01, blur_limit=(3, 7)), MedianBlur(p=0.01, blur_limit=(3, 7)), ToGray(p=0.01, num_output_channels=3, method='weighted_average'), CLAHE(p=0.01, clip_limit=(1.0, 4.0), tile_grid_size=(8, 8)) val: Scanning /content/datasets/Russian-military-annotated-4/valid/labels... 9 images, 9 backgrounds, 0 corrupt: 100% 9/9 [00:00<00:00, 1585.35it/s] val: New cache created: /content/datasets/Russian-military-annotated-4/valid/labels.cache WARNING ⚠️ No labels found in /content/datasets/Russian-military-annotated-4/valid/labels.cache, training may not work correctly. See https://docs.ultralytics.com/datasets for dataset formatting guidance. Plotting labels to runs/detect/train7/labels.jpg... optimizer: 'optimizer=auto' found, ignoring 'lr0=0.01' and 'momentum=0.937' and determining best 'optimizer', 'lr0' and 'momentum' automatically... optimizer: AdamW(lr=0.000714, momentum=0.9) with parameter groups 81 weight(decay=0.0), 88 weight(decay=0.00046875), 87 bias(decay=0.0) TensorBoard: model graph visualization added ✅ Image sizes 640 train, 640 val Using 2 dataloader workers Logging results to runs/detect/train7 Starting training for 1 epochs... Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size 1/1 15.2G 1.125 5.288 1.594 18 640: 100% 18/18 [00:22<00:00, 1.24s/it] Class Images Instances Box(P R mAP50 mAP50-95): 100% 1/1 [00:00<00:00, 1.50it/s] all 9 0 0 0 0 0 WARNING ⚠️ no labels found in detect set, can not compute metrics without labels
我现在有点懵,不知道为啥验证集找不到标签,训练集明明是正常的。有没有大佬能指点下怎么解决这个问题呀?
备注:内容来源于stack exchange,提问作者myts999
相关产品推荐
相关产品推荐

