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

Added yolov9 compatibility #1010

Closed
wants to merge 11 commits into from
Closed

Added yolov9 compatibility #1010

wants to merge 11 commits into from

Conversation

Hamzalopode
Copy link
Contributor

Added Yolov9 compatibility:

  • Yolov9 model download for E & C
  • Yolov9 process ( same as yolov8 )

Other model size and demo predict will be added with time.

@fcakyon
Copy link
Collaborator

fcakyon commented Apr 8, 2024

Amazing contribution @Hamzalopode! 🚀

Please fix the errors raised in tests by:

  • Install required development packages:
pip install -e ."[dev]"
  • Reformat with black and isort:
python -m scripts.run_code_style format
  • Commit and push 💯

Hamza Ahmouny and others added 2 commits April 8, 2024 16:18
@Hamzalopode
Copy link
Contributor Author

Thanks @fcakyon !

I think everything looks good now. Let me know if there is anything else.

🚀

@fcakyon
Copy link
Collaborator

fcakyon commented Apr 8, 2024

@Hamzalopode for some reason, you updated all the prior notebook files. Can you please revert these changes?

Other than that all seems OK 🚀

@Hamzalopode
Copy link
Contributor Author

Done.

Sorry I thought that applying the styling format for the notebooks was a good idea.

@GuillaumeBruand
Copy link
Contributor

@Hamzalopode
Can we add one level of abstraction to integrate common features between yolov8 and yolov9 (see e.g. PR #988)
As far as I know there is full compatibility between the two models.

@Hamzalopode
Copy link
Contributor Author

Fixed merge conflict between the two branch.

@eniktab
Copy link

eniktab commented Jul 2, 2024

getting the following error when trying to use

TypeError: ERROR ❌️ ../weights/best.pt appears to be an Ultralytics YOLOv5 model originally trained with https://github.com/ultralytics/yolov5.
This model is NOT forwards compatible with YOLOv8 at https://github.com/ultralytics/ultralytics.
Recommend fixes are to train a new model using the latest 'ultralytics' package or to run a command with an official Ultralytics model, i.e. 'yolo predict model=yolov8n.pt'

The training was like

train_dual.py --sync-bn ---img 640 --cfg models/detect/yolov9-c.yaml --weights '' --name yolov9-c --hyp hyp.scratch-high.yaml

@weertman
Copy link

Interested in using yolov9 but cannot figure out how to get this to work. I have a custom yolov9-e model and its yaml but I cannot find any documentation on how to use it with SAHI. I've been butting my head against this for a bit and wondering if this has had any progress.

@obss obss deleted a comment from froth0203 Mar 6, 2025
@fcakyon
Copy link
Collaborator

fcakyon commented Mar 6, 2025

@weertman @eniktab @Hamzalopode @GuillaumeBruand

Have you tried this with the latest sahi release? It should be working:

detection_model = AutoDetectionModel.from_pretrained(
    model_type='ultralytics',
    model_path='yolov9e.pt',
    confidence_threshold=0.3,
    device="cpu", # or 'cuda:0'
)

@Hamzalopode
Copy link
Contributor Author

@weertman @eniktab @Hamzalopode @GuillaumeBruand

Have you tried this with the latest sahi release? It should be working:

detection_model = AutoDetectionModel.from_pretrained(
    model_type='ultralytics',
    model_path='yolov9e.pt',
    confidence_threshold=0.3,
    device="cpu", # or 'cuda:0'
)

This is an old fork (11mo old) when yolov9 just came out and wasn't in sahi at that time, I implemented it for my self-use.

I will take a look again on what I did and see if it's deprecated or already implemented.

@GuillaumeBruand
Copy link
Contributor

GuillaumeBruand commented Mar 6, 2025

@fcakyon @Hamzalopode I am now using sahi with yolov11 and it seems that no additional change is required in the main branch to work properly (just use the yolov8 base class).
To avoid code duplication I recommand refactoring this PR for multiple yolo-vX variations.

@Hamzalopode Hamzalopode closed this Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants