Skip to content

Instantly share code, notes, and snippets.

@woctezuma
Last active January 17, 2022 14:26
Show Gist options
  • Save woctezuma/20e4dd3d49da09bf339d909f29c5527e to your computer and use it in GitHub Desktop.
Save woctezuma/20e4dd3d49da09bf339d909f29c5527e to your computer and use it in GitHub Desktop.
Google Colab: PSFRGAN

Reference: https://github.com/chaofengc/PSFR-GAN

Prepare code:

%cd /content
!git clone https://github.com/chaofengc/PSFR-GAN.git

%mkdir -p /content/PSFR-GAN/pretrain_models
%cd /content/PSFR-GAN/pretrain_models
!gdown --id 1UhzMSORSul88iVfSYQYuEal83lEoNN7l
!gdown --id 1UiHeUHVNKiEq_s5dcBv6jez6TqrAduMg
!gdown --id 1UcTeI_-YmQeNypHW98VRuIF13xEPmPWm
!gdown --id 1Unn2eznkclqUhK_o50YUyaV7eoTE4Su3
!gdown --id 1P6jZRPKPq6g2DsVJevszbM1vL5HDO1fR

Prepare data:

%cd /content/PSFR-GAN

url = 'https://i.imgur.com/7gPVDg4.png'
!wget {url}

from pathlib import Path
test_img_path = Path(url).name

Run:

%cd /content/PSFR-GAN
!python test_enhance_single_unalign.py \
 --test_img_path {test_img_path} \
 --results_dir results \
 --gpus 1

Export:

!tar czvf PSFRGAN.tar.gz /content/PSFR-GAN/results
@ivaxsirc
Copy link

Yes, it works now are the spaces, thks

I have a question, maybe you can help me

I have some images of a face with very poor quality, I have tried it and it comes out horrible,

I have many images of that person's face in very good quality.
My question is the following, is there a way to train the program so that on the good quality images of the face, then it knows how to interpret them with the poor quality one?

Considering that it is the same face.

I do not know if I explained well.
Thks

@woctezuma
Copy link
Author

woctezuma commented Jan 14, 2022

I have not done it, so I can only give a few hints here:

Ideally, you would want to fine-tune the pre-trained model with your data. I guess you need to use --continue_train.

@ivaxsirc
Copy link

ivaxsirc commented Jan 17, 2022 via email

@woctezuma
Copy link
Author

woctezuma commented Jan 17, 2022

Thank you, this is interesting. Chaofeng pointed to relevant repositories for your objective:

  • csxmli2016/GFRNet at ECCV 2018: this looks like your problem of interest,
  • csxmli2016/ASFFNet at CVPR 2020: this repository does not have public code, and it does not look like it will ever have.

Maybe you can find other recent papers or open-source repositories which would cite these papers.
From there, maybe you would be able to find software implementations in the programming languages which you are more accustomed with.

Sadly, I cannot help you with these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment