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.09k stars 788 forks source link

Sizes of tensors must match except in dimension 1. Expected size 57 but got size 0 for tensor number 1 in the list #84

Closed Caliphamin closed 1 year ago

Caliphamin commented 1 year ago

Search before asking

Notebook name

train-yolov8-instance-segmentation-on-custom-dataset

Bug

hello i want to instance segmentation with yolov8 but i've got this error and i am stuck here i use this command to run yolov8 !yolo task=segment mode=train model=yolov8m-seg.pt data={dataset.location}/data.yaml epochs=100 imgsz=1024 batch=8 my images width and height are 1024x1024 i get this error

Sizes of tensors must match except in dimension 1. Expected size 57 but got size 0 for tensor number 1 in the list. Sentry is attempting to send 1 pending error messages

also when i change image sizes or batch size the number of expected size changed in error

Environment

google colab

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

github-actions[bot] commented 1 year ago

👋 Hello @Caliphamin, 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, @Caliphamin 👋🏻! Could you share a link to the dataset you used?

Caliphamin commented 1 year ago

@SkalskiP sure https://app.roboflow.com/wall-9lypi/wall-floor-k0mnz/7

SkalskiP commented 1 year ago

Hi, @Caliphamin 👋🏻! I examined the issue. And I think I know the reason.

Roboflow allows you to use bounding boxes in segmentation projects. However YOLOv8 project does not allow for such flexibility. Because your image segmentation dataset contains boxes, it fails to load correctly. But... I tried to use your dataset for object detection training with this command:

!yolo task=segment mode=train model=yolov8s.pt data={dataset.location}/data.yaml epochs=3 imgsz=640

And it works. :tada: I know it is not e perfect solution, but given the current situation, I think it is best we can do it quickly.

SkalskiP commented 1 year ago

I'm closing that issue. Feel free to reopen it if needed.