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, you could download and install onnxruntime-dml
on release page or build it follow this
- Download
models.7z
on release page - Unzip
models.7z
in 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
# set tile size
model = ESRGAN(using_model_path, tile_size=1024, scale=1)
- Run to go
python main.py input.jpg
See this gist