yolov9-onnx


Nameyolov9-onnx JSON
Version 0.8.0 PyPI version JSON
download
home_pageNone
SummaryRun YOLOv9 MIT model with ONNX Runtime
upload_time2024-09-15 08:34:10
maintainerNone
docs_urlNone
authorIbai Gorordo
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ONNX YOLOv9 MIT Object Detection
 Python scripts performing object detection using the YOLOv9 MIT model in ONNX.
 
![!ONNX YOLOv9 Object Detection](https://github.com/user-attachments/assets/a4237b6e-53f1-4c51-be3a-bd8369c1991c)

> [!CAUTION]
> I skipped adding the pad to the input image when resizing, which might affect the accuracy of the model if the input image has a different aspect ratio compared to the input size of the model. Always try to get an input size with a ratio close to the input images you will use.

## Requirements

 * Check the **requirements.txt** file.
 * For ONNX, if you have a NVIDIA GPU, then install the **onnxruntime-gpu**, otherwise use the **onnxruntime** library.

## Installation [![PyPI](https://img.shields.io/pypi/v/yolov9-onnx?color=2BAF2B)](https://pypi.org/project/yolov9-onnx/)

```bash
pip install yolov9-onnx
```
Or, clone this repository:
```bash
git clone https://github.com/ibaiGorordo/ONNX-YOLOv9-MIT-Object-Detection.git
cd ONNX-YOLOv9-MIT-Object-Detection
pip install -r requirements.txt
```
### ONNX Runtime
For Nvidia GPU computers:
`pip install onnxruntime-gpu`

Otherwise:
`pip install onnxruntime`

## ONNX model
- If the model file is not found in the models directory, it will be downloaded automatically from the [release page](https://github.com/ibaiGorordo/ONNX-YOLOv9-MIT-Object-Detection/releases/tag/0.1.0).
- Or, for exporting the models with a different input size, use the Google Colab notebook to convert the model: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1KPFC-BLL7i7kQJFYq-1JACFiTzPYyOsC?usp=sharing)
- **Available models**: 
  - **MIT:** v9-s_mit.onnx, v9-m_mit.onnx, v9-c_mit.onnx
  - **Official:** gelan-c.onnx, gelan-e.onnx, yolov9-c.onnx, yolov9-e.onnx

## Original YOLOv9 MIT model
The original YOLOv9 MIT model can be found in this repository: [YOLOv9 MIT Repository](https://github.com/WongKinYiu/YOLO)
- The License of the models is MIT license: [License](https://github.com/WongKinYiu/YOLO/blob/main/LICENSE)

## Usage
```python
import cv2
from yolov9 import YOLOv9, draw_detections

detector = YOLOv9("v9-c_mit.onnx")

img = cv2.imread("image.jpg")

class_ids, boxes, confidences = detector(img)

combined_img = draw_detections(img, boxes, confidences, class_ids)
cv2.imshow("Detections", combined_img)
cv2.waitKey(0)
```

## Examples

 * **Image inference**:
 ```
 python image_object_detection.py
 ```

 * **Webcam inference**:
 ```
 python webcam_object_detection.py
 ```

 * **Video inference**: https://youtu.be/X_XVkEqgCUM
 ```
 python video_object_detection.py
 ```

https://github.com/user-attachments/assets/71b3ef97-92ef-4ddb-a62c-5e52922a396d

## References:
* YOLOv9 MIT model: https://github.com/WongKinYiu/YOLO
* YOLOv9 model: https://github.com/WongKinYiu/yolov9

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "yolov9-onnx",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Ibai Gorordo",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/d2/1f/f02d2f7756649819a87a3e85803450a4b7de16f11be81a58f8c87586ab17/yolov9_onnx-0.8.0.tar.gz",
    "platform": null,
    "description": "# ONNX YOLOv9 MIT Object Detection\r\n Python scripts performing object detection using the YOLOv9 MIT model in ONNX.\r\n \r\n![!ONNX YOLOv9 Object Detection](https://github.com/user-attachments/assets/a4237b6e-53f1-4c51-be3a-bd8369c1991c)\r\n\r\n> [!CAUTION]\r\n> I skipped adding the pad to the input image when resizing, which might affect the accuracy of the model if the input image has a different aspect ratio compared to the input size of the model. Always try to get an input size with a ratio close to the input images you will use.\r\n\r\n## Requirements\r\n\r\n * Check the **requirements.txt** file.\r\n * For ONNX, if you have a NVIDIA GPU, then install the **onnxruntime-gpu**, otherwise use the **onnxruntime** library.\r\n\r\n## Installation [![PyPI](https://img.shields.io/pypi/v/yolov9-onnx?color=2BAF2B)](https://pypi.org/project/yolov9-onnx/)\r\n\r\n```bash\r\npip install yolov9-onnx\r\n```\r\nOr, clone this repository:\r\n```bash\r\ngit clone https://github.com/ibaiGorordo/ONNX-YOLOv9-MIT-Object-Detection.git\r\ncd ONNX-YOLOv9-MIT-Object-Detection\r\npip install -r requirements.txt\r\n```\r\n### ONNX Runtime\r\nFor Nvidia GPU computers:\r\n`pip install onnxruntime-gpu`\r\n\r\nOtherwise:\r\n`pip install onnxruntime`\r\n\r\n## ONNX model\r\n- If the model file is not found in the models directory, it will be downloaded automatically from the [release page](https://github.com/ibaiGorordo/ONNX-YOLOv9-MIT-Object-Detection/releases/tag/0.1.0).\r\n- Or, for exporting the models with a different input size, use the Google Colab notebook to convert the model: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1KPFC-BLL7i7kQJFYq-1JACFiTzPYyOsC?usp=sharing)\r\n- **Available models**: \r\n  - **MIT:** v9-s_mit.onnx, v9-m_mit.onnx, v9-c_mit.onnx\r\n  - **Official:** gelan-c.onnx, gelan-e.onnx, yolov9-c.onnx, yolov9-e.onnx\r\n\r\n## Original YOLOv9 MIT model\r\nThe original YOLOv9 MIT model can be found in this repository: [YOLOv9 MIT Repository](https://github.com/WongKinYiu/YOLO)\r\n- The License of the models is MIT license: [License](https://github.com/WongKinYiu/YOLO/blob/main/LICENSE)\r\n\r\n## Usage\r\n```python\r\nimport cv2\r\nfrom yolov9 import YOLOv9, draw_detections\r\n\r\ndetector = YOLOv9(\"v9-c_mit.onnx\")\r\n\r\nimg = cv2.imread(\"image.jpg\")\r\n\r\nclass_ids, boxes, confidences = detector(img)\r\n\r\ncombined_img = draw_detections(img, boxes, confidences, class_ids)\r\ncv2.imshow(\"Detections\", combined_img)\r\ncv2.waitKey(0)\r\n```\r\n\r\n## Examples\r\n\r\n * **Image inference**:\r\n ```\r\n python image_object_detection.py\r\n ```\r\n\r\n * **Webcam inference**:\r\n ```\r\n python webcam_object_detection.py\r\n ```\r\n\r\n * **Video inference**: https://youtu.be/X_XVkEqgCUM\r\n ```\r\n python video_object_detection.py\r\n ```\r\n\r\nhttps://github.com/user-attachments/assets/71b3ef97-92ef-4ddb-a62c-5e52922a396d\r\n\r\n## References:\r\n* YOLOv9 MIT model: https://github.com/WongKinYiu/YOLO\r\n* YOLOv9 model: https://github.com/WongKinYiu/yolov9\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Run YOLOv9 MIT model with ONNX Runtime",
    "version": "0.8.0",
    "project_urls": {
        "Homepage": "https://github.com/ibaiGorordo/ONNX-YOLOv9-MIT-Object-Detection"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ebf15b6173515f2bb7c38f09363ef45718cbc42b011c895ce28020e82e43fa24",
                "md5": "a0078ce90993f6654bd874ce7aba5976",
                "sha256": "04887ac39b9f4cc53e573aa98382f2e9289353596a94a1d5ac9eb83ea8370297"
            },
            "downloads": -1,
            "filename": "yolov9_onnx-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a0078ce90993f6654bd874ce7aba5976",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6797,
            "upload_time": "2024-09-15T08:34:08",
            "upload_time_iso_8601": "2024-09-15T08:34:08.864679Z",
            "url": "https://files.pythonhosted.org/packages/eb/f1/5b6173515f2bb7c38f09363ef45718cbc42b011c895ce28020e82e43fa24/yolov9_onnx-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d21ff02d2f7756649819a87a3e85803450a4b7de16f11be81a58f8c87586ab17",
                "md5": "55cb55f3e6038863af08488c37687176",
                "sha256": "bfdb8fec3f133e9ba456f18f5b8ea14807251f09fa1d53cf6ccf6b7502045b4d"
            },
            "downloads": -1,
            "filename": "yolov9_onnx-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "55cb55f3e6038863af08488c37687176",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6164,
            "upload_time": "2024-09-15T08:34:10",
            "upload_time_iso_8601": "2024-09-15T08:34:10.270722Z",
            "url": "https://files.pythonhosted.org/packages/d2/1f/f02d2f7756649819a87a3e85803450a4b7de16f11be81a58f8c87586ab17/yolov9_onnx-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-15 08:34:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ibaiGorordo",
    "github_project": "ONNX-YOLOv9-MIT-Object-Detection",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "yolov9-onnx"
}
        
Elapsed time: 0.31378s