# ONNX YOLOv8 Object Detection
# Important
- The input images are directly resized to match the input size of the model. I skipped adding the pad to the input image, it 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
```shell
git clone https://github.com/ibaiGorordo/ONNX-YOLOv8-Object-Detection.git
cd ONNX-YOLOv8-Object-Detection
pip install -r requirements.txt
```
### ONNX Runtime
For Nvidia GPU computers:
`pip install onnxruntime-gpu`
Otherwise:
`pip install onnxruntime`
# ONNX model
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/1-yZg6hFg27uCPSycRCRtyezHhq_VAHxQ?usp=sharing)
You can convert the model using the following code after installing ultralitics (`pip install ultralytics`):
```python
from ultralytics import YOLO
model = YOLO("yolov8m.pt")
model.export(format="onnx", imgsz=[480,640])
```
[//]: # (The original models were converted to different formats (including .onnx) by [PINTO0309](https://github.com/PINTO0309). Download the models from **[his repository]**(https://github.com/PINTO0309/PINTO_model_zoo/tree/main/345_YOLOv8). For that, you can either run the `download_single_batch.sh` or copy the download link inside that script in your browser to manually download the file. Then, extract and copy the downloaded onnx models (for example `yolov8m_480x640.onnx`) to your **[models directory](https://github.com/ibaiGorordo/ONNX-YOLOv8-Object-Detection/tree/main/models)**, and fix the file name in the python scripts accordingly.)
# Original YOLOv8 model
The original YOLOv8 model can be found in this repository: [YOLOv8 Repository](https://github.com/ultralytics/ultralytics)
- The License of the models is GPL-3.0 license: [License](https://github.com/ultralytics/ultralytics/blob/main/LICENSE)
# Examples
* **Image inference**:
```shell
python image_object_detection.py
```
* **Webcam inference**:
```shell
python webcam_object_detection.py
```
* **Video inference**: https://youtu.be/JShJpg8Mf7M
```shell
python video_object_detection.py
```
![!YOLOv8 detection video](https://github.com/ibaiGorordo/ONNX-YOLOv8-Object-Detection/raw/main/doc/img/yolov8_video.gif)
*Original video: [https://youtu.be/Snyg0RqpVxY](https://youtu.be/Snyg0RqpVxY)*
# References:
* YOLOv8 model: [https://github.com/ultralytics/ultralytics](https://github.com/ultralytics/ultralytics)
* YOLOv5 model: [https://github.com/ultralytics/yolov5](https://github.com/ultralytics/yolov5)
* YOLOv6 model: [https://github.com/meituan/YOLOv6](https://github.com/meituan/YOLOv6)
* YOLOv7 model: [https://github.com/WongKinYiu/yolov7](https://github.com/WongKinYiu/yolov7)
* PINTO0309's model zoo: [https://github.com/PINTO0309/PINTO_model_zoo](https://github.com/PINTO0309/PINTO_model_zoo)
* PINTO0309's model conversion tool: [https://github.com/PINTO0309/openvino2tensorflow](https://github.com/PINTO0309/openvino2tensorflow)
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
YOLOv8_使用ONNX+YOLOv8+Python实现目标检测_项目实战_附完整流程教程.zip (11个子文件)
YOLOv8_使用ONNX+YOLOv8+Python实现目标检测_项目实战_附完整流程教程
webcam_object_detection.py 675B
image_object_detection.py 649B
doc
img
detected_objects.jpg 1.36MB
yolov8_video.gif 14.33MB
yolov8
utils.py 5KB
__init__.py 27B
YOLOv8.py 5KB
requirements.txt 62B
models
.gitkeep 0B
README.md 3KB
video_object_detection.py 1KB
共 11 条
- 1
资源评论
- weixin_447626462024-04-14资源有很好的参考价值,总算找到了自己需要的资源啦。
极智视界
- 粉丝: 2w+
- 资源: 1448
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- web期末大作业-HTML+CSS+JS仿王者荣耀官网网站HTML5项目实训源码.zip
- 帕鲁ppt备份只是为了方便
- 3.15 设计vi,产生一个0.0到10.0的随机数,与10.0相乘,然后通过一个字vi将积与100相加后开方
- 3.14 设计vi,比较两个数,如果其中一个数大于另一个数,则点亮LED指示灯
- 08最短路径_Floyd.c
- 02二叉排序树_BinarySortTree.c
- python字符串逆序方法.md
- qt软件开发+代码+注释+自我学习+windows软件开发+图像分割
- python二叉树的遍历.md
- 1cdd0859202f67f8bf6945fd9559ea102d27d11b
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功