Implement of ESRGAN with ONNX, just only for inference.
You can easily try your images without installing complex machine learning enviroment.
- Install dependence
pip install numpy pillow onnxruntime
for NVIDIA GPU
pip install onnxruntime-gpu
for AMD/Intel GPU
pip install onnxruntime-directml
- Download
models.7zon release page - Unzip
models.7zin code directory
- Modify source code
# change model
using_model_path = 'models/JPEG_Denoise/1x_JPEG_60-80-opti.onnx'
# change execution provider
self.exec_provider = ['CUDAExecutionProvider'] # GPU via CUDA
self.exec_provider = ['DmlExecutionProvider'] # GPU via DirectML
self.exec_provider = ['CPUExecutionProvider'] # CPU Only
self.exec_provider = ['DmlExecutionProvider', 'CPUExecutionProvider'] # DirectML + CPU (default)
# set tile size
# For `4x_IllustrationJaNai_V1_DAT2_190k`, tile_size=224, scale=4
model = ESRGAN(using_model_path, tile_size=1024, scale=1)
- Run to go
python main.py input.jpg
See this gist