JiayuanWang-JW / YOLOv8-multi-task

GNU Affero General Public License v3.0
242 stars 42 forks source link

The Iou of Lane is 0 #89

Open realTravisYou opened 6 days ago

realTravisYou commented 6 days ago

image I've trained over 100 epochs, but this IOU value is still 0. What is the problem? Thank you! Here is my train file setting. 'import sys sys.path.insert(0, "/public/home/Travis/mnt/yt/YOLOv8-multi-task/ultralytics")

from ultralytics import YOLO

model = YOLO('/public/home/Travis/mnt/yt/YOLOv8-multi-task/ultralytics/models/v8/yolov8-bdd-v4-one-dropout-individual-n.yaml', task='multi') # build a new model from YAML

model.train(data='/public/home/Travis/mnt/yt/YOLOv8-multi-task/ultralytics/datasets/bdd-multi.yaml', batch=256, epochs=300, imgsz=640, device=(0,1,2,3), name='yolopm_represent', val=True, task='multi',classes=[2,3,4,9,10,11],combine_class=[2,3,4,9],single_cls=True) '

loganwu0526 commented 4 days ago

I have the same issue when the model is too small, but I already modify the original architecture and use my custom dataset

realTravisYou commented 4 days ago

I have the same issue when the model is too small, but I already modify the original architecture and use my custom dataset

I want to reproduce the result of the paper, could you tell me how to modify the architecture to solve the problem? Thank you.

JiayuanWang-JW commented 2 days ago

image I've trained over 100 epochs, but this IOU value is still 0. What is the problem? Thank you! Here is my train file setting. 'import sys sys.path.insert(0, "/public/home/Travis/mnt/yt/YOLOv8-multi-task/ultralytics")

from ultralytics import YOLO

model = YOLO('/public/home/Travis/mnt/yt/YOLOv8-multi-task/ultralytics/models/v8/yolov8-bdd-v4-one-dropout-individual-n.yaml', task='multi') # build a new model from YAML

model.train(data='/public/home/Travis/mnt/yt/YOLOv8-multi-task/ultralytics/datasets/bdd-multi.yaml', batch=256, epochs=300, imgsz=640, device=(0,1,2,3), name='yolopm_represent', val=True, task='multi',classes=[2,3,4,9,10,11],combine_class=[2,3,4,9],single_cls=True) '

Hi, I think maybe the reason is your batch size is too large. If you want to reproduce my result, try this training code. Please feedback if there are any issues, thanks.

import sys
sys.path.insert(0, "/home/jiayuan/code/yolov8_v4/ultralytics")

from ultralytics import YOLO

# Load a model
model = YOLO('/home/jiayuan/code/yolov8_v4/ultralytics/models/v8/yolov8-bdd-v4-one-dropout-individual-m.yaml', task='multi')  # build a new model from YAML
# model = YOLO('yolov8n.pt')  # load a pretrained model (recommended for training)
# model = YOLO('yolov8n.yaml').load('yolov8n.pt')  # build from YAML and transfer weights

# Train the model
model.train(data='/home/jiayuan/code/yolov8_v4/ultralytics/datasets/bdd-multi.yaml', batch=54, epochs=300, imgsz=(640,640), device=[0,1,2], name='v4m-individual_640', val=True, task='multi',classes=[2,3,4,9,10,11],combine_class=[2,3,4,9],single_cls=True)
realTravisYou commented 18 hours ago

image I've trained over 100 epochs, but this IOU value is still 0. What is the problem? Thank you! Here is my train file setting. 'import sys sys.path.insert(0, "/public/home/Travis/mnt/yt/YOLOv8-multi-task/ultralytics") from ultralytics import YOLO model = YOLO('/public/home/Travis/mnt/yt/YOLOv8-multi-task/ultralytics/models/v8/yolov8-bdd-v4-one-dropout-individual-n.yaml', task='multi') # build a new model from YAML model.train(data='/public/home/Travis/mnt/yt/YOLOv8-multi-task/ultralytics/datasets/bdd-multi.yaml', batch=256, epochs=300, imgsz=640, device=(0,1,2,3), name='yolopm_represent', val=True, task='multi',classes=[2,3,4,9,10,11],combine_class=[2,3,4,9],single_cls=True) '

Hi, I think maybe the reason is your batch size is too large. If you want to reproduce my result, try this training code. Please feedback if there are any issues, thanks.

import sys
sys.path.insert(0, "/home/jiayuan/code/yolov8_v4/ultralytics")

from ultralytics import YOLO

# Load a model
model = YOLO('/home/jiayuan/code/yolov8_v4/ultralytics/models/v8/yolov8-bdd-v4-one-dropout-individual-m.yaml', task='multi')  # build a new model from YAML
# model = YOLO('yolov8n.pt')  # load a pretrained model (recommended for training)
# model = YOLO('yolov8n.yaml').load('yolov8n.pt')  # build from YAML and transfer weights

# Train the model
model.train(data='/home/jiayuan/code/yolov8_v4/ultralytics/datasets/bdd-multi.yaml', batch=54, epochs=300, imgsz=(640,640), device=[0,1,2], name='v4m-individual_640', val=True, task='multi',classes=[2,3,4,9,10,11],combine_class=[2,3,4,9],single_cls=True)

Thank you for your kind reply, but I got the same result following your reply. image And my setting is

import sys
sys.path.insert(0, "/public/home/travis/YOLOv8-multi-task/ultralytics")

from ultralytics import YOLO

# Load a model
model = YOLO('/public/home/travis/YOLOv8-multi-task/ultralytics/models/v8/yolov8-bdd-v4-one-dropout-individual-n.yaml', task='multi')  # build a new model from YAML
# model = YOLO('yolov8n.pt')  # load a pretrained model (recommended for training)
# model = YOLO('yolov8n.yaml').load('yolov8n.pt')  # build from YAML and transfer weights

# Train the model
model.train(data='/public/home/travis/YOLOv8-multi-task/ultralytics/datasets/bdd-multi.yaml', batch=54, epochs=300, imgsz=640, device=[0,1,2], name='v4m-individual_640', val=True, task='multi',classes=[2,3,4,9,10,11],combine_class=[2,3,4,9],single_cls=True)
JiayuanWang-JW commented 15 hours ago

@realTravisYou This is interesting, this morning, I cloned this Repo to my server and training again. It works. I have trained 3 epochs for n scale model so far and I get the expected IoU for Lane. image

My training code is as below:

import sys
sys.path.insert(0, "/home/jiayuan/code/yolom/YOLOv8-multi-task/ultralytics")
# 现在就可以导入Yolo类了
from ultralytics import YOLO

# Load a model
model = YOLO('/home/jiayuan/code/yolom/YOLOv8-multi-task/ultralytics/models/v8/yolov8-bdd-v4-one-dropout-individual-n.yaml', task='multi')  # build a new model from YAML
# model = YOLO('yolov8n.pt')  # load a pretrained model (recommended for training)
# model = YOLO('yolov8n.yaml').load('yolov8n.pt')  # build from YAML and transfer weights

# Train the model
model.train(data='/home/jiayuan/code/yolom/YOLOv8-multi-task/ultralytics/datasets/bdd-multi.yaml', batch=36, epochs=300, imgsz=(640,640), device=[0,1], name='v4n-individual_640', val=True, task='multi',classes=[2,3,4,9,10,11],combine_class=[2,3,4,9],single_cls=True)

I only changed the number of GPUs and batch size because I only have 2 GPUs that can be used now.

Could you provide more information about your running environment and please let me know how you installed the ultralytics: 'pip install -e .' or 'pip install ultralytics'?

realTravisYou commented 6 hours ago

@JiayuanWang-JW Hi, I don't know why this works. I used the following code(the version of s):

import sys
sys.path.insert(0, "/public/home/travis/YOLOv8-multi-task/ultralytics")

from ultralytics import YOLO

# Load a model
model = YOLO('/public/home/travis/YOLOv8-multi-task/ultralytics/models/v8/yolov8-bdd-v4-one-dropout-individual-s.yaml', task='multi')  # build a new model from YAML
# model = YOLO('yolov8n.pt')  # load a pretrained model (recommended for training)
# model = YOLO('yolov8n.yaml').load('yolov8n.pt')  # build from YAML and transfer weights

# Train the model
model.train(data='/public/home/travis/YOLOv8-multi-task/ultralytics/datasets/bdd-multi.yaml', batch=54, epochs=300, imgsz=(640,640), device=[0,1,2], name='v4m-individual_640', val=True, task='multi',classes=[2,3,4,9,10,11],combine_class=[2,3,4,9],single_cls=True)

image I am using CentOS, and my GPU model is A100 80G. The command I used was pip install -e. If I want to reproduce the results of a certain version of model m. Maybe I should try using a smaller batch size and two GPUs, as you suggested. Thank you for your patient response.

JiayuanWang-JW commented 5 hours ago

@JiayuanWang-JW Hi, I don't know why this works. I used the following code(the version of s):

import sys
sys.path.insert(0, "/public/home/travis/YOLOv8-multi-task/ultralytics")

from ultralytics import YOLO

# Load a model
model = YOLO('/public/home/travis/YOLOv8-multi-task/ultralytics/models/v8/yolov8-bdd-v4-one-dropout-individual-s.yaml', task='multi')  # build a new model from YAML
# model = YOLO('yolov8n.pt')  # load a pretrained model (recommended for training)
# model = YOLO('yolov8n.yaml').load('yolov8n.pt')  # build from YAML and transfer weights

# Train the model
model.train(data='/public/home/travis/YOLOv8-multi-task/ultralytics/datasets/bdd-multi.yaml', batch=54, epochs=300, imgsz=(640,640), device=[0,1,2], name='v4m-individual_640', val=True, task='multi',classes=[2,3,4,9,10,11],combine_class=[2,3,4,9],single_cls=True)

image I am using CentOS, and my GPU model is A100 80G. The command I used was pip install -e. If I want to reproduce the results of a certain version of model m. Maybe I should try using a smaller batch size and two GPUs, as you suggested. Thank you for your patient response.

@realTravisYou Thanks for your good news.

I compare your current code with the previous version. I think the difference is you change imgsz=(640,640) to imgsz=640. But this is not the reason to make lane IoU to 0. If you change other parts, please let me know. This will be helpful for other people. Thanks.

Actually, I use three 4090 GPUs with bs 120 to train the model for scale n as I mentioned in the paper. If you want to reproduce my results. Maybe you can follow my paper's parameters to train. If you have any issues, please reply to this issue and I will help you.