ultralytics / ultralytics

Ultralytics YOLO11 🚀
https://docs.ultralytics.com
GNU Affero General Public License v3.0
32.09k stars 6.15k forks source link

Training problems yolov8 #16935

Open Sylarik opened 3 weeks ago

Sylarik commented 3 weeks ago

Search before asking

Question

Good afternoon I want to train the yolov8 model so that, apart from the classes it already detects, it can detect one more class. The problem I have is that when I train yolov8n.pt with a dataset of this new class, it forgets the 80 previous classes of yolo.

Is there any way for it to preserve the knowledge about those classes?

PS: I have tried many things like reinforcement training but nothing works for me.

Additional

predict_video.txt train.txt

Y-T-G commented 3 weeks ago

That's normal. You can try this. But it's not meant to be used to add classes perpetually.

https://y-t-g.github.io/tutorials/yolov8n-add-classes/

Sylarik commented 3 weeks ago

@Y-T-G Thank you for your answer. However, I had already seen this article and it has not solved anything, any other option?

361754100 commented 3 weeks ago

亲爱的,邮件已收到,谢谢!

Y-T-G commented 3 weeks ago

No. Unless you want to download the whole COCO dataset and train on it along with your class.

Sylarik commented 2 weeks ago

okey thank you!

Petros626 commented 2 weeks ago

@Sylarik can be closed as solved?

Sylarik commented 2 weeks ago

@Petros626 what do you mean?

Sylarik commented 2 weeks ago

I have not tested it yet, I am working on it. When I get a result I will write if it worked or not.

glenn-jocher commented 2 weeks ago

Great! Feel free to share your results or any questions you have along the way.

Sylarik commented 2 weeks ago

@Y-T-G I have managed to do it in google colab and it works, but now I need to do it in a linux machine through vs code. But I am having a lot of problems with the libraries and their versions. Does anyone have a requirement.txt?

Y-T-G commented 2 weeks ago

@Sylarik Do what? Add a head? You can download the notebook from Colab and run it and change the dataset directories. It's going to work the same.

Petros626 commented 2 weeks ago

@Y-T-G I have managed to do it in google colab and it works, but now I need to do it in a linux machine through vs code. But I am having a lot of problems with the libraries and their versions. Does anyone have a requirement.txt?

@Sylarik you mean this? Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

Sylarik commented 2 weeks ago

@Y-T-G @Petros626 finally the program works! I would like to know if I can do it with other sizes of yolo8, like yolov8m, what should I do?

Y-T-G commented 2 weeks ago

@Sylarik I still don't know what you're referring to by "it".

Sylarik commented 2 weeks ago

@Y-T-G I mean if you can create a new model but using a bigger size of yolo, not just yolov8n as one of the heads.

Petros626 commented 2 weeks ago

You want to switch the head of a bigger model to a tiny model for example? I mean the heads and it's architectures and typical for the model size.

Y-T-G commented 2 weeks ago

It's mentioned how to in the comments.

https://github.com/Y-T-G/Yasins-Keep/discussions/4#discussioncomment-9086157

Sylarik commented 2 weeks ago

@Y-T-G thank you very much! I had not seen it. Let's see if it works. ^^