<jupyter_start><jupyter_text>Install packagesList of packages that work for the code*   https://github.com/saeed-anwar/DRLN/issues/12<jupyter_code>from google.colab import drive
drive.mount('/content/drive')
!pip uninstall --y torchvision
!pip uninstall --y torch
!pip uninstall --y scipy
!pip install -q torch==1.1.0 torchvision==0.3.0
!pip install scipy==1.1.0 # https://github.com/saeed-anwar/DRLN/issues/11
import torch
print(torch.__version__)<jupyter_output>1.1.0<jupyter_text>Download code<jupyter_code>!git clone https://github.com/Luxi-Zhao/SingleImageSuperResolution.git<jupyter_output>Cloning into 'SingleImageSuperResolution'...
remote: Enumerating objects: 988, done.[K
remote: Counting objects: 100% (988/988), done.[K
remote: Compressing objects: 100% (736/736), done.[K
remote: Total 988 (delta 296), reused 903 (delta 211), pack-reused 0[K
Receiving objects: 100% (988/988), 99.45 MiB | 26.99 MiB/s, done.
Resolving deltas: 100% (296/296), done.<jupyter_text>Download DIV2K<jupyter_code>!wget http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_train_LR_bicubic_X2.zip
!wget http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_valid_LR_bicubic_X2.zip
!wget http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_train_HR.zip
!wget http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_valid_HR.zip
!mkdir DIV2K
!unzip -q DIV2K_valid_LR_bicubic_X2.zip -d DIV2K
!unzip -q DIV2K_train_LR_bicubic_X2.zip -d DIV2K
!unzip -q DIV2K_train_HR.zip -d DIV2K
!unzip -q DIV2K_valid_HR.zip -d DIV2K
mv DIV2K/DIV2K_valid_HR/* DIV2K/DIV2K_train_HR/
mv DIV2K/DIV2K_valid_LR_bicubic/X2/* DIV2K/DIV2K_train_LR_bicubic/X2/<jupyter_output><empty_output><jupyter_text>Train model<jupyter_code>GDRIVE = '/content/drive/MyDrive/2516'
experiment_name = 'RDN_50epoch_AblateLRLGFF_Bicubic'
CODE_DIR = '/content/SingleImageSuperResolution/TestCode' 
first_run = False
data_prep = 'sep_reset' if first_run else 'sep' 
mkdir {GDRIVE}/{experiment_name}
cd {CODE_DIR}/code
!git checkout rdn-ablate-lrl-gff
!git pull
!python main.py --ext_save_path {GDRIVE}/{experiment_name} --save_model_every 10 --RDNconfig C --dir_data ../../.. --ext {data_prep} --scale 2 --model RDN --epochs 50 --patch_size 32 --chop --save {experiment_name}<jupyter_output>Preparing seperated binary files
Preparing seperated binary files
Making model...
Trainable model parameter count:
34316675
Preparing loss function:
1.000 * L1
[Epoch 1]	Learning rate: 1.00e-4
[1600/16000]	[L1: 27.4314]	13.1+30.2s
[3200/16000]	[L1: 19.5777]	10.9+2.5s
[4800/16000]	[L1: 15.6883]	10.3+0.0s
[6400/16000]	[L1: 13.5633]	10.2+0.0s
[8000/16000]	[L1: 12.1993]	10.4+0.0s
[9600/16000]	[L1: 11.2550]	10.4+0.0s
[11200/16000]	[L1: 10.5126]	10.3+0.0s
[12800/16000]	[L1: 9.9742]	10.2+0.0s
[14400/16000]	[L1: 9.5473]	10.4+0.0s
[16000/16000]	[L1: 9.2443]	10.2+0.0s

Evaluation:
100%|███████████████████████████████████████████| 10/10 [00:30<00:00,  3.01s/it]
[DIV2K x2]	PSNR: 34.169 (Best: 34.169 @epoch 1)
[DIV2K x2]	SSIM: 0.000
Total time: 30.10s, ave time: 3.01s

[Epoch 2]	Learning rate: 1.00e-4
[1600/16000]	[L1: 5.7696]	10.4+0.3s
[3200/16000]	[L1: 5.7312]	10.3+0.0s
[4800/16000]	[L1: 5.7206]	10.3+0.0s
[6400/16000]	[L1: 5.6142]	10.4+0.0s
[8000/16000]	[L1: 5.5197]	10.2+0.0s
[9600/16000]	[L1: 5.[...]<jupyter_text>Resume Training<jupyter_code>#!python main.py --resume -1 --load {CODE_DIR}/SR/BI/{experiment_name} --ext_save_path {GDRIVE}/{experiment_name} --save_model_every 10 --RDNconfig C --dir_data ../../.. --ext sep --scale 2 --model RDN --epochs 50 --patch_size 32 --chop --save {experiment_name} --save_results<jupyter_output>Making model...
Traceback (most recent call last):
  File "main.py", line 14, in <module>
    model = model.Model(args, checkpoint)
  File "/content/SingleImageSuperResolution/TestCode/code/model/__init__.py", line 34, in __init__
    cpu=args.cpu
  File "/content/SingleImageSuperResolution/TestCode/code/model/__init__.py", line 96, in load
    **kwargs
  File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 382, in load
    f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/content/SingleImageSuperResolution/TestCode/SR/BI/RDN/model/model_latest.pt'<jupyter_text>Test Trained Model Load model from checkpoint<jupyter_code>cd {CODE_DIR}/code
!python main.py --data_test MyImage --scale 2 --RDNconfig C --model RDN --n_feats 64 --pre_train {CODE_DIR}/SR/BI/{experiment_name}/model/model_best.pt --test_only --save_results --chop --save {experiment_name}Test --testpath ../LR/LRBI --testset Set5<jupyter_output>Making model...
Loading model from /content/SingleImageSuperResolution/TestCode/SR/BI/RDN_50epoch_AblateLRLGFF_Bicubic/model/model_best.pt
Trainable model parameter count:
34316675

Evaluation:
100%|█████████████████████████████████████████████| 5/5 [00:02<00:00,  2.04it/s]
[MyImage x2]	PSNR: 37.504 (Best: 37.504 @epoch 1)
[MyImage x2]	SSIM: 0.875
Total time: 2.45s, ave time: 0.49s<jupyter_text>Save Model<jupyter_code>mkdir /content/{experiment_name}
cp -r {CODE_DIR}/SR/BI/{experiment_name}/* /content/{experiment_name}/
cd /content/
!zip -r -q {experiment_name}.zip {experiment_name}
cp {experiment_name}.zip {GDRIVE}<jupyter_output><empty_output>