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

[Feature] Support of perceptual loss in style transfer #445

Open
Taited opened this issue Oct 10, 2022 · 7 comments
Open

[Feature] Support of perceptual loss in style transfer #445

Taited opened this issue Oct 10, 2022 · 7 comments
Assignees
Labels
community/good first issue an issue ready for a new contributor kind/feature request new feature/model/datasets/config etc. priority/P0 highest priority
Milestone

Comments

@Taited
Copy link
Contributor

Taited commented Oct 10, 2022

The manipulation of images could be seen as a conditioned generation. Therefore, the commonly used perceptual loss in style transfer is essential in some generation tasks. However, the mmgeneration only supports perceptual loss in the LPIP metric.

Is it possible to support the perceptual loss for style transfer as in the mmediting?

@zengyh1900 zengyh1900 added awaiting response kind/feature request new feature/model/datasets/config etc. priority/P0 highest priority labels Oct 12, 2022
@zengyh1900 zengyh1900 added this to the 0.8.0 milestone Oct 12, 2022
@zengyh1900
Copy link
Collaborator

Please check this issue. Have we support perceptual loss in MMGeneration?

@plyfager
Copy link
Collaborator

Sure, it's an commonly used feature. We will add this to backlog. We will appreciate it a lot if you'd like to make a PR.

@plyfager plyfager modified the milestones: 0.8.0, Backlog Oct 13, 2022
@plyfager plyfager added community/good first issue an issue ready for a new contributor and removed awaiting response labels Oct 13, 2022
@plyfager plyfager changed the title Support of perceptual loss in style transfer [Feature] Support of perceptual loss in style transfer Oct 13, 2022
@Taited
Copy link
Contributor Author

Taited commented Oct 13, 2022

Thank you for your response. I am very willing to make a PR for adapting the perceptual loss from mmediting to mmgeneration. However, I have a few issues that need to discuss first.

  1. Should the perceptual loss be implemented within mmgen/models/losses/gen_auxiliary_loss.py? Or I should create a new file like mmgen/models/losses/perceptual_loss.py
  2. Should the class name PerceptualLoss be distinguished from the one in LPIP's PerceptualLoss? If it is true, what's your suggestions with the name?

@plyfager
Copy link
Collaborator

Here are my suggestion.

  1. You may implement the perceptual loss within mmgen/models/losses/gen_auxiliary_loss.py, then you can add it to your training config.
  2. Since perceptual loss here is mainly used to calculate PPL metric. You may just use the same class name.

@plyfager
Copy link
Collaborator

  1. In 1.x, we just remove PeceptualLoss class and use lpips package instead. You may also use this package for your class.

@plyfager
Copy link
Collaborator

Since now we are merging this repo into MMEditing. I also recommend you to try MMEdit-1.x and add this loss item there :).

@Taited
Copy link
Contributor Author

Taited commented Oct 14, 2022

Thank you for your suggestions.

I have a problem with the returned values. Typically, a loss module in mmgeneration returns one value. However, the PerceptualLoss often returns loss_percep and loss_style. Should the PerceptualLoss return a sum of these two losses or should I separate the loss_style into another loss module?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community/good first issue an issue ready for a new contributor kind/feature request new feature/model/datasets/config etc. priority/P0 highest priority
Projects
None yet
Development

No branches or pull requests

3 participants