# YOLOv9 with ONNX & ONNXRuntime
Performing Object Detection for YOLOv9 with ONNX and ONNXRuntime
![! ONNX YOLOv9 Object Detection](./output/sample_image.jpeg)
## 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
```shell
cd 项目
pip install -r requirements.txt
```
### ONNX Runtime
For Nvidia GPU computers:
`pip install onnxruntime-gpu`
Otherwise:
`pip install onnxruntime`
## ONNX model and Class metadata
You can download the onnx model and class metadata file on the link below
```
https://drive.google.com/drive/folders/1QH5RCF5WOk53SfdzsHTFkXAdzMLbbQeO?usp=sharing
```
## Examples
### Arguments
List the arguments available in main.py file.
- `--source`: Path to image or video file
- `--weights`: Path to yolov9 onnx file (ex: weights/yolov9-c.onnx)
- `--classes`: Path to yaml file that contains the list of class from model (ex: weights/metadata.yaml)
- `--score-threshold`: Score threshold for inference, range from 0 - 1
- `--conf-threshold`: Confidence threshold for inference, range from 0 - 1
- `--iou-threshold`: IOU threshold for inference, range from 0 - 1
- `--image`: Image inference mode
- `--video`: Video inference mode
- `--show`: Show result on pop-up window
- `--device`: Device use for inference, default = cpu.
Note: If you want to use `cuda` for inference, please make sure you are already install `onnxruntime-gpu` before running the script.
This code provides two modes of inference, image and video inference. Basically, you just add `--image` flag for image inference and `--video` flag for video inference when you are running the python script.
If you have your own custom model, don't forget to provide a yaml file that consists the list of class that your model want to predict. This is example of yaml content for defining your own classes:
```
names:
0: person
1: bicycle
2: car
3: motorcycle
4: airplane
.
.
.
.
n: object
```
### Inference on Image
```
python main.py --source assets/sample_image.jpeg --weights weights/yolov9-c.onnx --classes weights/metadata.yaml --image
```
### Inference on Video
```
python main.py --source assets/road.mp4 --weights weights/yolov9-c.onnx --classes weights/metadata.yaml --video
```
没有合适的资源?快使用搜索试试~ 我知道了~
算法部署-使用Python+ONNXRuntime部署YOLOv9目标检测算法-优质算法部署项目实战.zip
共10个文件
py:2个
gitkeep:2个
jpeg:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 111 浏览量
2024-03-15
17:27:33
上传
评论
收藏 12.41MB ZIP 举报
温馨提示
算法部署_使用Python+ONNXRuntime部署YOLOv9目标检测算法_优质算法部署项目实战
资源推荐
资源详情
资源评论
收起资源包目录
算法部署_使用Python+ONNXRuntime部署YOLOv9目标检测算法_优质算法部署项目实战.zip (10个子文件)
算法部署_使用Python+ONNXRuntime部署YOLOv9目标检测算法_优质算法部署项目实战
yolov9.py 7KB
assets
sample_image.jpeg 111KB
.env 0B
weights
.gitkeep 0B
main.py 4KB
output
sample_image.jpeg 226KB
result.avi 12.1MB
.gitkeep 0B
requirements.txt 172B
README.md 2KB
共 10 条
- 1
资源评论
极智视界
- 粉丝: 2w+
- 资源: 1592
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功