- 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
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.
-
Download the codeformer onnx model
-
Run the following command
trtexec --onnx=codeformer.onnx --saveEngine=codeformer.engine --fp16
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
- Ubuntu 22.04 LTS, Cuda 12.3, Tensorrt 8.6.1, Python 3.10, A10G GPU
- Windows (Not tested)