This project demonstrates the performance differences between running ONNX Runtime inference sessions on CPU and GPU in a web environment. The example uses ONNX Runtime Web and OpenCV.js to highlight the efficiency and speed benefits of GPU acceleration.
- ONNX Runtime Web Integration: Utilizes ONNX Runtime Web to run machine learning models directly in the browser.
- CPU and GPU Comparison: Provides a comparison of inference speeds between CPU and GPU.
- OpenCV.js: Uses OpenCV.js for image processing tasks.
- Performance Metrics: Displays elapsed time for inference to illustrate performance differences.
- A modern web browser (e.g., Chrome, Firefox)
- Basic knowledge of JavaScript and HTML
-
Open the project directory in your preferred code editor.
-
Start a local server:
- You can use Python's built-in HTTP server for this:
This will start a server on port 8000 by default.
python3 -m http.server
- You can use Python's built-in HTTP server for this:
-
Open your web browser and navigate to http://localhost:8000.
-
Explore the project and compare the performance of ONNX Runtime inference on CPU and GPU.
Contributions are welcome! Please fork the repository, make your changes, and submit a pull request.