Deep3DFaceReconstruction icon indicating copy to clipboard operation
Deep3DFaceReconstruction copied to clipboard

Cannot run demo.py after configuring the environment

Open Kenny-Li2023 opened this issue 3 years ago • 3 comments

(deep3d) user02@lthpc:~/liweijie/Deep3DFaceReconstruction-master$ python demo.py /home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: 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)]) /home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: 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)]) /home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: 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)]) /home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: 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)]) /home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: 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)]) /home/user02/.conda/envs/deep3d/lib/python3.6/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_resource = np.dtype([("resource", np.ubyte, 1)]) /home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: 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)]) /home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: 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)]) /home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: 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)]) /home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: 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)]) /home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: 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)]) /home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: 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)]) WARNING:tensorflow:From /home/user02/liweijie/Deep3DFaceReconstruction-master/options.py:30: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

WARNING:tensorflow:From /home/user02/liweijie/Deep3DFaceReconstruction-master/options.py:52: The name tf.train.piecewise_constant is deprecated. Please use tf.compat.v1.train.piecewise_constant instead.

WARNING:tensorflow:From demo.py:68: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

Using pre-trained .pb file. WARNING:tensorflow:From /home/user02/liweijie/Deep3DFaceReconstruction-master/utils.py:133: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.

WARNING:tensorflow:From /home/user02/liweijie/Deep3DFaceReconstruction-master/utils.py:134: The name tf.GraphDef is deprecated. Please use tf.compat.v1.GraphDef instead.

WARNING:tensorflow:From /home/user02/liweijie/Deep3DFaceReconstruction-master/face_decoder.py:119: The name tf.cross is deprecated. Please use tf.linalg.cross instead.

WARNING:tensorflow:From /home/user02/liweijie/Deep3DFaceReconstruction-master/face_decoder.py:121: calling l2_normalize (from tensorflow.python.ops.nn_impl) with dim is deprecated and will be removed in a future version. Instructions for updating: dim is deprecated, use axis instead WARNING:tensorflow:From /home/user02/liweijie/Deep3DFaceReconstruction-master/renderer/camera_utils.py:85: calling norm (from tensorflow.python.ops.linalg_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead WARNING:tensorflow:From /home/user02/liweijie/Deep3DFaceReconstruction-master/renderer/rasterize_triangles.py:141: The name tf.reciprocal is deprecated. Please use tf.math.reciprocal instead.

WARNING:tensorflow:From /home/user02/liweijie/Deep3DFaceReconstruction-master/renderer/mesh_renderer.py:164: add_dispatch_support..wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.where in 2.0, which has the same broadcast rule as np.where 2021-03-09 16:49:47.748618: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2021-03-09 16:49:47.775169: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 1700020000 Hz 2021-03-09 16:49:47.776266: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x556e73eb5a70 executing computations on platform Host. Devices: 2021-03-09 16:49:47.776301: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): , reconstructing... 1 /home/user02/liweijie/Deep3DFaceReconstruction-master/preprocess_img.py:27: FutureWarning: rcond parameter will change to the default of machine precision times max(M, N) where M and N are the input matrix dimensions. To use the future default and silence this warning we advise to pass rcond=None, to keep using the old, explicitly pass rcond=-1. k,,,_ = np.linalg.lstsq(A,b) /home/user02/liweijie/Deep3DFaceReconstruction-master/preprocess_img.py:74: 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 trans_params = np.array([w0,h0,102.0/s,t[0],t[1]]) 2021-03-09 16:49:53.667612: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set. If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU. To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile. Traceback (most recent call last): File "/home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1356, in _do_call return fn(*args) File "/home/user02/.conda/envs/deep3d/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/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1429, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: RasterizeTriangles expects vertices to have shape (-1, 4). [[{{node RasterizeTriangles}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "demo.py", line 124, in demo() File "demo.py", line 105, in demo face_shape,face_texture,face_color,landmarks_2d,recon_img,tri],feed_dict = {images: input_img}) File "/home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 950, in run run_metadata_ptr) File "/home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1173, in _run feed_dict_tensor, options, run_metadata) File "/home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _do_run run_metadata) File "/home/user02/.conda/envs/deep3d/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: RasterizeTriangles expects vertices to have shape (-1, 4). [[node RasterizeTriangles (defined at :230) ]]

Errors may have originated from an input operation. Input Source operations connected to node RasterizeTriangles: Cast_6 (defined at /home/user02/liweijie/Deep3DFaceReconstruction-master/face_decoder.py:299) strided_slice_57 (defined at /home/user02/liweijie/Deep3DFaceReconstruction-master/renderer/rasterize_triangles.py:117)

Original stack trace for 'RasterizeTriangles': File "demo.py", line 124, in demo() File "demo.py", line 82, in demo FaceReconstructor.Reconstruction_Block(coeff,opt) File "/home/user02/liweijie/Deep3DFaceReconstruction-master/face_decoder.py", line 63, in Reconstruction_Block render_imgs,img_mask,img_mask_crop = self.Render_block(face_shape_t,norm_r,face_color,camera_scale,f_scale,self.facemodel,opt.batch_size,opt.is_train) File "/home/user02/liweijie/Deep3DFaceReconstruction-master/face_decoder.py", line 312, in Render_block ambient_color = ambient_color) File "/home/user02/liweijie/Deep3DFaceReconstruction-master/renderer/mesh_renderer.py", line 375, in mesh_renderer image_width, image_height, [-1] * vertex_attributes.shape[2].value) File "/home/user02/liweijie/Deep3DFaceReconstruction-master/renderer/rasterize_triangles.py", line 118, in rasterize_triangles image_height)) File "", line 230, in rasterize_triangles File "/home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "/home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func return func(*args, **kwargs) File "/home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3616, in create_op op_def=op_def) File "/home/user02/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2005, in init self._traceback = tf_stack.extract_stack()

Kenny-Li2023 avatar Mar 09 '21 08:03 Kenny-Li2023

Seems that you use the wrong version of tf_mesh_renderer. In our experiment, we use an older version of it. Maybe you can check the instruction in the readme to see if you use the correct version.

YuDeng avatar Mar 10 '21 04:03 YuDeng

I am getting a similar error is Node Matmul. Any idea with that?

RAJA-PARIKSHAT avatar Mar 14 '22 10:03 RAJA-PARIKSHAT

I am getting a similar error is Node Matmul. Any idea with that?

hi,have you solved the problem? I encountered the same and have no ideas

tyrink avatar May 14 '22 14:05 tyrink