Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError on Yolov8 training instance segmentation #105

Closed
2 tasks done
pippo97-jpg opened this issue Apr 27, 2023 · 4 comments
Closed
2 tasks done

RuntimeError on Yolov8 training instance segmentation #105

pippo97-jpg opened this issue Apr 27, 2023 · 4 comments
Assignees
Labels
bug Something isn't working onsite The change was suggested during an initiative on a company onsite

Comments

@pippo97-jpg
Copy link

Search before asking

  • I have searched the Roboflow Notebooks issues and found no similar bug report.

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?

  • Yes I'd like to help by submitting a PR!
@pippo97-jpg pippo97-jpg added the bug Something isn't working label Apr 27, 2023
@github-actions
Copy link

👋 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 SkalskiP self-assigned this May 2, 2023
@SkalskiP
Copy link
Collaborator

SkalskiP commented May 5, 2023

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
Copy link
Author

pippo97-jpg commented May 11, 2023 via email

@LinasKo
Copy link
Collaborator

LinasKo commented Oct 24, 2024

We've recently verified the required versions of yolov8 needed to train, validate, deploy and infer with the model. I'm closing this now. Do let us know if there's any further issues!

@LinasKo LinasKo closed this as completed Oct 24, 2024
@LinasKo LinasKo added the onsite The change was suggested during an initiative on a company onsite label Oct 24, 2024
@LinasKo LinasKo self-assigned this Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working onsite The change was suggested during an initiative on a company onsite
Projects
None yet
Development

No branches or pull requests

3 participants