forked from PaddlePaddle/PaddleGAN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add mpr predictor and doc (PaddlePaddle#530)
* add mpr predictor and doc * add doc * fix result * fix Results * fix copyright
- Loading branch information
1 parent
49ef722
commit 2b28df6
Showing
15 changed files
with
571 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. | ||
# | ||
#Licensed under the Apache License, Version 2.0 (the "License"); | ||
#you may not use this file except in compliance with the License. | ||
#You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
#Unless required by applicable law or agreed to in writing, software | ||
#distributed under the License is distributed on an "AS IS" BASIS, | ||
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
#See the License for the specific language governing permissions and | ||
#limitations under the License. | ||
|
||
import paddle | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.getcwd()) | ||
from ppgan.apps import MPRPredictor | ||
import argparse | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--input_image", type=str, help="path to image") | ||
|
||
parser.add_argument("--output_path", | ||
type=str, | ||
default='output_dir', | ||
help="path to output image dir") | ||
|
||
parser.add_argument("--weight_path", | ||
type=str, | ||
default=None, | ||
help="path to model weight path") | ||
|
||
parser.add_argument( | ||
"--task", | ||
type=str, | ||
default='Deblurring', | ||
help="task can be chosen in 'Deblurring', 'Denoising', 'Deraining'") | ||
|
||
parser.add_argument("--cpu", | ||
dest="cpu", | ||
action="store_true", | ||
help="cpu mode.") | ||
|
||
args = parser.parse_args() | ||
|
||
if args.cpu: | ||
paddle.set_device('cpu') | ||
|
||
predictor = MPRPredictor(output_path=args.output_path, | ||
task=args.task, | ||
weight_path=args.weight_path) | ||
predictor.run(args.input_image) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
total_iters: 100000 | ||
output_dir: output_dir | ||
|
||
model: | ||
name: MPRModel | ||
generator: | ||
name: MPRNet | ||
n_feat: 80 | ||
scale_unetfeats: 48 | ||
scale_orsnetfeats: 32 | ||
|
||
char_criterion: | ||
name: CharbonnierLoss | ||
edge_criterion: | ||
name: EdgeLoss | ||
|
||
dataset: | ||
train: | ||
name: MPRTrain | ||
rgb_dir: data/SIDD/train | ||
num_workers: 16 | ||
batch_size: 4 # 4GPUs | ||
img_options: | ||
patch_size: 256 | ||
test: | ||
name: MPRTrain | ||
rgb_dir: data/SIDD/val | ||
num_workers: 1 | ||
batch_size: 1 | ||
img_options: | ||
patch_size: 256 | ||
|
||
lr_scheduler: | ||
name: CosineAnnealingRestartLR | ||
learning_rate: !!float 2e-4 | ||
periods: [25000, 25000, 25000, 25000] | ||
restart_weights: [1, 1, 1, 1] | ||
eta_min: !!float 1e-6 | ||
|
||
validate: | ||
interval: 5000 | ||
save_img: false | ||
|
||
metrics: | ||
psnr: # metric name, can be arbitrary | ||
name: PSNR | ||
crop_border: 4 | ||
test_y_channel: True | ||
ssim: | ||
name: SSIM | ||
crop_border: 4 | ||
test_y_channel: True | ||
|
||
optimizer: | ||
name: Adam | ||
# add parameters of net_name to optim | ||
# name should in self.nets | ||
net_names: | ||
- generator | ||
beta1: 0.9 | ||
beta2: 0.999 | ||
epsilon: 1e-8 | ||
|
||
log_config: | ||
interval: 10 | ||
visiual_interval: 5000 | ||
|
||
snapshot_config: | ||
interval: 5000 |
Oops, something went wrong.