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

How to track with a modified yoloV8 detection model? #1415

Closed
1 task done
Gump1111 opened this issue May 6, 2024 · 11 comments
Closed
1 task done

How to track with a modified yoloV8 detection model? #1415

Gump1111 opened this issue May 6, 2024 · 11 comments
Labels
question Further information is requested Stale

Comments

@Gump1111
Copy link

Gump1111 commented May 6, 2024

Search before asking

  • I have searched the Yolo Tracking issues and found no similar bug report.

Question

Hi Author! Really thanks for your great job!
I have a question there, if I modify the YOLOv8's structure ,for example ,I add the CBAM attention into YOLOv8, and got a model best.pt after trained it with my dataset. Since I have changed the yolov8.yaml, Could I directly set the argument "--yolo-model" as " best.pt" and execute track.py?

@Gump1111 Gump1111 added the question Further information is requested label May 6, 2024
@mikel-brostrom
Copy link
Owner

Not sure, have not tried to run any such experiment 😄

@TYPXT
Copy link

TYPXT commented May 8, 2024

I tried loading a model trained on another dataset, and at first the error told me that the model name needed to be chosen between YOLOv8, YOLO-NAS, and YOLOX, so I changed my best.pt file to "yolov8u.pt" and the algorithm worked, and it felt like it was lying to it saying: "This is yolov8.pt, go train". Maybe you could try something like this?

@Gump1111
Copy link
Author

Gump1111 commented May 8, 2024

Not sure, have not tried to run any such experiment 😄

All right, still thanks a lot!

@Gump1111
Copy link
Author

Gump1111 commented May 8, 2024

I tried loading a model trained on another dataset, and at first the error told me that the model name needed to be chosen between YOLOv8, YOLO-NAS, and YOLOX, so I changed my best.pt file to "yolov8u.pt" and the algorithm worked, and it felt like it was lying to it saying: "This is yolov8.pt, go train". Maybe you could try something like this?

Thank you very much, friend. Have you modified your detection model's structure like I said, adding some modules, I don't know whether it is compatible with a weight created from a modified model. But whatever, I'll try. Thanks

@TYPXT
Copy link

TYPXT commented May 8, 2024

I tried loading a model trained on another dataset, and at first the error told me that the model name needed to be chosen between YOLOv8, YOLO-NAS, and YOLOX, so I changed my best.pt file to "yolov8u.pt" and the algorithm worked, and it felt like it was lying to it saying: "This is yolov8.pt, go train". Maybe you could try something like this?

Thank you very much, friend. Have you modified your detection model's structure like I said, adding some modules, I don't know whether it is compatible with a weight created from a modified model. But whatever, I'll try. Thanks

Not yet, but I may try it in the near future.😄I think it should work after synchronizing the modified model structure code to the files under ultralytics/nn/ used by yolo_track.

@TYPXT
Copy link

TYPXT commented May 11, 2024

Oh, I'm very happy to tell you that I did it. Using the same method I used to build the model, which was to change the relevant files under ultralytics/nn/, I managed to get the model loaded, running properly and outputting track results. I replaced the entire YOLOv8 backbone with the Swin Transformer and implemented tracking, which proves that it is possible to use the modified detection model, but of course, I used the name "yolov8o.pt" to fool the algorithm when running the track.py file, just as I said before.

@Gump1111
Copy link
Author

Oh, I'm very happy to tell you that I did it. Using the same method I used to build the model, which was to change the relevant files under ultralytics/nn/, I managed to get the model loaded, running properly and outputting track results. I replaced the entire YOLOv8 backbone with the Swin Transformer and implemented tracking, which proves that it is possible to use the modified detection model, but of course, I used the name "yolov8o.pt" to fool the algorithm when running the track.py file, just as I said before.

What great news, congratulations, my friend! Did you modify the structure and train it on the official YOLOv8 github, then get "yolov8o.pt", and then directly assign the value "yolov8o.pt" in the author Mikel's track.py code? Because I found that Mikel's code file does not have the ultralytics folder. Thank you again and I hope your research will be successful!

@TYPXT
Copy link

TYPXT commented May 11, 2024

Oh, I'm very happy to tell you that I did it. Using the same method I used to build the model, which was to change the relevant files under ultralytics/nn/, I managed to get the model loaded, running properly and outputting track results. I replaced the entire YOLOv8 backbone with the Swin Transformer and implemented tracking, which proves that it is possible to use the modified detection model, but of course, I used the name "yolov8o.pt" to fool the algorithm when running the track.py file, just as I said before.

What great news, congratulations, my friend! Did you modify the structure and train it on the official YOLOv8 github, then get "yolov8o.pt", and then directly assign the value "yolov8o.pt" in the author Mikel's track.py code? Because I found that Mikel's code file does not have the ultralytics folder. Thank you again and I hope your research will be successful!

Yes! My detailed steps were like this:
I created a virtual environment on a linux server, pulled the YOLOv8 source code from the official Github, and modified the files inside my virtual environment, the exact path of the file I modified is "anaconda/envs/track/Lib/site-packages/ultralytics/nn/", because inside the virtual environment The code under this path is called first, so the modifications under ultralytics/ultralytics/nn/ will not work.
I then trained using the model with the modified structure, got the best.pt file and renamed it yolov8o.pt, and inside the track.py file modified "parser.add_argument('--yolo-model', type=Path, default= WEIGHTS / 'absolute path/to/yolov8o.pt',help='yolo model path')" in the track.py file and run track.py in the terminal, then it can run successfully.

@Gump1111
Copy link
Author

Oh, I'm very happy to tell you that I did it. Using the same method I used to build the model, which was to change the relevant files under ultralytics/nn/, I managed to get the model loaded, running properly and outputting track results. I replaced the entire YOLOv8 backbone with the Swin Transformer and implemented tracking, which proves that it is possible to use the modified detection model, but of course, I used the name "yolov8o.pt" to fool the algorithm when running the track.py file, just as I said before.

What great news, congratulations, my friend! Did you modify the structure and train it on the official YOLOv8 github, then get "yolov8o.pt", and then directly assign the value "yolov8o.pt" in the author Mikel's track.py code? Because I found that Mikel's code file does not have the ultralytics folder. Thank you again and I hope your research will be successful!

Yes! My detailed steps were like this: I created a virtual environment on a linux server, pulled the YOLOv8 source code from the official Github, and modified the files inside my virtual environment, the exact path of the file I modified is "anaconda/envs/track/Lib/site-packages/ultralytics/nn/", because inside the virtual environment The code under this path is called first, so the modifications under ultralytics/ultralytics/nn/ will not work. I then trained using the model with the modified structure, got the best.pt file and renamed it yolov8o.pt, and inside the track.py file modified "parser.add_argument('--yolo-model', type=Path, default= WEIGHTS / 'absolute path/to/yolov8o.pt',help='yolo model path')" in the track.py file and run track.py in the terminal, then it can run successfully.

Friend, you are awesome! I will follow in your footsteps and continue my work. Wish you all the best!

@TYPXT
Copy link

TYPXT commented May 11, 2024

Oh, I'm very happy to tell you that I did it. Using the same method I used to build the model, which was to change the relevant files under ultralytics/nn/, I managed to get the model loaded, running properly and outputting track results. I replaced the entire YOLOv8 backbone with the Swin Transformer and implemented tracking, which proves that it is possible to use the modified detection model, but of course, I used the name "yolov8o.pt" to fool the algorithm when running the track.py file, just as I said before.

What great news, congratulations, my friend! Did you modify the structure and train it on the official YOLOv8 github, then get "yolov8o.pt", and then directly assign the value "yolov8o.pt" in the author Mikel's track.py code? Because I found that Mikel's code file does not have the ultralytics folder. Thank you again and I hope your research will be successful!

Yes! My detailed steps were like this: I created a virtual environment on a linux server, pulled the YOLOv8 source code from the official Github, and modified the files inside my virtual environment, the exact path of the file I modified is "anaconda/envs/track/Lib/site-packages/ultralytics/nn/", because inside the virtual environment The code under this path is called first, so the modifications under ultralytics/ultralytics/nn/ will not work. I then trained using the model with the modified structure, got the best.pt file and renamed it yolov8o.pt, and inside the track.py file modified "parser.add_argument('--yolo-model', type=Path, default= WEIGHTS / 'absolute path/to/yolov8o.pt',help='yolo model path')" in the track.py file and run track.py in the terminal, then it can run successfully.

Friend, you are awesome! I will follow in your footsteps and continue my work. Wish you all the best!

I'm glad I could help you and wish you success, my friend!😄

Copy link

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

@github-actions github-actions bot added the Stale label May 22, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

3 participants