Giter Site home page Giter Site logo

animeganv2's Introduction

AnimeGANv2

「Open Source」. The improved version of AnimeGAN.
Project Page」 | Landscape photos/videos to anime

If you like what I'm doing you can tip me on patreon.

Photos Colab

Videos Colab for videos


News


Focus:

Anime style Film Picture Number Quality Download Style Dataset
Miyazaki Hayao The Wind Rises 1752 1080p Link
Makoto Shinkai Your Name & Weathering with you 1445 BD
Kon Satoshi Paprika 1284 BDRip

News:

The improvement directions of AnimeGANv2 mainly include the following 4 points:  
  • 1. Solve the problem of high-frequency artifacts in the generated image.

  • 2. It is easy to train and directly achieve the effects in the paper.

  • 3. Further reduce the number of parameters of the generator network. (generator size: 8.17 Mb), The lite version has a smaller generator model.

  • 4. Use new high-quality style data, which come from BD movies as much as possible.

          AnimeGAN can be accessed from here.


Requirements

  • python 3.6
  • tensorflow-gpu 1.15.0 (GPU 2080Ti, cuda 10.0.130, cudnn 7.6.0)
  • opencv
  • tqdm
  • numpy
  • glob
  • argparse
  • onnxruntime (If onnx file needs to be run.)

Usage

1. Inference

python test.py --checkpoint_dir checkpoint/generator_Hayao_weight --test_dir dataset/test/HR_photo --save_dir Hayao/HR_photo

2. Convert video to anime

python video2anime.py --video video/input/お花見.mp4 --checkpoint_dir checkpoint/generator_Hayao_weight --output video/output

3. Train

1. Download vgg19

vgg19.npy

2. Download Train/Val Photo dataset

Link

3. Do edge_smooth

python edge_smooth.py --dataset Hayao --img_size 256

4. Train

python train.py --dataset Hayao --epoch 101 --init_epoch 10

5. Extract the weights of the generator

python get_generator_ckpt.py --checkpoint_dir ../checkpoint/AnimeGANv2_Shinkai_lsgan_300_300_1_2_10_1 --style_name Shinkai


Results


😍 Photo to Paprika Style













😍 Photo to Hayao Style













😍 Photo to Shinkai Style











License

This repo is made freely available to academic and non-academic entities for non-commercial purposes such as academic research, teaching, scientific publications. Permission is granted to use the AnimeGANv2 given that you agree to my license terms. Regarding the request for commercial use, please contact us via email to help you obtain the authorization letter.

Author

Xin Chen

animeganv2's People

Contributors

tachibanayoshino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

animeganv2's Issues

Cannot understand rgb2yuv function code

def rgb2yuv(rgb):
    """
    Convert RGB image into YUV https://en.wikipedia.org/wiki/YUV
    """
    rgb = (rgb + 1.0)/2.0
    return tf.image.rgb_to_yuv(rgb)

tf.image.rgb_to_yuv(rgb) do the op: rgb_to_yuv
so,I can't understand what this line of code means: "rgb = (rgb + 1.0)/2.0"

continue training

Excuse me,how do I continue training which based on the saved model (for example, now trained to model 47) ,what do i do?

What is the proper URL?

--2021-05-07 06:08:30-- https://github.com/TachibanaYoshino/AnimeGAN/releases/download/Haoyao-style_V1.0/Haoyao-style.zip
Resolving github.com (github.com)... 140.82.112.4
Connecting to github.com (github.com)|140.82.112.4|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-05-07 06:08:31 ERROR 404: Not Found.

unzip: cannot find or open /content/AnimeGAN/Haoyao-style.zip, /content/AnimeGAN/Haoyao-style.zip.zip or /content/AnimeGAN/Haoyao-style.zip.ZIP.
rm: cannot remove '/content/AnimeGAN/Haoyao-style.zip': No such file or directory
cp: cannot stat '/content/AnimeGAN/vgg19.npy': No such file or directory
rm: cannot remove '/content/AnimeGAN/vgg19.npy': No such file or directory

关于模型的研究咨询

 你好,想问一下您在paddle发布的模型是基于什么样大小的图片训练的?训练集和实景图片也添加了电影中的一些爆炸场景和黑暗场景。但是最后出来的颜色很奇怪。和绿植,城市场景优秀的效果完全没法比。 我想和您探讨一下可能的原因:1 ,我训练的时候把1080p的图片等比例缩小到256p训练。而不是像您一样直接裁剪成多个256p。2,黑暗场景可能不适用于[13.1360,-8.6698,-4.4661]这样的参数。
 因为即便是训练集的参数,直接用于测试风格迁移,也得不到像展示的那样好的效果
 请问能指教一下愚钝的我吗?

Colab

Add a colab, please

typo on the folders

Hello Author!
your folder naming has a typo though It's kinda annoying to rename it again and again cuz I'm using google colab cuz I tried to use shinkai
image
image

Can I train a Anime2Anime model?

Can I put anime images in the train_photo folder, and run the training process in order to make the origin anime images more like Hayao/Kon/Shinkai style?

I think this may work better than transferring a real-life image to an anime one. And I want to make a very significant anime-style transfer. Hope to get some advice from you. Thanks.

Could you share how you get the improvements that you mentioned in the readme?

Hi,
Could you share how you get these 3 improvements that you mentioned in the readme?


  1. Solve the problem of high-frequency artifacts in the generated image.

  2. It is easy to train and directly achieve the effects in the paper.

  3. Further reduce the number of parameters of the generator network. (generator size: 8.17 Mb), The lite version has a smaller generator model.


实时风格转换

请问这个模型能支持实时的风格转换的实现吗,比如是打开电脑的摄像头,将拍摄到的场景实时的转换,转换为动漫风格的画面?

AnimeGANv3

Was wondering if AnimeGANv3 was being released?

Training code coming soon?

Hello Tachibana san,
Great work and congratulations on the work on AnimeGANv2. I had good success in converting the models and running the models on Android. However the latency is still an issue, it takes about 500 ms to run a 128x128 patch of image using Tensorflow Android(I tried tflite but it increases the inference time strangely.)
I want to modify the network architecture and optimize its performance further to make it a real-time application (under 100 ms)
So to cut a long story short, are you planning to release the training code in near future? :)

Thank you.

the generated pictures are some vague

Due to the use of GPU to indicate that there was not enough memory, I used the CPU option and paprika.pt.
But the generated pictures are some vague.
It seems to be blurred.
How can I improve the picture definition?

license

can you please add a license file

Error when running train step

Hi,
I want to ask if the master branch can run the train step?
python main.py --phase train --dataset Hayao --data_mean [13.1360,-8.6698,-4.4661] --epoch 101 --init_epoch 10
I got a lot of errors running above command.
Example:
Traceback (most recent call last):
File "main.py", line 114, in
main()
File "main.py", line 106, in main
gan.train()
File "/home/kimhoang/emvn/AnimeGANv2/AnimeGANv2.py", line 233, in train
anime, anime_smooth, real = self.sess.run([anime_img_op, anime_smooth_op, real_img_op])
File "/home/kimhoang/.pyenv/versions/3.6.0/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 956, in run
run_metadata_ptr)
File "/home/kimhoang/.pyenv/versions/3.6.0/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run
feed_dict_tensor, options, run_metadata)
File "/home/kimhoang/.pyenv/versions/3.6.0/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run
run_metadata)
File "/home/kimhoang/.pyenv/versions/3.6.0/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: {{function_node _inference_Dataset_map_16913}} UFuncTypeError: Cannot cast ufunc 'add' output from dtype('<U32') to dtype('float32') with casting rule 'same_kind'

edge_smooth.pyについて

  1. Do edge_smooth
    python edge_smooth.py --dataset Hayao --img_size 256

edge_smooth.pyっていうファイルがないですが、このステップを飛ばしても大丈夫でしょうか?

Exception has occurred: OperatorNotAllowedInGraphError

A OperatorNotAllowedInGraphError throw out when I train AnimeGAN, witch I choose 'wgan-gp' as the defualt training gan. Exception trace log as follows:

['', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages', '/hy-tmp/AnimeGANv2-master/tools/..']
init test
WARNING:tensorflow:From main.py:111: The name tf.GPUOptions is deprecated. Please use tf.compat.v1.GPUOptions instead.

WARNING:tensorflow:From main.py:112: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

WARNING:tensorflow:From main.py:112: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

2022-03-24 14:53:45.629430: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
2022-03-24 14:53:45.660248: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2400000000 Hz
2022-03-24 14:53:45.660960: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55c658ac42d0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2022-03-24 14:53:45.660998: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2022-03-24 14:53:45.665129: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2022-03-24 14:53:45.934579: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55c658b497a0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2022-03-24 14:53:45.934642: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Tesla V100-SXM2-16GB, Compute Capability 7.0
2022-03-24 14:53:45.935606: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1639] Found device 0 with properties: 
name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53
pciBusID: 0000:8d:00.0
2022-03-24 14:53:45.936059: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2022-03-24 14:53:45.938338: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2022-03-24 14:53:45.940088: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0
2022-03-24 14:53:45.940606: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0
2022-03-24 14:53:45.944158: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0
2022-03-24 14:53:45.946792: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0
2022-03-24 14:53:45.951124: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2022-03-24 14:53:45.952244: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1767] Adding visible gpu devices: 0
2022-03-24 14:53:45.952294: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2022-03-24 14:53:45.957530: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1180] Device interconnect StreamExecutor with strength 1 edge matrix:
2022-03-24 14:53:45.957555: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1186]      0 
2022-03-24 14:53:45.957564: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1199] 0:   N 
2022-03-24 14:53:45.958626: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1325] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 15061 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:8d:00.0, compute capability: 7.0)
WARNING:tensorflow:From /hy-tmp/AnimeGANv2-master/AnimeGANv2.py:55: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

npy file loaded -------  vgg19_weight/vgg19.npy

##### Information #####
# gan type :  wgan-gp
# light :  False
# dataset :  Paprika
# max dataset number :  6656
# batch_size :  20
# epoch :  500
# init_epoch :  0
# training image size [H, W] :  [256, 256]
# g_adv_weight,d_adv_weight,con_weight,sty_weight,color_weight,tv_weight :  300.0 300.0 2.0 0.6 50.0 0.1
# init_lr,g_lr,d_lr :  0.0002 8e-05 0.00016
# training_rate G -- D: 1 : 1

WARNING:tensorflow:From /hy-tmp/AnimeGANv2-master/AnimeGANv2.py:96: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow_core/contrib/layers/python/layers/layers.py:1057: Layer.apply (from tensorflow.python.keras.engine.base_layer) is deprecated and will be removed in a future version.
Instructions for updating:
Please use `layer.__call__` method instead.
WARNING:tensorflow:From /hy-tmp/AnimeGANv2-master/net/generator.py:41: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead.

WARNING:tensorflow:From /hy-tmp/AnimeGANv2-master/net/generator.py:58: The name tf.image.resize_images is deprecated. Please use tf.image.resize instead.

WARNING:tensorflow:From /hy-tmp/AnimeGANv2-master/AnimeGANv2.py:122: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/.vscode-server/extensions/ms-python.python-2022.2.1924087327/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
    cli.main()
  File "/root/.vscode-server/extensions/ms-python.python-2022.2.1924087327/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 444, in main
    run()
  File "/root/.vscode-server/extensions/ms-python.python-2022.2.1924087327/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 285, in run_file
    runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
  File "/usr/lib/python3.7/runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/usr/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "main.py", line 131, in <module>
    main()
  File "main.py", line 117, in main
    gan.build_model()
  File "/hy-tmp/AnimeGANv2-master/AnimeGANv2.py", line 156, in build_model
    GP = self.gradient_panalty(real=self.anime, fake=self.generated)
  File "/hy-tmp/AnimeGANv2-master/AnimeGANv2.py", line 125, in gradient_panalty
    logit, _= self.discriminator(interpolated, reuse=True, scope=scope)
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/framework/ops.py", line 547, in __iter__
    self._disallow_iteration()
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/framework/ops.py", line 543, in _disallow_iteration
    self._disallow_in_graph_mode("iterating over `tf.Tensor`")
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/framework/ops.py", line 523, in _disallow_in_graph_mode
    " this function with @tf.function.".format(task))
tensorflow.python.framework.errors_impl.OperatorNotAllowedInGraphError: iterating over `tf.Tensor` is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.

I'm not familiar with tensorflow 1.x, does any body can help fix this issus.

在nvidia A4000显卡上无法训练

使用命令python train.py --dataset Hayao --epoch 101 --init_epoch 10
训练过程中提示错误 failed to run cuBLAS routine: CUBLAS_STATUS_EXECUTION_FAILED。
这个要怎么解决?

软件版本:

packages in environment at C:\ProgramData\Anaconda3\envs\py36:

Name Version Build Channel

absl-py 1.0.0 pypi_0 pypi
astor 0.8.1 pypi_0 pypi
cached-property 1.5.2 pypi_0 pypi
certifi 2021.5.30 py36haa95532_0
colorama 0.4.4 pypi_0 pypi
cudatoolkit 10.0.130 0
cudnn 7.6.0 cuda10.0_0
dataclasses 0.8 pypi_0 pypi
gast 0.2.2 pypi_0 pypi
google-pasta 0.2.0 pypi_0 pypi
grpcio 1.44.0 pypi_0 pypi
h5py 3.1.0 pypi_0 pypi
importlib-metadata 4.8.3 pypi_0 pypi
keras-applications 1.0.8 pypi_0 pypi
keras-preprocessing 1.1.2 pypi_0 pypi
markdown 3.3.6 pypi_0 pypi
numpy 1.19.5 pypi_0 pypi
opencv-python 4.5.5.62 pypi_0 pypi
opt-einsum 3.3.0 pypi_0 pypi
pip 21.2.2 py36haa95532_0
protobuf 3.19.4 pypi_0 pypi
python 3.6.2 h09676a0_15
setuptools 58.0.4 py36haa95532_0
six 1.16.0 pypi_0 pypi
tensorboard 1.15.0 pypi_0 pypi
tensorflow-estimator 1.15.1 pypi_0 pypi
tensorflow-gpu 1.15.0 pypi_0 pypi
termcolor 1.1.0 pypi_0 pypi
tqdm 4.62.3 pypi_0 pypi
typing-extensions 4.1.1 pypi_0 pypi
vc 14.2 h21ff451_1
vs2015_runtime 14.27.29016 h5e58377_2
werkzeug 2.0.3 pypi_0 pypi
wheel 0.37.1 pyhd3eb1b0_0
wincertstore 0.2 py36h7fe50ca_0
wrapt 1.13.3 pypi_0 pypi
zipp 3.6.0 pypi_0 pypi

错误日志:
2022-02-23 11:58:11.480753: E tensorflow/stream_executor/cuda/cuda_blas.cc:428] failed to run cuBLAS routine: CUBLAS_STATUS_EXECUTION_FAILED
2022-02-23 11:58:11.483857: E tensorflow/stream_executor/cuda/cuda_blas.cc:428] failed to run cuBLAS routine: CUBLAS_STATUS_EXECUTION_FAILED
2022-02-23 11:58:11.483905: I tensorflow/stream_executor/stream.cc:4976] [stream=000001E1AF327560,impl=000001E1A391B2F0] did not memset GPU location; source: 000000B3A7DCBCE8; size: 8388608; pattern: ffffffff
2022-02-23 11:58:11.486156: I tensorflow/stream_executor/stream.cc:4976] [stream=000001E1AF327560,impl=000001E1A391B2F0] did not memset GPU location; source: 000000B3A760C038; size: 8388608; pattern: ffffffff
2022-02-23 11:58:11.490415: I tensorflow/stream_executor/stream.cc:4976] [stream=000001E1AF327560,impl=000001E1A391B2F0] did not memset GPU location; source: 000000B3A760C058; size: 8388608; pattern: ffffffff
2022-02-23 11:58:11.488390: I tensorflow/stream_executor/stream.cc:4976] [stream=000001E1AF327560,impl=000001E1A391B2F0] did not memset GPU location; source: 000000B3A7DCBD08; size: 8388608; pattern: ffffffff
2022-02-23 11:58:11.493417: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at conv_ops.cc:1006 : Not found: No algorithm worked!
2022-02-23 11:58:11.496159: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at conv_ops.cc:1006 : Not found: No algorithm worked!
2022-02-23 11:58:11.497784: I tensorflow/stream_executor/stream.cc:4976] [stream=000001E1AF327560,impl=000001E1A391B2F0] did not memset GPU location; source: 000000B3A760C038; size: 8388608; pattern: ffffffff
2022-02-23 11:58:11.503459: I tensorflow/stream_executor/stream.cc:4976] [stream=000001E1AF327560,impl=000001E1A391B2F0] did not memset GPU location; source: 000000B3A760C058; size: 8388608; pattern: ffffffff
2022-02-23 11:58:11.505625: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at conv_ops.cc:1006 : Not found: No algorithm worked!
2022-02-23 11:58:11.844846: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at conv_ops.cc:1006 : Not found: No algorithm worked!
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\client\session.py", line 1365, in _do_call
return fn(*args)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\client\session.py", line 1350, in _run_fn
target_list, run_metadata)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\client\session.py", line 1443, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InternalError: 2 root error(s) found.
(0) Internal: Blas GEMM launch failed : a.shape=(786432, 3), b.shape=(3, 3), m=786432, n=3, k=3
[[{{node Tensordot/MatMul}}]]
[[mul_10/_893]]
(1) Internal: Blas GEMM launch failed : a.shape=(786432, 3), b.shape=(3, 3), m=786432, n=3, k=3
[[{{node Tensordot/MatMul}}]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "train.py", line 101, in
main()
File "train.py", line 96, in main
gan.train()
File "E:\AnimeGANv2-master\AnimeGANv2.py", line 248, in train
self.Generator_loss, self.G_loss_merge], feed_dict = train_feed_dict)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\client\session.py", line 956, in run
run_metadata_ptr)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\client\session.py", line 1180, in _run
feed_dict_tensor, options, run_metadata)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\client\session.py", line 1359, in _do_run
run_metadata)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\client\session.py", line 1384, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InternalError: 2 root error(s) found.
(0) Internal: Blas GEMM launch failed : a.shape=(786432, 3), b.shape=(3, 3), m=786432, n=3, k=3
[[node Tensordot/MatMul (defined at C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\framework\ops.py:1748) ]]
[[mul_10/_893]]
(1) Internal: Blas GEMM launch failed : a.shape=(786432, 3), b.shape=(3, 3), m=786432, n=3, k=3
[[node Tensordot/MatMul (defined at C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\framework\ops.py:1748) ]]
0 successful operations.
0 derived errors ignored.

Original stack trace for 'Tensordot/MatMul':
File "train.py", line 101, in
main()
File "train.py", line 91, in main
gan.build_model()
File "E:\AnimeGANv2-master\AnimeGANv2.py", line 155, in build_model
t_loss = self.con_weight * c_loss + self.sty_weight * s_loss + color_loss(self.real,self.generated) * self.color_weight + tv_loss
File "E:\AnimeGANv2-master\tools\ops.py", line 280, in color_loss
con = rgb2yuv(con)
File "E:\AnimeGANv2-master\tools\ops.py", line 309, in rgb2yuv
return tf.image.rgb_to_yuv(rgb)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\ops\image_ops_impl.py", line 2930, in rgb_to_yuv
return math_ops.tensordot(images, kernel, axes=[[ndims - 1], [0]])
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\ops\math_ops.py", line 4071, in tensordot
ab_matmul = matmul(a_reshape, b_reshape)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\util\dispatch.py", line 180, in wrapper
return target(*args, **kwargs)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\ops\math_ops.py", line 2754, in matmul
a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\ops\gen_math_ops.py", line 6136, in mat_mul
name=name)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\framework\op_def_library.py", line 794, in _apply_op_helper
op_def=op_def)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3357, in create_op
attrs, op_def, compute_device)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3426, in _create_op_internal
op_def=op_def)
File "C:\ProgramData\Anaconda3\envs\py36\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1748, in init
self._traceback = tf_stack.extract_stack()

Strange G_vgg loss curve

Hello, thank you for posting this great work!

I have retrained the model with a customized dataset, the results look great but the loss curves seem strange to me.

image

The adversary loss seems ok, I set the weights for D and G to 200 and 300, respectively, and the losses are approaching the equilibrium.

However, the G_vgg loss, which consists of c_loss, s_loss, color_loss, tv_loss, reaches the bottom at around epoch 30 and then starts increasing. I looked at each individual loss among G_vgg_loss, only the s_loss is decreasing over time, and all others starts increasing after epoch 30.
image

Interestingly, the validation samples from epoch 100 is apparently better than the ones from epoch 30. Does anyone experience the same?

ImportError: cannot import name 'trace'

我用的是conda的虚拟环境,tf1.5,但是每次运行实例代码(inference和video transfer)总会出错,不知道问题在哪里呢?google说的是升级tf2.0,感觉问题不在这里..
from tensorflow_estimator.python.estimator import estimator File "C:\Users\XU\.conda\envs\anime\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 36, in <module> from tensorflow.python.profiler import trace ImportError: cannot import name 'trace'

How to train face model?

Is the training method the same as the training landscape photos? The difference is the data set. As long as the human face data is aligned, plus the animation face alignment, is that right?

issue saving checkpoints of model

hello! when I try to train the model, I get the following error when the code tries to save the checkpoint:

Traceback (most recent call last):
  File "main.py", line 115, in <module>
    main()
  File "main.py", line 107, in main
    gan.train()
  File "/content/drive/.shortcut-targets-by-id/1X8hfrOWE2KxmaJG4LFKH9ydVQ4BA7oyZ/cs7643-final-project/AnimeGANv2.py", line 302, in train
    self.save(self.checkpoint_dir, epoch)
  File "/content/drive/.shortcut-targets-by-id/1X8hfrOWE2KxmaJG4LFKH9ydVQ4BA7oyZ/cs7643-final-project/AnimeGANv2.py", line 341, in save
    self.saver.save(self.sess, os.path.join(checkpoint_dir, self.model_name + '.model'), global_step=step)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/training/saver.py", line 1186, in save
    save_relative_paths=self._save_relative_paths)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/training/checkpoint_management.py", line 231, in update_checkpoint_state_internal
    last_preserved_timestamp=last_preserved_timestamp)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/training/checkpoint_management.py", line 110, in generate_checkpoint_state_proto
    model_checkpoint_path = os.path.relpath(model_checkpoint_path, save_dir)
  File "/usr/lib/python3.7/posixpath.py", line 475, in relpath
    start_list = [x for x in abspath(start).split(sep) if x]
  File "/usr/lib/python3.7/posixpath.py", line 383, in abspath
    cwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory

I mounted my google drive into colab and am using colab to train the model. When I check my checkpoint folder, I have two files there but it appears that I am missing the checkpoint binary file and the .meta file. Any idea why this could be happening?
image

What's the purpose of datamean?

I can tell that after datamean, the RBG channel of anime image have the same mean value for the whole style dataset, but I'm confused about it's purpose. Could you please explain what the difference it make?

Run on CPU insted of GPU

Hi,
I Try To run this Project But I have little problem and when I try to start train phase this code is just only run on cpu but I install cudatoolkit and tensorflow-gpu. can u help me ?

2020-12-06 18:00:45.278352: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA     [693/1792]
2020-12-06 18:00:45.302721: E tensorflow/stream_executor/cuda/cuda_driver.cc:397] failed call to cuInit: CUDA_ERROR_NO_DEVICE                                                              
2020-12-06 18:00:45.302766: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:158] retrieving CUDA diagnostic information for host: host-name
2020-12-06 18:00:45.302775: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:165] hostname: host-name
2020-12-06 18:00:45.302816: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:189] libcuda reported version is: 450.66.0
2020-12-06 18:00:45.302853: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:193] kernel reported version is: 450.66.0                                                                 2020-12-06 18:00:45.302863: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:300] kernel version seems to match DSO: 450.66.0

npy file loaded -------  vgg19_weight/vgg19.npy
##### Information #####
# gan type :  lsgan
# light :  False
# dataset :  Hayao
# max dataset number :  6656
# batch_size :  12
# epoch :  101
# init_epoch :  10
# training image size [H, W] :  [256, 256]
# g_adv_weight,d_adv_weight,con_weight,sty_weight,color_weight,tv_weight :  300.0 300.0 1.5 2.5 10.0 1.0
# init_lr,g_lr,d_lr :  0.0002 2e-05 4e-05
# training_rate G -- D: 1 : 1
build model finished: 0.138872s
build model finished: 0.130571s
build model finished: 0.120662s
build model finished: 0.127711s
build model finished: 0.123440s
G:
---------
Variables: name (type shape) [size]
---------
generator/G_MODEL/A/Conv/weights:0 (float32_ref 7x7x3x32) [4704, bytes: 18816]
generator/G_MODEL/A/LayerNorm/beta:0 (float32_ref 32) [32, bytes: 128]
generator/G_MODEL/A/LayerNorm/gamma:0 (float32_ref 32) [32, bytes: 128]
generator/G_MODEL/A/Conv_1/weights:0 (float32_ref 3x3x32x64) [18432, bytes: 73728]
generator/G_MODEL/A/LayerNorm_1/beta:0 (float32_ref 64) [64, bytes: 256]
generator/G_MODEL/A/LayerNorm_1/gamma:0 (float32_ref 64) [64, bytes: 256]
generator/G_MODEL/A/Conv_2/weights:0 (float32_ref 3x3x64x64) [36864, bytes: 147456]
generator/G_MODEL/A/LayerNorm_2/beta:0 (float32_ref 64) [64, bytes: 256]
generator/G_MODEL/A/LayerNorm_2/gamma:0 (float32_ref 64) [64, bytes: 256]
generator/G_MODEL/B/Conv/weights:0 (float32_ref 3x3x64x128) [73728, bytes: 294912]
generator/G_MODEL/B/LayerNorm/beta:0 (float32_ref 128) [128, bytes: 512]
generator/G_MODEL/B/LayerNorm/gamma:0 (float32_ref 128) [128, bytes: 512]
generator/G_MODEL/B/Conv_1/weights:0 (float32_ref 3x3x128x128) [147456, bytes: 589824]
generator/G_MODEL/B/LayerNorm_1/beta:0 (float32_ref 128) [128, bytes: 512]                                                                                                        [649/1792]generator/G_MODEL/B/LayerNorm_1/gamma:0 (float32_ref 128) [128, bytes: 512]
generator/G_MODEL/C/Conv/weights:0 (float32_ref 3x3x128x128) [147456, bytes: 589824]
generator/G_MODEL/C/LayerNorm/beta:0 (float32_ref 128) [128, bytes: 512]
generator/G_MODEL/C/LayerNorm/gamma:0 (float32_ref 128) [128, bytes: 512]
generator/G_MODEL/C/r1/Conv/weights:0 (float32_ref 1x1x128x256) [32768, bytes: 131072]
generator/G_MODEL/C/r1/LayerNorm/beta:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r1/LayerNorm/gamma:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r1/r1/w:0 (float32_ref 3x3x256x1) [2304, bytes: 9216]
generator/G_MODEL/C/r1/r1/bias:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r1/1/beta:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r1/1/gamma:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r1/Conv_1/weights:0 (float32_ref 1x1x256x256) [65536, bytes: 262144]
generator/G_MODEL/C/r1/2/beta:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r1/2/gamma:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r2/Conv/weights:0 (float32_ref 1x1x256x512) [131072, bytes: 524288]
generator/G_MODEL/C/r2/LayerNorm/beta:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r2/LayerNorm/gamma:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r2/r2/w:0 (float32_ref 3x3x512x1) [4608, bytes: 18432]
generator/G_MODEL/C/r2/r2/bias:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r2/1/beta:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r2/1/gamma:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r2/Conv_1/weights:0 (float32_ref 1x1x512x256) [131072, bytes: 524288]
generator/G_MODEL/C/r2/2/beta:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r2/2/gamma:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r3/Conv/weights:0 (float32_ref 1x1x256x512) [131072, bytes: 524288]
generator/G_MODEL/C/r3/LayerNorm/beta:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r3/LayerNorm/gamma:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r3/r3/w:0 (float32_ref 3x3x512x1) [4608, bytes: 18432]
generator/G_MODEL/C/r3/r3/bias:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r3/1/beta:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r3/1/gamma:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r3/Conv_1/weights:0 (float32_ref 1x1x512x256) [131072, bytes: 524288]
generator/G_MODEL/C/r3/2/beta:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r3/2/gamma:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r4/Conv/weights:0 (float32_ref 1x1x256x512) [131072, bytes: 524288]
generator/G_MODEL/C/r4/LayerNorm/beta:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r4/LayerNorm/gamma:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r4/r4/w:0 (float32_ref 3x3x512x1) [4608, bytes: 18432]
generator/G_MODEL/C/r4/r4/bias:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r4/1/beta:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r4/1/gamma:0 (float32_ref 512) [512, bytes: 2048]
generator/G_MODEL/C/r4/Conv_1/weights:0 (float32_ref 1x1x512x256) [131072, bytes: 524288]
generator/G_MODEL/C/r4/2/beta:0 (float32_ref 256) [256, bytes: 1024]
generator/G_MODEL/C/r4/2/gamma:0 (float32_ref 256) [256, bytes: 1024]                                                                                                             [605/1792]generator/G_MODEL/C/Conv_1/weights:0 (float32_ref 3x3x256x128) [294912, bytes: 1179648]
generator/G_MODEL/C/LayerNorm_1/beta:0 (float32_ref 128) [128, bytes: 512]
generator/G_MODEL/C/LayerNorm_1/gamma:0 (float32_ref 128) [128, bytes: 512]
generator/G_MODEL/D/Conv/weights:0 (float32_ref 3x3x128x128) [147456, bytes: 589824]
generator/G_MODEL/D/LayerNorm/beta:0 (float32_ref 128) [128, bytes: 512]
generator/G_MODEL/D/LayerNorm/gamma:0 (float32_ref 128) [128, bytes: 512]
generator/G_MODEL/D/Conv_1/weights:0 (float32_ref 3x3x128x128) [147456, bytes: 589824]
generator/G_MODEL/D/LayerNorm_1/beta:0 (float32_ref 128) [128, bytes: 512]
generator/G_MODEL/D/LayerNorm_1/gamma:0 (float32_ref 128) [128, bytes: 512]
generator/G_MODEL/E/Conv/weights:0 (float32_ref 3x3x128x64) [73728, bytes: 294912]
generator/G_MODEL/E/LayerNorm/beta:0 (float32_ref 64) [64, bytes: 256]
generator/G_MODEL/E/LayerNorm/gamma:0 (float32_ref 64) [64, bytes: 256]
generator/G_MODEL/E/Conv_1/weights:0 (float32_ref 3x3x64x64) [36864, bytes: 147456]
generator/G_MODEL/E/LayerNorm_1/beta:0 (float32_ref 64) [64, bytes: 256]
generator/G_MODEL/E/LayerNorm_1/gamma:0 (float32_ref 64) [64, bytes: 256]
generator/G_MODEL/E/Conv_2/weights:0 (float32_ref 7x7x64x32) [100352, bytes: 401408]
generator/G_MODEL/E/LayerNorm_2/beta:0 (float32_ref 32) [32, bytes: 128]
generator/G_MODEL/E/LayerNorm_2/gamma:0 (float32_ref 32) [32, bytes: 128]
generator/G_MODEL/out_layer/Conv/weights:0 (float32_ref 1x1x32x3) [96, bytes: 384]
Total size of variables: 2143552
Total bytes of variables: 8574208
 [*] Reading checkpoints...
 [*] Failed to find a checkpoint
 [!] Load failed...
Epoch:   0 Step:     0 /   554  time: 80.342747 s init_v_loss: 592.22143555  mean_v_loss: 592.22143555

Permission for commercial use?

According to your README.md, we can only use this for research purposes. Is it possible for us to train on our own data and then used the resultant trained model for commercial use?

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.