Skip to content

Commit

Permalink
Add checkpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
liyinshuo committed Jul 20, 2021
1 parent b740b9c commit 29cf572
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 191 deletions.
19 changes: 6 additions & 13 deletions configs/restorers/liif/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,13 @@

| method | scale | Set5<br>PSNR / SSIM | Set14<br>PSNR / SSIM | DIV2K <br>PSNR / SSIM | Download |
| :--------------------------------------------------------------------------------------------------------------: | :---: | :-----------------: | :------------------: | :-------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| [liif_edsr_norm_x2-4_c64b16_g1_1000k_div2k](/configs/restorers/liif/liif_edsr_norm_x2-4_c64b16_g1_1000k_div2k.py) | x2 | 35.7148 / 0.9367 | 31.5936 / 0.8889 | 34.5896 / 0.9352 | [model](https://download.openmmlab.com/mmediting/restorers/liif/liif_edsr_norm_c64b16_g1_1000k_div2k_20210319-329ce255.pth) \| [log](https://download.openmmlab.com/mmediting/restorers/liif/liif_edsr_norm_c64b16_g1_1000k_div2k_20210319-329ce255.log.json) |
|| x3 | 32.3596 / 0.8914 | 28.4475 / 0.8040 | 30.9154 / 0.8720 ||
|| x4 | 30.2583 / 0.8513 | 26.7867 / 0.7377 | 29.0048 / 0.8183 ||
| [liif_edsr_norm_c64b16_g1_1000k_div2k](/configs/restorers/liif/liif_edsr_norm_c64b16_g1_1000k_div2k.py) | x2 | 35.7120 / 0.9365 | 31.6106 / 0.8891 | 34.6401 / 0.9353 | [model](https://download.openmmlab.com/mmediting/restorers/liif/liif_edsr_norm_c64b16_g1_1000k_div2k_20210319-329ce255.pth) \| [log](https://download.openmmlab.com/mmediting/restorers/liif/liif_edsr_norm_c64b16_g1_1000k_div2k_20210319-329ce255.log.json) |
|| x3 | 32.3655 / 0.8913 | 28.4605 / 0.8039 | 30.9597 / 0.8711 ||
|| x4 | 30.2668 / 0.8511 | 26.8093 / 0.7377 | 29.0059 / 0.8183 ||
|| x6 | 27.0907 / 0.7775 | 24.7129 / 0.6438 | 26.7694 / 0.7422 ||
|| x12 | 22.9046 / 0.6255 | 21.5378 / 0.5088 | 23.7269 / 0.6373 ||
|| x18 | 20.8445 / 0.5390 | 20.0215 / 0.4521 | 22.1920 / 0.5947 ||
|| x24 | 19.7305 / 0.5033 | 19.0703 / 0.4218 | 21.2025 / 0.5714 ||
|| x30 | 18.6646 / 0.4818 | 18.0210 / 0.3905 | 20.5022 / 0.5568 ||
| [liif_edsr_norm_c64b16_g1_1000k_div2k](/configs/restorers/liif/liif_edsr_norm_c64b16_g1_1000k_div2k.py) | x2 | 35.7131 / 0.9366 | 31.5579 / 0.8889 | 34.6647 / 0.9355 | [model](https://download.openmmlab.com/mmediting/restorers/liif/liif_edsr_norm_c64b16_g1_1000k_div2k_20210715-ab7ce3fc.pth) \| [log](https://download.openmmlab.com/mmediting/restorers/liif/liif_edsr_norm_c64b16_g1_1000k_div2k_20210715-ab7ce3fc.log.json) |
|| x3 | 32.3805 / 0.8915 | 28.4605 / 0.8039 | 30.9808 / 0.8724 ||
|| x4 | 30.2748 / 0.8509 | 26.8415 / 0.7381 | 29.0245 / 0.8187 ||
|| x6 | 27.1187 / 0.7774 | 24.7461 / 0.6444 | 26.7770 / 0.7425 ||
|| x18 | 20.8516 / 0.5406 | 20.0096 / 0.4525 | 22.1987 / 0.5955 ||
|| x30 | 18.8467 / 0.5010 | 18.1321 / 0.3963 | 20.5050 / 0.5577 ||

Note:
* △ refers to ditto.
* The two configs only differs in _testing pipeline_. So they use the same checkpoint.
* Data is normalized according to [EDSR](/configs/restorers/edsr).
* Evaluated on RGB channels, `scale` pixels in each border are cropped before evaluation.
48 changes: 27 additions & 21 deletions configs/restorers/liif/liif_edsr_norm_c64b16_g1_1000k_div2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
model = dict(
type='LIIF',
generator=dict(
type='EDSR',
in_channels=3,
out_channels=3,
mid_channels=64,
num_blocks=16),
imnet=dict(
type='MLPRefiner',
in_dim=64,
out_dim=3,
hidden_list=[256, 256, 256, 256]),
local_ensemble=True,
feat_unfold=True,
cell_decode=True,
type='LIIFEDSR',
encoder=dict(
type='EDSR',
in_channels=3,
out_channels=3,
mid_channels=64,
num_blocks=16),
imnet=dict(
type='MLPRefiner',
in_dim=64,
out_dim=3,
hidden_list=[256, 256, 256, 256]),
local_ensemble=True,
feat_unfold=True,
cell_decode=True,
eval_bsize=30000),
rgb_mean=(0.4488, 0.4371, 0.4040),
rgb_std=(1., 1., 1.),
eval_bsize=30000,
pixel_loss=dict(type='L1Loss', loss_weight=1.0, reduction='mean'))
# model training and testing settings
train_cfg = None
test_cfg = dict(metrics=['PSNR', 'SSIM'], crop_border=scale_max)

# dataset settings
scale_min, scale_max = 1, 4
# dataset settings
train_dataset_type = 'SRFolderGTDataset'
val_dataset_type = 'SRFolderGTDataset'
Expand Down Expand Up @@ -113,13 +113,18 @@
gt_folder='data/val_set5/Set5',
pipeline=valid_pipeline,
scale=scale_max),
# test=dict(
# type=test_dataset_type,
# lq_folder=f'data/val_set5/Set5_bicLRx{scale_max:d}',
# gt_folder='data/val_set5/Set5',
# pipeline=test_pipeline,
# scale=scale_max,
# filename_tmpl='{}'),
test=dict(
type=test_dataset_type,
lq_folder=f'data/val_set5/Set5_bicLRx{scale_max:d}',
type=val_dataset_type,
gt_folder='data/val_set5/Set5',
pipeline=test_pipeline,
scale=scale_max,
filename_tmpl='{}'))
pipeline=valid_pipeline,
scale=scale_max))

# optimizer
optimizers = dict(type='Adam', lr=1.e-4)
Expand Down Expand Up @@ -151,3 +156,4 @@
load_from = None
resume_from = None
workflow = [('train', 1)]
find_unused_parameters = True
156 changes: 0 additions & 156 deletions configs/restorers/liif/liif_edsr_norm_x2-4_c64b16_g1_1000k_div2k.py

This file was deleted.

2 changes: 1 addition & 1 deletion mmedit/models/restorers/liif.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def forward_test(self,

# generator
with torch.no_grad():
pred = self.generator(lq, coord, cell, test_mode=False)
pred = self.generator(lq, coord, cell, test_mode=True)
self.gt_mean = self.gt_mean.to(pred)
self.gt_std = self.gt_std.to(pred)
pred = pred * self.gt_std + self.gt_mean
Expand Down

0 comments on commit 29cf572

Please sign in to comment.