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

Use of masks and Highpass filter #70

Closed
arshagarwal opened this issue Sep 13, 2020 · 4 comments
Closed

Use of masks and Highpass filter #70

arshagarwal opened this issue Sep 13, 2020 · 4 comments

Comments

@arshagarwal
Copy link

I would like to understand the intuition and improvement attained by using masks and w_hpf as in the following lines:

  1. At solver.py Line 106:
    masks = nets.fan.get_heatmap(x_real) if args.w_hpf > 0 else None
  2. At mode.py Line 182-185:
if (masks is not None) and (x.size(2) in [32, 64, 128]):
                mask = masks[0] if x.size(2) in [32] else masks[1]
                mask = F.interpolate(mask, size=x.size(2), mode='bilinear')
                x = x + self.hpf(mask * cache[x.size(2)])

PS: I think both stargan and stargan v2 are impeccable researches.

@yunjey
Copy link
Collaborator

yunjey commented Oct 16, 2020

@arshagarwal Sorry for a late reply. The purpose of introducing masks is to accurately preserve face landmarks (i.e., eyes, nose) of a source image during translation. The hyperparameter w_hpf controls the strength of the preservation. If you increase the value of w_hpf, then the generator preserve the source landmarks more precisely, but it would decrease the reflection of reference styles.

@arshagarwal
Copy link
Author

Understood, thanks for the answer. @yunjey

@leonardodora
Copy link

@arshagarwal Sorry for a late reply. The purpose of introducing masks is to accurately preserve face landmarks (i.e., eyes, nose) of a source image during translation. The hyperparameter w_hpf controls the strength of the preservation. If you increase the value of w_hpf, then the generator preserve the source landmarks more precisely, but it would decrease the reflection of reference styles.

hello, I want to konw that is w_hpf range from 0.0 to 1.0(like 0.2, 0.5...) ?

@yunjey
Copy link
Collaborator

yunjey commented Oct 28, 2020

@leonardodora You can set w_hpf higher than 1 for strong source preservation.

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