GithubHelp home page GithubHelp logo

animeganv2_tensorflow2's Introduction

AnimeGANv2_Tensorflow2 中文

Reference source AnimeGANv2 project, rewritten with TensorFlow2 to implement

Installation and testing environment

GPU:3060 batch_size=10 Training time is 11min/epoch

  • tensorflow==2.8.0
  • tensorflow-addons==0.16.1
  • wandb
  • tqdm==4.63.1
  • PyYAML
  • opencv-python==4.5.5

Usage

Training

python train.py --config_path config/config-defaults.yaml --dataset Hayao --hyperparameters False
  • --config_path the configuration file path is under config/config-defaults.yaml by default, which is the hyperparameter configuration of the project
  • --dataset the name of the dataset
  • --hyperparameters whether to enable hyperparameter search for wandb
  • --pre_train_weight Pre-training weights, which can be loaded with previously trained model weights for fine-tuning and then trained into a new model

Testing

Training process

loss variation

Discriminator related losses

image-20220624202624359

Generator related losses

image-20220624202832128

Relative change in loss of generators and discriminators

image-20220624202944846

As can be seen from the loss, the generator and discriminator produced an obvious confrontation effect, the generator loss into an upward trend, discriminator loss into a downward trend, due to the training of the relevant loss weight is in accordance with the way recommended by the original author, and the original author training effect has a certain difference, you need to adjust again

Image verification results

图片1

pic2

pic3

The overall animation style of the picture effect is relatively strong compared to the original author, but the picture details are missing more and the picture color is stronger, which needs to be further improved by adjusting the loss weight

License

  • This version is for academic research and non-commercial use only, if used for commercial purposes, please contact me for licensing approval

animeganv2_tensorflow2's People

Contributors

jiyegege avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

animeganv2_tensorflow2's Issues

How many epoches you have trained to achieve your training results?

Thank you very much for your work, I did some attempts to convert from animeganv2_tf1 to tf2 before but failed.
But there is a question I want to ask. How many epochs you have trained to achieve your training results?
My results after 400 epochs are still poor, I don't know if it's a configuration issue or something else.
1

About style loss

According to the generator's style loss provided by https://github.com/TachibanaYoshino/AnimeGANv2/blob/617ab10ce21877df90c9cf2b705712bc81b1e2e6/tools/ops.py
Maybe function gram() should be expressed like:

feat = tf.linalg.einsum('bijc,bijd->bcd', x, x)
num_locations = tf.math.reduce_prod(x.shape[1:])
num_locations = tf.cast(num_locations, dtype=tf.float32)

feat = feat/num_locations

Otherwise, it may cause generator gradient explosion, and difficult to achieve Antagonism effect

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.