SystemErrorWang / White-box-Cartoonization

Official tensorflow implementation for CVPR2020 paper “Learning to Cartoonize Using White-box Cartoon Representations”

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: only size-1 arrays can be converted to Python scalars

iloveyou1122 opened this issue · comments

I encounter a problem while running pretrain.py

TypeError: only size-1 arrays can be converted to Python scalars

Error stack

(white-box-catoon) E:\White-box-Cartoonization\train_code>python pretrain.py --batch_size 6
D:\Software\Anaconda\envs\white-box-catoon\lib\site-packages\tensorflow\python\framework\dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
D:\Software\Anaconda\envs\white-box-catoon\lib\site-packages\tensorflow\python\framework\dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
D:\Software\Anaconda\envs\white-box-catoon\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
D:\Software\Anaconda\envs\white-box-catoon\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
D:\Software\Anaconda\envs\white-box-catoon\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
D:\Software\Anaconda\envs\white-box-catoon\lib\site-packages\tensorflow\python\framework\dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
Namespace(adv_train_lr=0.0002, batch_size=6, gpu_fraction=0.5, patch_size=256, save_dir='pretrain', total_iter=50000)
2022-04-03 16:50:02.052684: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2022-04-03 16:50:02.183468: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.7845
pciBusID: 0000:20:00.0
totalMemory: 6.00GiB freeMemory: 5.11GiB
2022-04-03 16:50:02.183647: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2022-04-03 16:50:02.884580: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2022-04-03 16:50:02.884717: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2022-04-03 16:50:02.885688: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2022-04-03 16:50:02.886462: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3072 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:20:00.0, compute capability: 6.1)
0%| | 0/50000 [00:00<?, ?it/s]D:\Software\Anaconda\envs\white-box-catoon\lib\site-packages\numpy\core_asarray.py:83: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
return array(a, dtype, copy=False, order=order)
0%| | 0/50000 [00:00<?, ?it/s]
TypeError: only size-1 arrays can be converted to Python scalars

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "pretrain.py", line 117, in
train(args)
File "pretrain.py", line 85, in train
_, r_loss = sess.run([optim, recon_loss], feed_dict={input_photo: photo_batch})
File "D:\Software\Anaconda\envs\white-box-catoon\lib\site-packages\tensorflow\python\client\session.py", line 929, in run
run_metadata_ptr)
File "D:\Software\Anaconda\envs\white-box-catoon\lib\site-packages\tensorflow\python\client\session.py", line 1121, in _run
np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)
File "D:\Software\Anaconda\envs\white-box-catoon\lib\site-packages\numpy\core_asarray.py", line 83, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: setting an array element with a sequence.

Spec
gtx1060 6gb
windows10

How to solve this?