Background restoration not being applied
Excellent work, thank you for making this available!
When I run the original paper model with the commands included in PaperModel.md I get colorization but not background restoration. In the results folder there are the cropped faces and they look great, but then the full restored images just include that cropped region restored with colorization then simply pasted into the original image (with no other restoration around the cropped region).
Note that I see the tiles being processed in the prompt.
How can we colorize the whole image instead of only the face part?
How can we colorize the whole image instead of only the face part?
Just to clarify I get no colorization or quality improvement for the background. I tried Real-ESRGAN by itself and also don't get any improvement to the image (with or without enhanced face processing by connecting GFPGAN through it).
Excellent work, thank you for making this available!
When I run the original paper model with the commands included in PaperModel.md I get colorization but not background restoration. In the results folder there are the cropped faces and they look great, but then the full restored images just include that cropped region restored with colorization then simply pasted into the original image (with no other restoration around the cropped region).
Note that I see the tiles being processed in the prompt.
Try Real-ESRGAN: https://github.com/xinntao/Real-ESRGAN
It does not work if you don't have cuda enabled. I got the background improvement when I managed to install cuda
To enable background enhancement on computers without GPU, you need to modify code (inference_gfpgan.py) as below, This worked on my ThinkPad with AMD ryzen7 CPU ( no dedicated GPU)
Original code
# ------------------------ set up background upsampler ------------------------
if args.bg_upsampler == 'realesrgan':
if not torch.cuda.is_available(): # CPU
import warnings
warnings.warn('The unoptimized RealESRGAN is slow on CPU. We do not use it. '
'If you really want to use it, please modify the corresponding codes.')
bg_upsampler = None
Modified Code (To enable BG enhancement on CPU mode)
# ------------------------ set up background upsampler ------------------------
if args.bg_upsampler == 'realesrgan':
if not torch.cuda.is_available(): # CPU
import warnings
warnings.warn('The unoptimized RealESRGAN is slow on CPU. We do not use it. '
'If you really want to use it, please modify the corresponding codes.')
from basicsr.archs.rrdbnet_arch import RRDBNet
from realesrgan import RealESRGANer
model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=2)
bg_upsampler = RealESRGANer(
scale=2,
model_path='https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth',
model=model,
tile=args.bg_tile,
tile_pad=10,
pre_pad=0,
half=False) # need to set False in CPU mode
Background restoration not working for me. I've followed the paper model instructions, and I am able to colourize and restore faces but not the background. Cuda is installed and when I run the inference_gfpgan.py I can see the job running with nvidia-smi. I've installed pip install realesrgan as well. Edit: Background is being upscaled as well, but not colorized