Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Upscale Face / Remove Background nodes in NCNN (for older AMD GPU) #3001

Open
Disonantemus opened this issue Jul 17, 2024 · 4 comments
Open

Comments

@Disonantemus
Copy link

Motivation

  • My GPU is AMD and very old (RTX 580) and I don't have the money 2 upgrade.
  • I can use NCNN models that do use GPU, and are A LOT faster than CPU only.
  • PyTorch and ONNX sections work, but with CPU only and VERY SLOW.
  • ROCm only support a few newer/expensive AMD GPU.

Description

  • Add "Upscale Face" node from PyTorch section into NCNN (very useful).
  • Add "Remove Background" node from ONNX section into NCNN (optional).

Alternatives

I don't know of any alternative, maybe:

  • Allow subType: "FaceSR" when converting to NCNN model (right know shows an error).
  • Allow to upscale with subType:"FaceSR" with "Upscale Image" node (NCNN); and do later the post processing blending with both images (Face+Background) in an editor (like GIMP).

I'm very happy and grateful with the things that you can do in ChaiNNer (without dependency hell or knowing python).

@joeyballentine
Copy link
Member

The face models cannot be converted to NCNN as far as I'm aware. Not sure about the background removal ones though

@Disonantemus
Copy link
Author

Disonantemus commented Jul 17, 2024

  • Is there an easy way to use those models besides ChaiNNer (or maybe ComfyUI)?
  • Maybe, as a regular upscaler? and do the blending later in an editor.

I found those same models in ONNX format within ChaiNNer, but there is no "Upscale Face" in the ONNX section.

I did found today RestoreFormerPlusPlus in .ckpt that didn't work in ChaiNNer. Later I found an ONNX version, but not a .pth, then because ONNX section doesn't have "Upscale Face", then, I can't test it.

But it doesn't help either, because my GPU doesn't work in ONNX mode, only CPU.

@Efenstor
Copy link

For face upscale with NCNN there is a half-abandoned project: https://github.com/onuralpszr/GFPGAN-ncnn-vulkan. A couple of years ago I tried it and it worked. It uses a somewhat outdated model GFPGANCleanv1-NoCE-C2. Still it cannot be loaded into chaiNNer as is.

@Disonantemus
Copy link
Author

Disonantemus commented Aug 27, 2024

For face upscale with NCNN there is a half-abandoned project: https://github.com/onuralpszr/GFPGAN-ncnn-vulkan. A couple of years ago I tried it and it worked. It uses a somewhat outdated model GFPGANCleanv1-NoCE-C2. Still it cannot be loaded into chaiNNer as is.

I was able to compile it, as it is, has some quirks:

  • No help at all.
  • No custom parameters (as other ncnn upscalers), like: scaling, output file, model folder, denoise, etc.
  • Only 2x.
  • Only change faces, not clothes or background (from code, should use real_esrgan 4 that).
  • No model folder.
  • Fixed output filename: result.png

Is better than nothing.


There is a fork, but got worst experience:

  • 512x512 output (square aspect ratio).
  • Non realistic results.
  • Has a lot of strange commits "auto" (1607 commits ahead) doing similar things like:
- import os,sys,aifc
- l=3
+ import os,sys,errno
+ d=9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants