1
0
mirror of https://github.com/TencentARC/GFPGAN.git synced 2025-05-16 23:30:13 -07:00
This commit is contained in:
Xintao 2021-05-18 15:15:16 +08:00
parent 7a6b04e5cb
commit 1c09b47fcb
2 changed files with 14 additions and 12 deletions

View File

@ -25,5 +25,5 @@ jobs:
- name: Lint
run: |
flake8 .
isort --check-only --diff basicsr/ options/ scripts/ tests/ inference/ setup.py
yapf -r -d basicsr/ options/ scripts/ tests/ inference/ setup.py
isort --check-only --diff data/ archs/ models/ train.py inference_gfpgan_full.py
yapf -r -d data/ archs/ models/ train.py inference_gfpgan_full.py

View File

@ -202,16 +202,18 @@ class GFPGANModel(BaseModel):
if 'gt' in data:
self.gt = data['gt'].to(self.device)
import torchvision
if self.opt['rank'] == 0:
import os
os.makedirs('tmp/gt', exist_ok=True)
os.makedirs('tmp/lq', exist_ok=True)
print(self.idx)
torchvision.utils.save_image(
self.gt, f'tmp/gt/gt_{self.idx}.png', nrow=4, padding=2, normalize=True, range=(-1, 1))
torchvision.utils.save_image(
self.lq, f'tmp/lq/lq{self.idx}.png', nrow=4, padding=2, normalize=True, range=(-1, 1))
# uncomment to check data
# import torchvision
# if self.opt['rank'] == 0:
# import os
# os.makedirs('tmp/gt', exist_ok=True)
# os.makedirs('tmp/lq', exist_ok=True)
# print(self.idx)
# torchvision.utils.save_image(
# self.gt, f'tmp/gt/gt_{self.idx}.png', nrow=4, padding=2, normalize=True, range=(-1, 1))
# torchvision.utils.save_image(
# self.lq, f'tmp/lq/lq{self.idx}.png', nrow=4, padding=2, normalize=True, range=(-1, 1))
# self.idx = self.idx + 1
if 'loc_left_eye' in data:
# get facial component locations, shape (batch, 4)