A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/yuanyang1991/birefnet_tensorrt below:

yuanyang1991/birefnet_tensorrt: BiRefNet Inference using tensorrt

BiRefNet TensorRT Inference

This project provides code for performing inference with BiRefNet using TensorRT. The aim is to accelerate the inference process by leveraging the high-performance capabilities of TensorRT.

Inference Time Comparison Method Pytorch ONNX Tensorrt inference time 0.71s 5.32s 0.17s 2. Average Inference Time (excluding the first) Method Pytorch ONNX Tensorrt inference time 0.15s 4.43s 0.11s

Note:

  1. Both the PyTorch and ONNX models are from the official BiRefNet GitHub.
  2. The TensorRT model was converted using Convert-ONNX-Model-to-TensorRT-Engine.
  3. All tests were conducted on a Win10 system with an RTX 4080 Super.
  4. Refer to model_compare.py for the conversion code.
pip install -r requirements.txt

First, download onnx model from Google Drive

2. Convert ONNX Model to TensorRT Engine

second, convert your ONNX model to a TensorRT engine using the provided conversion script:

from utils import convert_onnx_to_engine

onnx_file_path = "birefnet.onnx"
engine_file_path = "engine.trt"

convert_onnx_to_engine(onnx_file_path, engine_file_path)

Now, you can run inference using the TensorRT engine with the following command:

 python .\infer.py --image-path image_path --output-path result.png --output-alpha-path result_alpha.png --engine-path .\engine.trt

python .\infer.py --image-path image_dir --output-path output_dir --output-alpha-path alpha_dir --engine-path .\engine.trt --mode m

Contributions are welcome! Please feel free to submit a Pull Request or open an Issue if you have any suggestions or find bugs.

  1. Birefnet
  2. fast-foreground-estimation

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4