Are you sure you want to delete this access key?
This repository provides a Python demo for performing segmentation with YOLOv8 using ONNX Runtime, highlighting the interoperability of YOLOv8 models without the need for the full PyTorch stack.
Install the required packages using pip. You will need ultralytics
for exporting YOLOv8-seg ONNX model and using some utility functions, onnxruntime-gpu
for GPU-accelerated inference, and opencv-python
for image processing.
pip install ultralytics
pip install onnxruntime-gpu # For GPU support
# pip install onnxruntime # Use this instead if you don't have an NVIDIA GPU
pip install numpy
pip install opencv-python
Export the YOLOv8 segmentation model to ONNX format using the provided ultralytics
package.
yolo export model=yolov8s-seg.pt imgsz=640 format=onnx opset=12 simplify
Perform inference with the exported ONNX model on your images.
python main.py --model-path <MODEL_PATH> --source <IMAGE_PATH>
After running the command, you should see segmentation results similar to this:
For more advanced usage, including real-time video processing, please refer to the main.py
script's command-line arguments.
We welcome contributions to improve this demo! Please submit issues and pull requests for bug reports, feature requests, or submitting a new algorithm enhancement.
This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.
Press p or to see the previous file or, n or to see the next file
Browsing data directories saved to S3 is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
ultralytics is now integrated with AWS S3!
Are you sure you want to delete this access key?
Browsing data directories saved to Google Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
ultralytics is now integrated with Google Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to Azure Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
ultralytics is now integrated with Azure Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to S3 compatible storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
ultralytics is now integrated with your S3 compatible storage!
Are you sure you want to delete this access key?