ONXX Runtime - Candy filter

ONNX Runtime - Candy

This example makes use of the ONNX Runtime to apply a candy filter.

Requirements

  • Pipeless: Check the installation guide.

  • Python OpenCV and NumPy packages. Install them by running:

pip install opencv-python numpy

Run the example

Create an empty Pipeless project

pipeless init my-project --template empty # Using the empty template we avoid the interactive shell
cd my-project

Feel free to change my-project by any name you want.

Download the stage folder

wget -O - https://github.com/pipeless-ai/pipeless/archive/main.tar.gz | tar -xz --strip=2 "pipeless-main/examples/onnx-candy"

(Optional) If you have CUDA or TensorRT installed you can enable them at process.json

process.json
{
    "runtime": "onnx",
    "model_uri": "https://pipeless-public.s3.eu-west-3.amazonaws.com/candy-9.onnx",
    "inference_params": {
        "execution_provider": "tensorrt"
    }
}

Start Pipeless

The following command leaves Pipeless running on the current terminal

pipeless start --stages-dir .

Provide a stream

Open a new terminal and run:

pipeless add stream --input-uri "v4l2" --output-uri "screen" --frame-path "onnx-candy"

This command assumes you have a webcam available, if you don't just change the input URI.