Skip to content

Commit

Permalink
add realesr-general-x4v3 and realesr-general-wdn-x4v3
Browse files Browse the repository at this point in the history
  • Loading branch information
xinntao committed Sep 18, 2022
1 parent e5e79fb commit b827be1
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions inference_realesrgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def main():
type=str,
default='RealESRGAN_x4plus',
help=('Model names: RealESRGAN_x4plus | RealESRNet_x4plus | RealESRGAN_x4plus_anime_6B | RealESRGAN_x2plus | '
'realesr-animevideov3'))
'realesr-animevideov3 | realesr-general-x4v3 | realesr-general-wdn-x4v3'))
parser.add_argument('-o', '--output', type=str, default='results', help='Output folder')
parser.add_argument('--model_path', type=str, default=None, help='Model path')
parser.add_argument('-s', '--outscale', type=float, default=4, help='The final upsampling scale of the image')
parser.add_argument('--suffix', type=str, default='out', help='Suffix of the restored image')
parser.add_argument('-t', '--tile', type=int, default=0, help='Tile size, 0 for no tile during testing')
Expand Down Expand Up @@ -58,13 +59,19 @@ def main():
elif args.model_name in ['realesr-animevideov3']: # x4 VGG-style model (XS size)
model = SRVGGNetCompact(num_in_ch=3, num_out_ch=3, num_feat=64, num_conv=16, upscale=4, act_type='prelu')
netscale = 4
elif args.model_name in ['realesr-general-x4v3', 'realesr-general-wdn-x4v3']: # x4 VGG-style model (S size)
model = SRVGGNetCompact(num_in_ch=3, num_out_ch=3, num_feat=64, num_conv=32, upscale=4, act_type='prelu')
netscale = 4

# determine model paths
model_path = os.path.join('experiments/pretrained_models', args.model_name + '.pth')
if not os.path.isfile(model_path):
model_path = os.path.join('realesrgan/weights', args.model_name + '.pth')
if not os.path.isfile(model_path):
raise ValueError(f'Model {args.model_name} does not exist.')
if args.model_path is not None:
model_path = args.model_path
else:
model_path = os.path.join('experiments/pretrained_models', args.model_name + '.pth')
if not os.path.isfile(model_path):
model_path = os.path.join('realesrgan/weights', args.model_name + '.pth')
if not os.path.isfile(model_path):
raise ValueError(f'Model {args.model_name} does not exist.')

# restorer
upsampler = RealESRGANer(
Expand Down

2 comments on commit b827be1

@Axelllkeceee
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to use?

@Djshshsheieh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smooth

Please sign in to comment.