image_to_pixle_params_yoloSAM/ultralytics-main/examples/RTDETR-ONNXRuntime-Python/README.md

3.9 KiB

RT-DETR Object Detection with ONNX Runtime

This project demonstrates how to run Ultralytics RT-DETR models using the ONNX Runtime inference engine in Python. It provides a straightforward example for performing object detection with RT-DETR models that have been exported to the ONNX format, a standard for representing machine learning models. RT-DETR, or Real-Time DEtection TRansformer, offers efficient and accurate object detection capabilities, detailed further in the RT-DETR research paper.

⚙️ Installation

To get started, you'll need to install the necessary dependencies. Follow the steps below.

Installing Required Dependencies

Install the core requirements using pip and the provided requirements.txt file this will install CPU-based inference, install the standard onnxruntime package. This version utilizes CPU resources for model execution. See the ONNX Runtime Execution Providers documentation for more information on different execution options.

pip install -r requirements.txt

Installing onnxruntime-gpu (Optional)

For accelerated inference using an NVIDIA GPU, install the onnxruntime-gpu package. Ensure you have the correct NVIDIA drivers and CUDA toolkit installed first. Consult the official ONNX Runtime GPU documentation for detailed compatibility information and setup instructions.

pip install onnxruntime-gpu

🚀 Usage

Once the dependencies are installed, you can run inference using the main.py script.

Execute the script from your terminal, specifying the path to your ONNX model, the input image, and optional confidence and IoU thresholds:

python main.py --model rtdetr-l.onnx --img image.jpg --conf-thres 0.5 --iou-thres 0.5

Arguments:

Adjust the --conf-thres and --iou-thres values based on your specific requirements for detection sensitivity and overlap removal.

🤝 Contributing

Contributions to enhance this example are welcome! Whether it's fixing bugs, adding new features, improving documentation, or suggesting optimizations, your input is valuable. Please refer to the Ultralytics Contribution Guide for detailed information on how to get started. You can also explore general guides on contributing to open source projects. Thank you for helping improve the Ultralytics ecosystem and its resources available on GitHub!