Skip to content

yuvraj108c/Codeformer-Tensorrt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codeformer Tensorrt

python cuda trt

  • This repo provides a minimal TensorRT implementation of Codeformer in Python, enabling fast face restoration on images
  • This implementation does not include preprocessing (face detection/alignment/cropping) and postprocessing (pasting the restored face on the original image)
  • The model only performs inference on preprocessed images (e.g input.png), which need to be 512 x 512, with a face fully visible.
  • You can expect a 2x speedup on the inference

⏱️ Performance

Device Model Input (WxH) Inference Time(ms)
A10G 512 x 512 23

Note

Inference was conducted using FP16 precision, with a warm-up period of 10 frames. The reported time corresponds to the last inference.

🛠️ Building Tensorrt Engine

  1. Download the codeformer onnx model

  2. Run the following command

    trtexec --onnx=codeformer.onnx --saveEngine=codeformer.engine --fp16

⚡ Inference

git clone https://github.com/yuvraj108c/Codeformer-Tensorrt.git
pip install -r requirements.txt
python inference.py --input ./input.png --engine ./codeformer.engine --output ./output.png

🤖 Environment tested

  • Ubuntu 22.04 LTS, Cuda 12.3, Tensorrt 8.6.1, Python 3.10, A10G GPU
  • Windows (Not tested)

👏 Credits

Releases

No releases published

Packages

No packages published

Languages