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
5.29k stars 820 forks source link

RuntimeError on Yolov8 training instance segmentation #105

Open pippo97-jpg opened 1 year ago

pippo97-jpg commented 1 year ago

Search before asking

Notebook name

How-to-train-yolov8-instance-segmentation-on-custom-dataset.ipynb

Bug

Traceback (most recent call last): File "/usr/local/bin/yolo", line 8, in sys.exit(entrypoint()) File "/usr/local/lib/python3.9/dist-packages/ultralytics/yolo/cfg/init.py", line 266, in entrypoint getattr(model, mode)(**vars(cfg)) File "/usr/local/lib/python3.9/dist-packages/ultralytics/yolo/engine/model.py", line 214, in train self.trainer.train() File "/usr/local/lib/python3.9/dist-packages/ultralytics/yolo/engine/trainer.py", line 182, in train self._do_train(int(os.getenv("RANK", -1)), world_size) File "/usr/local/lib/python3.9/dist-packages/ultralytics/yolo/engine/trainer.py", line 301, in _do_train self.loss, self.loss_items = self.criterion(preds, batch) File "/usr/local/lib/python3.9/dist-packages/ultralytics/yolo/v8/segment/train.py", line 44, in criterion return self.compute_loss(preds, batch) File "/usr/local/lib/python3.9/dist-packages/ultralytics/yolo/v8/segment/train.py", line 85, in call targets = torch.cat((batch_idx, batch["cls"].view(-1, 1), batch["bboxes"]), 1) RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 49 but got size 0 for tensor number 1 in the list. Sentry is attempting to send 1 pending error messages Waiting up to 2 seconds

Environment

-Google colab -Python 3.9

Minimal Reproducible Example

%cd {HOME}

!yolo task=segment mode=train model=yolov8m-seg.pt data={dataset.location}/data.yaml epochs=25 imgsz=640

Additional

/content Downloading https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8m-seg.pt to yolov8m-seg.pt... 100% 52.4M/52.4M [00:05<00:00, 10.6MB/s] Ultralytics YOLOv8.0.28 🚀 Python-3.9.16 torch-2.0.0+cu118 CUDA:0 (Tesla T4, 15102MiB) yolo/engine/trainer: task=segment, mode=train, model=yolov8m-seg.pt, data=/content/datasets/Planeat-food-Instance-Segmentation-7/data.yaml, epochs=25, patience=50, batch=16, imgsz=640, save=True, cache=False, device=None, workers=8, project=None, name=None, exist_ok=False, pretrained=False, optimizer=SGD, verbose=True, seed=0, deterministic=True, single_cls=False, image_weights=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, overlap_mask=True, mask_ratio=4, dropout=0.0, val=True, save_json=False, save_hybrid=False, conf=None, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=None, show=False, save_txt=False, save_conf=False, save_crop=False, hide_labels=False, hide_conf=False, vid_stride=1, line_thickness=3, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, boxes=True, 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, fl_gamma=0.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, mosaic=1.0, mixup=0.0, copy_paste=0.0, cfg=None, v5loader=False, save_dir=runs/segment/train Downloading https://ultralytics.com/assets/Arial.ttf to /root/.config/Ultralytics/Arial.ttf... 100% 755k/755k [00:00<00:00, 843kB/s] 2023-04-27 15:34:30.199497: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-04-27 15:34:31.234140: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT Overriding model.yaml nc=80 with nc=121

Are you willing to submit a PR?

github-actions[bot] commented 1 year ago

👋 Hello @pippo97-jpg, thank you for leaving an issue on Roboflow Notebooks.

🐞 Bug reports

If you are filing a bug report, please be as detailed as possible. This will help us more easily diagnose and resolve the problem you are facing. To learn more about contributing, check out our Contributing Guidelines.

If you require support with custom code that is not part of Roboflow Notebooks, please reach out on the Roboflow Forum or on the GitHub Discussions page associated with this repository.

💬 Get in touch

Do you have more questions about Roboflow that we haven't responded to yet? Feel free to ask them on the Roboflow Discuss forum. Our developer advocates and community team actively respond to questions there.

To ask questions about Notebooks, head over to the GitHub Discussions section of this repository.

SkalskiP commented 1 year ago

Hi, @pippo97-jpg! We are working on a permanent solution for this issue. But in the meantime, could you share the link to the dataset that you were trying to use for training?

pippo97-jpg commented 1 year ago
HI, thanks for the reply and sorry if I answer only now…Sure, here the link to the dataset on roboflow, I think you can downloaded without problem, but tell me if you have any problem https://app.roboflow.com/tirocinio-oylk4/planeat-food-instance-segmentation/7 Inviato da Posta per Windows Da: Piotr SkalskiInviato: venerdì 5 maggio 2023 10:38A: roboflow/notebooksCc: pippo97-jpg; MentionOggetto: Re: [roboflow/notebooks] RuntimeError on Yolov8 training instance segmentation (Issue #105) Hi, @pippo97-jpg! We are working on a permanent solution for this issue. But in the meantime, could you share the link to the dataset that you were trying to use for training?—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>