yangxy / GPEN

2.35k stars 449 forks source link

How to work with other super-resolution tools ? #64

Open Michaelwhite34 opened 2 years ago

Michaelwhite34 commented 2 years ago

Suppose I have a folder of enhanced images of the same name, how to just paste enhanced face to these images without scaling original images ?

yangxy commented 2 years ago

The scaling in face_enhancement.py is optional. I did it to better detect the faces due to the faces in the original images are too small.

If you want to combine a super-resolution method with GPEN, I suggest the following steps:

  1. employing the SR method on the original image to get SR result;
  2. resizing the original image to the size of the SR output;
  3. performing GPEN on the resized original image;
  4. pasting enhanced faces back to the SR result.

The last step can be readily achieved by reformulating img = cv2.convertScaleAbs(img*(1-full_mask) + full_img*full_mask) in face_enhancement.py to img = cv12.convertScaleAbs(img_sr*(1-full_mask) + full_img*full_mask).

I will update a combined version soon.

Michaelwhite34 commented 2 years ago

The scaling in face_enhancement.py is optional. I did it to better detect the faces due to the faces in the original images are too small.

If you want to combine a super-resolution method with GPEN, I suggest the following steps:

  1. employing the SR method on the original image to get SR result;
  2. resizing the original image to the size of the SR output;
  3. performing GPEN on the resized original image;
  4. pasting enhanced faces back to the SR result.

The last step can be readily achieved by reformulating img = cv2.convertScaleAbs(img*(1-full_mask) + full_img*full_mask) in face_enhancement.py to img = cv12.convertScaleAbs(img_sr*(1-full_mask) + full_img*full_mask).

I will update a combined version soon.

Thanks for the reply, where can I disable the scaling ?

yangxy commented 2 years ago

I have integrated SR with GPEN. Please have a try.

Michaelwhite34 commented 2 years ago

I have integrated SR with GPEN. Please have a try.

It works fine.A question tho,can we super-resolution multiple times and apply the face image.Suppose I have a 500500 photo and I want to super-resolution 2 times to get 20002000.

Michaelwhite34 commented 2 years ago

Also,I notice that there will always be "face detail" on noisy photos.When the training comes out,will it be easier to train a model that generates cleaner and soft face like remini ?

Lyntai commented 2 years ago

I have integrated SR with GPEN. Please have a try.

Hello, I think the code on Colab needs an update after this change, i get this error: "FileNotFoundError: [Errno 2] No such file or directory: './weights/rrdb_realesrnet_psnr.pth'"

After manually loading the file into Colab, I get this error:

"ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 1136 and the array at index 1 has size 2272"

Thank you.

yangxy commented 2 years ago

I have integrated SR with GPEN. Please have a try.

Hello, I think the code on Colab needs an update after this change, i get this error: "FileNotFoundError: [Errno 2] No such file or directory: './weights/rrdb_realesrnet_psnr.pth'"

After manually loading the file into Colab, I get this error:

"ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 1136 and the array at index 1 has size 2272"

Thank you.

updated.

haiderasad commented 2 years ago

Also,I notice that there will always be "face detail" on noisy photos.When the training comes out,will it be easier to train a model that generates cleaner and soft face like remini ?

did you find anything that comes closer to remini? @Michaelwhite34

Michaelwhite34 commented 2 years ago

Also,I notice that there will always be "face detail" on noisy photos.When the training comes out,will it be easier to train a model that generates cleaner and soft face like remini ?

did you find anything that comes closer to remini? @Michaelwhite34

At this point I would say gpen is as good as remini as long as your input is not messed up like small size gifs.If you use cleaner dataset to train gpen, it will look closer to remini.

haiderasad commented 2 years ago

@Michaelwhite34 have yet to try gpen but uptill now GFPGAN gives the best results in comparison with remini , also heard about DFDNet but not yet implementaed

Michaelwhite34 commented 2 years ago

@Michaelwhite34 have yet to try gpen but uptill now GFPGAN gives the best results in comparison with remini , also heard about DFDNet but not yet implementaed

I tried all these,gpen is still best.GFPgan is too sharp,DFDNet is not high quality enough.GFPgan V1.3 model is softer,the result face will be cleaner(Here I mean some detail will be lost,the skin looks softer,the identity changes a bit,like different eye color,wipe out hair fly away).

haiderasad commented 2 years ago

@Michaelwhite34 that is very interesting saves me the time, thanks for the insight

haiderasad commented 2 years ago

@Michaelwhite34 can you please share the GPEN-BFR-2048 pretrained model as its been taken down

Michaelwhite34 commented 2 years ago

@Michaelwhite34 can you please share the GPEN-BFR-2048 pretrained model as its been taken down

That's weird,you can ask the author why it was taken down ? Never mind,I saw commerical reasons.

haiderasad commented 2 years ago

yes, can you send the file at my email, haiderasadbhutta@gmail.com @Michaelwhite34

elen07zz commented 2 years ago

@Michaelwhite34 can you please share the GPEN-BFR-2048 pretrained model as its been taken down

That's weird,you can ask the author why it was taken down ? Never mind,I saw commerical reasons.

yes, can you send the file at my email, haiderasadbhutta@gmail.com @Michaelwhite34

could you share it with me?

elena7gzz@gmail.com

BbChip0103 commented 2 years ago

@Michaelwhite34 @farasas @haiderasad

If you have GPEN-BFR-2048 checkpoint, can you share it to me also? Please save me. bbchip13@gmail.com

yannis-tml commented 2 years ago

Hi, could you share me the model by email too please? @farasas @BbChip0103 @Michaelwhite34

tumelinyannis@gmail.com

zimenglan-sysu-512 commented 7 months ago

@Michaelwhite34 @farasas @haiderasad

If you have GPEN-BFR-2048 and GPEN-BFR-1024 checkpoint, can you share it to me also? Please save me. dongdk.sysu@foxmail.com