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.63k stars 885 forks source link

Dimension Error #52

Closed fatihcihant closed 1 year ago

fatihcihant commented 1 year ago

Search before asking

Notebook name

train-yolov8-object-detection-on-custom-dataset.ipynb https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/train-yolov8-object-detection-on-custom-dataset.ipynb

Bug

When I run the training cell, I get the error in the image. train-yolov8-object-detection-on-custom-dataset ipynb adlı not defterinin kopyası - Colaboratory - Opera 24 01 2023 13_56_03

Environment

Google Colab

Minimal Reproducible Example

%cd {HOME}

!yolo task=detect mode=train model=yolov8s.pt data={dataset.location}/data.yaml epochs=25 imgsz=416

Additional

my ipynb link: https://colab.research.google.com/drive/1VyZulDnFdyZmz613v-nVc8gYuNCToz7s?usp=share_link

Are you willing to submit a PR?

github-actions[bot] commented 1 year ago

👋 Hello @fatihcihant, 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, @fatihcihant 👋🏻! I'm afraid the source of that issue lies in the YOLOv8 library, not our notebooks. We encountered that issue in the past, and they still could not find the source. I found a few issues already that mention the same exception:

For now, there is only a workaround, not a proper fix. It will train if you add v5loader=true to your training command.

!yolo task=detect \
mode=train \
model=/content/yolov8s.pt \
data=/content/datasets/Human-Dataset-v2-6/data.yaml \
epochs=50 \
imgsz=800 \
v5loader=true
assia855 commented 1 year ago

@SkalskiP thanks for sharing this tip. I face the same error as @fatihcihant and after adding v5loader=true it produces another error. Thanks for your help.

masks = batch["masks"].to(self.device).float() KeyError: 'masks'

SkalskiP commented 1 year ago

@assia855 / @fatihcihant I'm trying my best. Some problems are just impossible to solve by us. They need to be handled by the YOLOv8 team. I'm determined to help you all as much as I can.

@assia855 do you train object detection or instance segmentation model? Could you maybe share a link to your copy of the notebook?

assia855 commented 1 year ago

Thanks for your reply @SkalskiP I'm working locally to train instance segmentation model. Can you provide the link to the dataset that you train with it the model I would like to compare. For the label I should use polygon or rectangle please.

assia855 commented 1 year ago

it works for me now. First I launch the detection than I launch the segment and it works. Maybe @fatihcihant you can launch train with detect as task even if it doesn't interest you and then launch segment.

fatihcihant commented 1 year ago

Yes it works for me too. Thanks for help.