roboflow / notebooks

Examples and tutorials on using SOTA computer vision models and techniques. Learn everything from old-school ResNet, through YOLO and object-detection transformers like DETR, to the latest models like Grounding DINO and SAM.
https://roboflow.com/models
4.76k stars 742 forks source link

Error download LOCO dataset using mt-yolov6 format #270

Open vidaldani opened 2 months ago

vidaldani commented 2 months ago

Search before asking

Notebook name

train-yolov6-object-detection-on-custom-data.ipynb

Bug

When I try to download the LOCO dataset in mt-yolov6 format I get the following error for all the training labels.

WARNING: LOCO-ROBOFLOW-3/labels/train/997935-8254_jpg.rf.0c48370dc703a5f0fb7d15e50253fac1.txt: ignoring invalid labels: LOCO-ROBOFLOW-3/labels/train/997935-8254_jpg.rf.0c48370dc703a5f0fb7d15e50253fac1.txt: wrong label format
Traceback (most recent call last):
  File "/content/YOLOv6/YOLOv6/tools/train.py", line 143, in <module>
    main(args)
  File "/content/YOLOv6/YOLOv6/tools/train.py", line 128, in main
    trainer = Trainer(args, cfg, device)
  File "/content/YOLOv6/YOLOv6/yolov6/core/engine.py", line 91, in __init__
    self.train_loader, self.val_loader = self.get_data_loader(self.args, self.cfg, self.data_dict)
  File "/content/YOLOv6/YOLOv6/yolov6/core/engine.py", line 387, in get_data_loader
    train_loader = create_dataloader(train_path, args.img_size, args.batch_size // args.world_size, grid_size,
  File "/content/YOLOv6/YOLOv6/yolov6/data/data_load.py", line 46, in create_dataloader
    dataset = TrainValDataset(
  File "/content/YOLOv6/YOLOv6/yolov6/data/datasets.py", line 82, in __init__
    self.img_paths, self.labels = self.get_imgs_labels(self.img_dir)
  File "/content/YOLOv6/YOLOv6/yolov6/data/datasets.py", line 433, in get_imgs_labels
    img_paths, labels = list(
ValueError: not enough values to unpack (expected 2, got 0)

Therefore the model never trains

Environment

Google Collab GPU T4

Minimal Reproducible Example

!git clone https://github.com/meituan/YOLOv6
%cd YOLOv6
!pip install -r requirements.txt
!pip install roboflow

from roboflow import Roboflow
rf = Roboflow(api_key="api-key")
project = rf.workspace("loco-fml").project("loco-fml")
version = project.version(3)
dataset = version.download("mt-yolov6")
!python tools/train.py --batch 32 --conf configs/yolov6s.py --epochs 100 --img-size 416 --data {dataset.location}/data.yaml --device 0 

Additional

The format obtained has 8 values instead of 4:

1 0.995417 0.702962962962963 0.995417 0.95639 0.735 0.95639 0.735 0.702962962

Are you willing to submit a PR?