Downloads · 30 days
0
rocca/swin-ir-onnx
swin-ir-onnx is a machine learning model from rocca. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Here's what I did to export the pth to onnx (if only for my own future reference): 1. Open the Colab notebook and click Runtime Run All. 2. Open up and maintestswinir.py in the Colab editor and placing the following l…
Downloads · 30 days
0
Access
Public
Updated Apr 14, 2022
Repo size
61.3 MB
Likes
4
Public
Click a slice to open those files.
.onnx61.3 MB · 100%
From the Hugging Face model README
Here's what I did to export the pth to onnx (if only for my own future reference):
main_test_swinir.py in the Colab editor and placing the following line after output = model(img_lq):torch.onnx.export(model, img_lq, "003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN-dynamic.onnx", export_params=True, opset_version=12, do_constant_folding=True, verbose=True, input_names = ['input'], output_names = ['output'], dynamic_axes={'input' : {2 : 'h', 3 : 'w'}, 'output' : {2 : 'h', 3 : 'w'}})
!python SwinIR/main_test_swinir.py --task real_sr --model_path experiments/pretrained_models/003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth --folder_lq BSRGAN/testsets/RealSRSet --scale 4
And the ONNX file that you see in this repo will be generated.