qianqianjun / face_editor

一个非常有意思的人脸属性编辑模型
MIT License
1 stars 2 forks source link

How to using #1

Open zhanghongyong123456 opened 3 years ago

zhanghongyong123456 commented 3 years ago

I using stylegan-encoder get latent,run test.py get error. 2021-05-20 20:18:58.677311: E tensorflow/stream_executor/cuda/cuda_driver.cc:828] failed to allocate 2.62G (2817366272 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY: out of memory /home/zhy/Projects/2021.05/face_editor-main/test.py:66: FutureWarning: arrays to stack must be passed as a "sequence" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future. stack_latents = np.stack(facelatent for in range(1)) # (1,512) Traceback (most recent call last): File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1356, in _do_call return fn(*args) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1341, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1429, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: In[0] is not a matrix. Instead it has shape [1,18,512] [[{{node G_mapping_1/_Run/G_mapping/Dense0/MatMul}}]] [[G_mapping_1/_Run/G_mapping/dlatents_out/_1399]] (1) Invalid argument: In[0] is not a matrix. Instead it has shape [1,18,512] [[{{node G_mapping_1/_Run/G_mapping/Dense0/MatMul}}]] 0 successful operations. 0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/zhy/Projects/2021.05/face_editor-main/test.py", line 73, in main() File "/home/zhy/Projects/2021.05/face_editor-main/test.py", line 67, in main face_dlatent = Gs_network.components.mapping.run(stack_latents, None) #将潜在编码通过映射网络 File "/home/zhy/Projects/2021.05/face_editor-main/dnnlib/tflib/network.py", line 478, in run mb_out = tf.get_default_session().run(out_expr, dict(zip(in_expr, mb_in))) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 950, in run run_metadata_ptr) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1173, in _run feed_dict_tensor, options, run_metadata) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _do_run run_metadata) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1370, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: In[0] is not a matrix. Instead it has shape [1,18,512] [[node G_mapping_1/_Run/G_mapping/Dense0/MatMul (defined at :150) ]] [[G_mapping_1/_Run/G_mapping/dlatents_out/_1399]] (1) Invalid argument: In[0] is not a matrix. Instead it has shape [1,18,512] [[node G_mapping_1/_Run/G_mapping/Dense0/MatMul (defined at :150) ]] 0 successful operations. 0 derived errors ignored.

Errors may have originated from an input operation. Input Source operations connected to node G_mapping_1/_Run/G_mapping/Dense0/MatMul: G_mapping_1/_Run/G_mapping/Dense0/mul (defined at :140)
G_mapping_1/_Run/G_mapping/PixelNorm/mul (defined at :233)

Input Source operations connected to node G_mapping_1/_Run/G_mapping/Dense0/MatMul: G_mapping_1/_Run/G_mapping/Dense0/mul (defined at :140)
G_mapping_1/_Run/G_mapping/PixelNorm/mul (defined at :233)

Original stack trace for 'G_mapping_1/_Run/G_mapping/Dense0/MatMul': File "/home/zhy/Projects/2021.05/face_editor-main/test.py", line 73, in main() File "/home/zhy/Projects/2021.05/face_editor-main/test.py", line 67, in main face_dlatent = Gs_network.components.mapping.run(stack_latents, None) #将潜在编码通过映射网络 File "/home/zhy/Projects/2021.05/face_editor-main/dnnlib/tflib/network.py", line 453, in run out_gpu = net_gpu.get_output_for(*in_gpu, return_as_list=True, dynamic_kwargs) File "/home/zhy/Projects/2021.05/face_editor-main/dnnlib/tflib/network.py", line 222, in get_output_for out_expr = self._build_func(*final_inputs, *build_kwargs) File "", line 415, in G_mapping File "", line 150, in dense File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py", line 180, in wrapper return target(args, kwargs) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2647, in matmul a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 5925, in mat_mul name=name) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func return func(*args, **kwargs) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3616, in create_op op_def=op_def) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2005, in init self._traceback = tf_stack.extract_stack()

zhanghongyong123456 commented 3 years ago

2021-05-20 20:18:58.677311: E tensorflow/stream_executor/cuda/cuda_driver.cc:828] failed to allocate 2.62G (2817366272 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY: out of memory /home/zhy/Projects/2021.05/face_editor-main/test.py:66: FutureWarning: arrays to stack must be passed as a "sequence" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future. stack_latents = np.stack(facelatent for in range(1)) # (1,512) Traceback (most recent call last): File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1356, in _do_call return fn(*args) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1341, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1429, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: In[0] is not a matrix. Instead it has shape [1,18,512] [[{{node G_mapping_1/_Run/G_mapping/Dense0/MatMul}}]] [[G_mapping_1/_Run/G_mapping/dlatents_out/_1399]] (1) Invalid argument: In[0] is not a matrix. Instead it has shape [1,18,512] [[{{node G_mapping_1/_Run/G_mapping/Dense0/MatMul}}]] 0 successful operations. 0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/zhy/Projects/2021.05/face_editor-main/test.py", line 73, in main() File "/home/zhy/Projects/2021.05/face_editor-main/test.py", line 67, in main face_dlatent = Gs_network.components.mapping.run(stack_latents, None) #将潜在编码通过映射网络 File "/home/zhy/Projects/2021.05/face_editor-main/dnnlib/tflib/network.py", line 478, in run mb_out = tf.get_default_session().run(out_expr, dict(zip(in_expr, mb_in))) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 950, in run run_metadata_ptr) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1173, in _run feed_dict_tensor, options, run_metadata) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _do_run run_metadata) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1370, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: In[0] is not a matrix. Instead it has shape [1,18,512] [[node G_mapping_1/_Run/G_mapping/Dense0/MatMul (defined at :150) ]] [[G_mapping_1/_Run/G_mapping/dlatents_out/_1399]] (1) Invalid argument: In[0] is not a matrix. Instead it has shape [1,18,512] [[node G_mapping_1/_Run/G_mapping/Dense0/MatMul (defined at :150) ]] 0 successful operations. 0 derived errors ignored.

Errors may have originated from an input operation. Input Source operations connected to node G_mapping_1/_Run/G_mapping/Dense0/MatMul: G_mapping_1/_Run/G_mapping/Dense0/mul (defined at :140)
G_mapping_1/_Run/G_mapping/PixelNorm/mul (defined at :233)

Input Source operations connected to node G_mapping_1/_Run/G_mapping/Dense0/MatMul: G_mapping_1/_Run/G_mapping/Dense0/mul (defined at :140)
G_mapping_1/_Run/G_mapping/PixelNorm/mul (defined at :233)

Original stack trace for 'G_mapping_1/_Run/G_mapping/Dense0/MatMul': File "/home/zhy/Projects/2021.05/face_editor-main/test.py", line 73, in main() File "/home/zhy/Projects/2021.05/face_editor-main/test.py", line 67, in main face_dlatent = Gs_network.components.mapping.run(stack_latents, None) #将潜在编码通过映射网络 File "/home/zhy/Projects/2021.05/face_editor-main/dnnlib/tflib/network.py", line 453, in run out_gpu = net_gpu.get_output_for(*in_gpu, return_as_list=True, dynamic_kwargs) File "/home/zhy/Projects/2021.05/face_editor-main/dnnlib/tflib/network.py", line 222, in get_output_for out_expr = self._build_func(*final_inputs, *build_kwargs) File "", line 415, in G_mapping File "", line 150, in dense File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py", line 180, in wrapper return target(args, kwargs) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2647, in matmul a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 5925, in mat_mul name=name) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func return func(*args, **kwargs) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3616, in create_op op_def=op_def) File "/home/zhy/anaconda3/envs/stylegan2/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2005, in init self._traceback = tf_stack.extract_stack()