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] Implement of sngan_proj #42

Merged
merged 13 commits into from
Jun 16, 2021
Merged

Conversation

LeoXing1996
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@nbei nbei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further comments

mmgen/models/architectures/sngan_proj/modules.py Outdated Show resolved Hide resolved
mmgen/models/architectures/sngan_proj/modules.py Outdated Show resolved Hide resolved
mmgen/models/architectures/sngan_proj/modules.py Outdated Show resolved Hide resolved
mmgen/models/architectures/sngan_proj/modules.py Outdated Show resolved Hide resolved
mmgen/models/architectures/sngan_proj/modules.py Outdated Show resolved Hide resolved
mmgen/models/architectures/sngan_proj/modules.py Outdated Show resolved Hide resolved
mmgen/models/architectures/sngan_proj/modules.py Outdated Show resolved Hide resolved
@nbei nbei requested review from nbei and plyfager June 4, 2021 06:09
@nbei nbei self-assigned this Jun 4, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jun 4, 2021

Codecov Report

Merging #42 (6c8aef7) into master (548112e) will increase coverage by 1.36%.
The diff coverage is 80.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #42      +/-   ##
==========================================
+ Coverage   73.78%   75.15%   +1.36%     
==========================================
  Files         113      117       +4     
  Lines        7080     7457     +377     
  Branches     1272     1358      +86     
==========================================
+ Hits         5224     5604     +380     
+ Misses       1516     1454      -62     
- Partials      340      399      +59     
Flag Coverage Δ
unittests 75.15% <80.90%> (+1.36%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmgen/models/architectures/sngan_proj/modules.py 79.09% <79.09%> (ø)
...rchitectures/sngan_proj/generator_discriminator.py 81.67% <81.67%> (ø)
mmgen/models/architectures/__init__.py 100.00% <100.00%> (ø)
mmgen/models/architectures/sngan_proj/__init__.py 100.00% <100.00%> (ø)
mmgen/models/gans/__init__.py 100.00% <100.00%> (ø)
mmgen/utils/__init__.py 100.00% <100.00%> (ø)
mmgen/utils/dist_util.py 100.00% <100.00%> (ø)
mmgen/models/architectures/stylegan/mspie.py 91.58% <0.00%> (ø)
...chitectures/stylegan/generator_discriminator_v1.py 89.83% <0.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 548112e...6c8aef7. Read the comment docs.

@LeoXing1996 LeoXing1996 requested a review from nbei June 5, 2021 09:57
Copy link
Collaborator

@nbei nbei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments for the generator and discriminator.

auto_sync_bn=True,
with_spectral_norm=False,
norm_eps=1e-4,
style='BigGAN'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This style is only for initialization. Thus, I may recommend using init_cfg=dict(style='BigGAN').

layer. Defaults to ``dict(type='ReLU')``.
with_spectral_norm (bool, optional): Whether use spectral norm for
all conv blocks or not. Default to True.
style (string, optional): Behavior and initialization style of the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer to the generator.

out = out + torch.sum(w_y * h, dim=1, keepdim=True)
return out.view(out.size(0), -1)

def init_weights(self, pretrained=None, strict=True):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer to the comments in generator

conv_cfg=None,
with_spectral_norm=False,
norm_eps=1e-4,
style='BigGAN'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init_cfg=dict(styel='BigGAN') may be better.

mmgen/models/architectures/sngan_proj/modules.py Outdated Show resolved Hide resolved
if self.use_cbn:
weight = self.weight_embedding(y)[:, :, None, None]
bias = self.bias_embedding(y)[:, :, None, None]
if self.style == 'BigGAN':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, I may suggest using the original reweight_embedding. You just need to specify why we need this trick in comments.

@nbei
Copy link
Collaborator

nbei commented Jun 16, 2021

Unit-test should be further added for more coverage rate.

@nbei nbei changed the title [WIP] Implement of sngan_proj [Feature] Implement of sngan_proj Jun 16, 2021
@nbei nbei merged commit 2b89ebf into open-mmlab:master Jun 16, 2021
LeoXing1996 added a commit that referenced this pull request Jul 16, 2022
* init of sngan

* fix bug in version 1

* add default_args to build_module

* refine the implementation

* refine code + add unit test

* fix typo

* remove inplace relu

* fix bug in weight init

* add unit test + fix bug in models

* fix bug in unit test
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

Successfully merging this pull request may close these issues.

None yet

4 participants