AnimeGAN
AnimeGAN copied to clipboard
Train Error
Hi
I download and open project with pycharm. I configured the environment as README required(1080Ti), running edge-smooth.py and data_mean.py has no problem, however , when I ran main.py, something wrong:
[*] Reading checkpoints...
[*] Failed to find a checkpoint
[!] Load failed...
2021-04-12 13:15:23.718658: W tensorflow/core/framework/op_kernel.cc:1306] Invalid argument: UFuncTypeError: Cannot cast ufunc 'add' output from dtype('<U32') to dtype('float32') with casting rule 'same_kind'
Traceback (most recent call last):
File "****/anaconda3/envs/anime/lib/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 157, in __call__ ret = func(*args)
File "*****/AnimeGAN-master/tools/data_loader.py", line 70, in load_image image1, image2 = self.read_image(img1)
File "*****/AnimeGAN-master/tools/data_loader.py", line 45, in read_image image1[:,:,0] += self.data_mean[2]
numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'add' output from dtype('<U32') to dtype('float32') with casting rule 'same_kind'
Could you please help solve this problem or give some advice?
Best wishes!
*****/AnimeGAN-master/tools/data_loader.py", line 45, in read_image image1[:,:,0] += self.data_mean[2]。 There is an error in this line, self.data_mean[2] should be a string, you cannot add a numpy array to a string.
*****/AnimeGAN-master/tools/data_loader.py", line 45, in read_image image1[:,:,0] += self.data_mean[2]。 There is an error in this line, self.data_mean[2] should be a string, you cannot add a numpy array to a string.
Dear author, thank you for your timely answer。However, I'm not quite sure what you mean. Are you saying that we should convert self.data_mean[2] from str to numpy array when calculating it?Could you give a detailed example?Thank you very much!
Hi I download and open project with pycharm. I configured the environment as README required(1080Ti), running edge-smooth.py and data_mean.py has no problem, however , when I ran main.py, something wrong:
[*] Reading checkpoints...
[*] Failed to find a checkpoint
[!] Load failed...
2021-04-12 13:15:23.718658: W tensorflow/core/framework/op_kernel.cc:1306] Invalid argument: UFuncTypeError: Cannot cast ufunc 'add' output from dtype('<U32') to dtype('float32') with casting rule 'same_kind'
Traceback (most recent call last):
File "****/anaconda3/envs/anime/lib/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 157, in __call__ ret = func(*args)
File "*****/AnimeGAN-master/tools/data_loader.py", line 70, in load_image image1, image2 = self.read_image(img1)
File "*****/AnimeGAN-master/tools/data_loader.py", line 45, in read_image image1[:,:,0] += self.data_mean[2]
numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'add' output from dtype('<U32') to dtype('float32') with casting rule 'same_kind'
Could you please help solve this problem or give some advice? Best wishes!
Have you solved this problem? I have the same error.
Same error here- I just hard coded the data mean values for my dataset into data_loader and it ran fine.
image1[:,:,0] += 13.136 #self.data_mean[2] image1[:,:,1] += -8.6698 #self.data_mean[1] image1[:,:,2] += -4.4661 #self.data_mean[0]
The following worked for me.
Change the argparser for data_mean
in main.py
to something like this:
parser.add_argument('--data_mean', nargs="*", type=float, default=[13.1360, -8.6698, -4.4661], help='data_mean(bgr) from data_mean.py')
And then you can run training like this:
python main.py --phase train --dataset Hayao --data_mean 13.1360 -8.6698 -4.4661 --epoch 101 --init_epoch 10
The following worked for me.
Change the argparser for
data_mean
inmain.py
to something like this:parser.add_argument('--data_mean', nargs="*", type=float, default=[13.1360, -8.6698, -4.4661], help='data_mean(bgr) from data_mean.py')
And then you can run training like this:
python main.py --phase train --dataset Hayao --data_mean 13.1360 -8.6698 -4.4661 --epoch 101 --init_epoch 10
Yes, you are right. data_mean is used as an additional data preprocessing, it is not necessary. It was not mentioned in the original paper, because it was added later. Since its role is not obvious, I will delete this preprocessing later.