Skip to content

Commit

Permalink
remove codeformer
Browse files Browse the repository at this point in the history
  • Loading branch information
xinntao committed Sep 16, 2022
1 parent 3fd33ab commit bc5a5de
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 659 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ It leverages rich and diverse priors encapsulated in a pretrained face GAN (*e.g

:triangular_flag_on_post: **Updates**

- :white_check_mark: Add CodeFormer ([CC BY-NC-SA 4.0 License](https://creativecommons.org/licenses/by-nc-sa/4.0/)) and RestoreFormer.
- :white_check_mark: Add [RestoreFormer](https://github.com/wzhouxiff/RestoreFormer) inference codes.
- :white_check_mark: Add [V1.4 model](https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.4.pth), which produces slightly more details and better identity than V1.3.
- :white_check_mark: Add **[V1.3 model](https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth)**, which produces **more natural** restoration results, and better results on *very low-quality* / *high-quality* inputs. See more in [Model zoo](#european_castle-model-zoo), [Comparisons.md](Comparisons.md)
- :white_check_mark: Integrated to [Huggingface Spaces](https://huggingface.co/spaces) with [Gradio](https://github.com/gradio-app/gradio). See [Gradio Web Demo](https://huggingface.co/spaces/akhaliq/GFPGAN).
Expand Down
20 changes: 2 additions & 18 deletions cog_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ def setup(self):
os.system(
'wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/RestoreFormer.pth -P ./gfpgan/weights'
)
if not os.path.exists('gfpgan/weights/CodeFormer.pth'):
os.system(
'wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/CodeFormer.pth -P ./gfpgan/weights')

# background enhancer with RealESRGAN
model = SRVGGNetCompact(num_in_ch=3, num_out_ch=3, num_feat=64, num_conv=32, upscale=4, act_type='prelu')
Expand All @@ -71,17 +68,11 @@ def predict(
img: Path = Input(description='Input'),
version: str = Input(
description='GFPGAN version. v1.3: better quality. v1.4: more details and better identity.',
choices=['v1.2', 'v1.3', 'v1.4', 'RestoreFormer', 'CodeFormer'],
choices=['v1.2', 'v1.3', 'v1.4', 'RestoreFormer'],
default='v1.4'),
scale: float = Input(description='Rescaling factor', default=2),
weight: float = Input(
description='Weight, only for CodeFormer. 0 for better quality, 1 for better identity',
default=0.5,
ge=0,
le=1.0)
) -> Path:
if not isinstance(weight, (int, float)):
weight = 0.5
weight = 0.5
print(img, version, scale, weight)
try:
extension = os.path.splitext(os.path.basename(str(img)))[1]
Expand Down Expand Up @@ -130,13 +121,6 @@ def predict(
arch='RestoreFormer',
channel_multiplier=2,
bg_upsampler=self.upsampler)
elif version == 'CodeFormer':
self.face_enhancer = GFPGANer(
model_path='gfpgan/weights/CodeFormer.pth',
upscale=2,
arch='CodeFormer',
channel_multiplier=2,
bg_upsampler=self.upsampler)

try:
_, _, output = self.face_enhancer.enhance(
Expand Down
Loading

0 comments on commit bc5a5de

Please sign in to comment.