TachibanaYoshino / AnimeGAN

A Tensorflow implementation of AnimeGAN for fast photo animation ! This is the Open source of the paper 「AnimeGAN: a novel lightweight GAN for photo animation」, which uses the GAN framwork to transform real-world photos into anime images.
4.49k stars 660 forks source link

Train error #45

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi, I tried training but an error occurred. How do i fix it?

[] Reading checkpoints... [] Failed to find a checkpoint [!] Load failed... 2020-12-08 21:29:36.529360: W T:\src\github\tensorflow\tensorflow\core\framework\op_kernel.cc:1306] Invalid argument: TypeError: Cannot cast ufunc add output from dtype('<U32') to dtype('float32') with casting rule 'same_kind' Traceback (most recent call last):

File "C:\Users\VGLAB\Anaconda3\lib\site-packages\tensorflow\python\ops\script_ops.py", line 157, in call ret = func(*args)

File "C:\Users\VGLAB\Desktop\GAN\AnimeGAN-master\AnimeGAN-master\tools\data_loader.py", line 64, in load_image image1, image2 = self.read_image(img1)

File "C:\Users\VGLAB\Desktop\GAN\AnimeGAN-master\AnimeGAN-master\tools\data_loader.py", line 45, in read_image image1[:,:,0] += self.data_mean[2]

TypeError: Cannot cast ufunc add output from dtype('<U32') to dtype('float32') with casting rule 'same_kind'

nortrom-neverafk commented 3 years ago

did u fix it? i had the same error.

ghost commented 3 years ago

do not use the cmd (or anaconda prompt).

project download and open with spyder, pycharm.. etc. and run the code...

  1. run tools/edge-smooth.py (modify : parser --dataset default='your dataset name') if you already have edge-smooth images, skip this step

  2. run tools/data_mean.py (modify : parser --dataset default='your dataset name')

  3. run main.py (modify 1 : parser --data_mean default=[ step 2 result ] (modify 2 : parser --dataset default='your dataset name') (modify 3 : you need to change the batch size according to your graphic card)

David9591 commented 3 years ago

do not use the cmd (or anaconda prompt). project download and open with spyder, pycharm.. etc. and run the code... 1. run tools/edge-smooth.py (modify : parser --dataset default='your dataset name') if you already have edge-smooth images, skip this step 2. run tools/data_mean.py (modify : parser --dataset default='your dataset name') 3. run main.py (modify 1 : parser --data_mean default=[ step 2 result ] (modify 2 : parser --dataset default='your dataset name') (modify 3 : you need to change the batch size according to your graphic card)

Hello, did you solve this problem without modifying the specific code?I had the same problem and consulted the author,but, author say that"There is an error in this line, self.data_mean[2] should be a string, you cannot add a numpy array to a string.",As shown in the issue#48,I haven't figured it out and run the code yet.Could you give me some help or advice?Thank you!