Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
|
5 |
+
Here's what I did to export the `pth` to `onnx` (if only for my own future reference):
|
6 |
+
1. Open the [Colab notebook](https://colab.research.google.com/gist/JingyunLiang/a5e3e54bc9ef8d7bf594f6fee8208533/swinir-demo-on-real-world-image-sr.ipynb#scrollTo=WsqCgH0iqMec) and click Runtime > Run All.
|
7 |
+
2. Open up and `main_test_swinir.py` in the Colab editor and placing the following line after `output = model(img_lq)`:
|
8 |
+
```
|
9 |
+
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'}})
|
10 |
+
```
|
11 |
+
3. Run this:
|
12 |
+
```
|
13 |
+
!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
|
14 |
+
```
|
15 |
+
And the ONNX file that you see in this repo will be generated.
|