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 AnimeGANv2 model #102

Merged
merged 6 commits into from
Dec 5, 2020
Merged

Add AnimeGANv2 model #102

merged 6 commits into from
Dec 5, 2020

Conversation

zhen8838
Copy link
Contributor

@zhen8838 zhen8838 commented Dec 1, 2020

  • add AnimeGANv2 training and testing
  • add AnimeGANv2 apps
  • add AnimeGANv2 docs
  • add summary tool in utils
    can get model structure like torchsummary
    from ppgan.models.discriminators.discriminator_animegan import AnimeDiscriminator
    from ppgan.utils.summary import summary
    model = AnimeDiscriminator()
    summary(model, (3, 256, 256))

@CLAassistant
Copy link

CLAassistant commented Dec 1, 2020

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@qingqing01 qingqing01 left a comment

Choose a reason for hiding this comment

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

Excellent work! Thanks very much!


### 1.2.1 Prepare dataset

We download the dataset provided by the author from [here](https://github.com/TachibanaYoshino/AnimeGAN/releases/download/dataset-1).Then unzip to the `data` directory.
Copy link
Collaborator

Choose a reason for hiding this comment

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

https://github.com/TachibanaYoshino/AnimeGAN/releases/download/dataset-1 is a dead link, should be

https://github.com/TachibanaYoshino/AnimeGAN/releases/tag/dataset-1

Better to give download command:

wget https://github.com/TachibanaYoshino/AnimeGAN/releases/download/dataset-1/dataset.zip

**NOTE:** you must modify the `configs/animeganv2.yaml > pretrain_ckpt ` parameter first! ensure the GAN can reuse the warmup generator model.
```sh
python tools/main.py --config-file configs/animeganv2.yaml
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add the training hyper params in doc to tell users how to reproduce the results. For example, how many GPU used? training step, batch-size, lr... can refer config. and so on.

python tools/main.py --config-file configs/animeganv2.yaml --evaluate-only --load ${PATH_OF_WEIGHT}
```

## 1.3 结果展示
Copy link
Collaborator

Choose a reason for hiding this comment

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

结果展示 -> Results

@@ -0,0 +1,73 @@
import os
Copy link
Collaborator

@qingqing01 qingqing01 Dec 1, 2020

Choose a reason for hiding this comment

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

Maybe also can add copyright, and add author zhen8838 after copyright. same as below

Iterable = collections.Iterable
else:
Sequence = collections.abc.Sequence
Iterable = collections.abc.Iterable
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove the unsed importing, like Image, sin, cos, tan, .. collections...



def add(image, value):
return np.clip(image + value, 0, 255).astype('uint8')
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems only needs functional.py


@TRANSFORMS.register()
class Add(T.BaseTransform):
def __init__(self, value, keys=None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better to add commens. Although, there is no comments in the existing code. We will add in future

from ..solver import build_optimizer
from ..modules.init import init_weights
from ..utils.filesystem import load
from paddle import nn
Copy link
Collaborator

@qingqing01 qingqing01 Dec 1, 2020

Choose a reason for hiding this comment

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

put this line in second line.

system importing, then third-party lib importing, then locally importing

return x


class resBlock(nn.Layer):
Copy link
Collaborator

Choose a reason for hiding this comment

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

resBlock -> ResBlock

import numpy as np


def summary(model, input_size, batch_size=-1):
Copy link
Collaborator

Choose a reason for hiding this comment

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

try paddle.summary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😂 Ok

@zhen8838
Copy link
Contributor Author

zhen8838 commented Dec 2, 2020

Thanks for the review😝, I have made the following changes in the new commit:

  1. fix docs bug, add more details
  2. add copyright in each file
  3. In order to follow the original paddlepaddle transform design, I still keep functional_cv2.py
  4. add some comments in transforms.py
  5. modify the import order, rename resBlock
  6. remove custom summary.py

@qingqing01
Copy link
Collaborator

@zhen8838 There is conflict. And we are do testing now. Will be merged after passing the testing.

@qingqing01 qingqing01 merged commit 10de3c6 into PaddlePaddle:master Dec 5, 2020
@zhen8838 zhen8838 deleted the animeganv2 branch December 9, 2020 11:05
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.

4 participants