Git Product home page Git Product logo

hifi3dface's Introduction

High-Fidelity 3D Digital Human Head Creation from RGB-D Selfies (ACM Transactions on Graphics 2021)

teaser

This repository provides the python code and 3DMM of the following paper:

High-Fidelity 3D Digital Human Head Creation from RGB-D Selfies.
Linchao Bao*, Xiangkai Lin*, Yajing Chen*, Haoxian Zhang*, Sheng Wang, Xuefei Zhe, Di Kang, Haozhi Huang, Xinwei Jiang, Jue Wang, Dong Yu, and Zhengyou Zhang. (*Equal contribution)
ACM Transactions on Graphics 2021
Project Page: https://tencent-ailab.github.io/hifi3dface_projpage/
arXiv: https://arxiv.org/abs/2010.05562

Abstract: We present a fully automatic system that can produce high-fidelity, photo-realistic 3D digital human heads with a consumer RGB-D selfie camera. The system only needs the user to take a short selfie RGB-D video while rotating his/her head, and can produce a high quality head reconstruction in less than 30 seconds. Our main contribution is a new facial geometry modeling and reflectance synthesis procedure that significantly improves the state-of-the-art. Specifically, given the input video a two-stage frame selection procedure is first employed to select a few high-quality frames for reconstruction. Then a differentiable renderer based 3D Morphable Model (3DMM) fitting algorithm is applied to recover facial geometries from multiview RGB-D data, which takes advantages of a powerful 3DMM basis constructed with extensive data generation and perturbation. Our 3DMM has much larger expressive capacities than conventional 3DMM, allowing us to recover more accurate facial geometry using merely linear basis. For reflectance synthesis, we present a hybrid approach that combines parametric fitting and CNNs to synthesize high-resolution albedo/normal maps with realistic hair/pore/wrinkle details. Results show that our system can produce faithful 3D digital human faces with extremely realistic details. The main code and the newly constructed 3DMM basis is publicly available.

Note: Please note that the reported running time in the paper are obtained with our optimized C++ code but NOT the python code here. The python code in this repository is only for research purposes and not fully optimized.

Note: Please visit the ./3DMM folder for details about our 3DMM, namely Tencent AI-NEXT 3D Face Model (East-Asian Version), in short AI-NEXT Face Model (EAs).

Disclaimer

The code and data in this repository are for research purpose only. No representation or warranty whatsoever, expressed or implied, is made as to its accuracy, reliability or completeness. We assume no liability and are not responsible for any misuse or damage caused by the code and data. Your use of the code and data are subject to applicable laws and your use of them is at your own risk.


teaser
teaser

Directories

3DMM:
our constructed 3DMM from 200 high-fidelity East-Asian face models, see the README.md file inside the folder for more details.

data_prepare:
code for face detection, landmark detection and face segmentation to preprocess image and generate necessary information for 3DMM optimization.

optimization:
3DMM optimization code for facial geometry modeling.

texture:
code for facial reflectance synthesis.

third_party:
code from the other repositories.

Prerequisites

  • Dependencies

    • Linux
    • python 3.6
    • tensorflow 1.8 (also tested in tensorflow 1.15)
    • g++ 4.8 (other version might also work)
  • Installation

    Please run the follow commands for installation.

    git clone https://github.com/tencent-ailab/hifi3dface.git
    cd hifi3dface
    bash install.sh
    

    The script in install.sh installs all packages required to run our code, and compiles the c++ kernel of the differentiable renderer provided by tf_mesh_renderer. Pay attention to finding the correct path to TF_INC and TF_LIB. The path specified in install.sh might not suit your case. If it does not work, please try to fix them manually. If your g++ version is greater than 4, please delete "-D_GLIBCXX_USE_CXX11_ABI=0" ( Line 9 ) in install.sh. You can also compile the code using the method provided by tf_mesh_renderer.

  • Downloads

    You will need to download the following files to run our code:

Running The Code

1. RGBD Face Reconstruction

To reproduce the results in our paper, please follow the steps provided below.

1.1 Data acquisition:

You may use our RGBD data capture code (need an iPhone with TrueDepth camera) to capture RGB-D selfies. The color and depth images are in JPG and PNG formats respectively. The resolution of the color image is 1504 x 1128, and the depth image is of size 640 x 480. If you want to use your own capturing system, please modify the code to suit your case. Below are example RGB-D images exported from our capturing app:

RGBD_data_example

1.2 Configuration:

Modify run_rgbd.sh as following:

  1. Line 6: define the path to 3DMM as where you download the 3DMM model.
    basic_path=$(pwd)/3DMM/files/;
  2. Line 7: define the path to resources as where you download the data.
    resources_path=$(pwd)/resources/;
  3. Line 24: define the path to test data. If you capture your own data, please specify the path to the video sequence or 4 pairs of (color, depth) images with different poses (mid-left-right-up).
    ROOT_DIR=$(pwd)/test_data/RGBD/test1/;
  4. Line 23: define whether testing data is a video sequence.
    is_only_four_frame="False" #  True for four frames, False for a video sequence
  5. Line 121-136: configure optimization parameters.
    log_step=10
    learning_rate=0.05
    lr_decay_step=10
    lr_decay_rate=0.9
    photo_weight=100
    gray_photo_weight=80
    reg_shape_weight=0.4
    reg_tex_weight=0.0001
    depth_weight=1000
    id_weight=1.8
    real_86pt_lmk3d_weight=0.01
    lmk_struct_weight=0
    train_step=100
    is_fixed_pose="False"
    is_add_head_mirrow="False" #  True: output symmetrical head completion result
    is_add_head_male="True" #  True: complete head with a male template

1.3 Run:

Please run the follow command to generate the results.

bash run_opt_rgbd.sh

The RGBD data will be used for shape optimization and HD texture/normal maps generation. We highly recommend that you use our 3DMM version AI-NExT-Shape.mat in order to achieve the same results as reported in our paper. You can also run our code with BFM, but the texture map and normal map will not be generated if you use BFM, as BFM does not provide UV maps.

1.4 Results:

The produced results will be saved in the results floder in data path, including:

- head.obj: the final mesh file
- albedo.png: the final albedo map file
- normal.png: the final normal map file
- test.mtl: a material description file for simple rendering in meshlab

An example of the resulting files is shown below. Note that the our 3DMM version AI-NExT-Shape.mat only contains face region, and our code consists of a head completion step.

RGBD_example

2. RGB Face Reconstruction

Our code also supports RGB inputs without depth data, but note that running with only RGB inputs cannot achieve comparable reconstruction accuracy as RGBD inputs.

2.1 Data acquisition: You may use one image or multiple images of the same person to run our code. Please note that all data of the same identity should be placed into the same folder.

2.2 Configuration:

Please modify run_rgb.sh as the following:

  1. Line 6: define the path to 3DMM as where you download the 3DMM model.
basic_path=$(pwd)/3DMM/files/;
  1. Line 7: define the path to resources.
resources_path=$(pwd)/resources/;
  1. Line 22: define the path to test data. You may also specify the path to your own input rgb data folder.
ROOT_DIR=$(pwd)/test_data/RGB/test1/single_img/;
  1. Line 54-70: configure optimization parameters.
train_step=120
log_step=20
learning_rate=0.05
lr_decay_step=20
lr_decay_rate=0.9

photo_weight=100.0
gray_photo_weight=80.0
reg_shape_weight=4.0
reg_tex_weight=8.0
id_weight=1.5
real_86pt_lmk3d_weight=5.0
real_68pt_lmk2d_weight=5.0
lmk_struct_weight=0

num_of_img=1 # The number of input images
project_type="Pers" # Use "Pers" for selfie photos, and "Orth" for face photos captured in a far distance

2.3 Run:

Please run the follow command to generate the results.

bash run_opt_rgb.sh

Note that if you run the script with more than one images, only the first image would be used for generating the texture map and normal map. Besides, you can also run the code with BFM, but the texture map and normal map will not be generated in this case. We highly recommend that you use the our 3DMM version AI-NExT-Shape-NoAug.mat for the RGB inputs, as there are no reliable geometric constraints without depth data inputs.

2.4 Results:

The produced results will be saved in the results floder in data path, including:

- head.obj: the final mesh file
- albedo.png: the final albedo map file
- normal.png: the final normal map file
- test.mtl: a material description file for simple rendering in meshlab

An example of the resulting files is shown below. Note that the shape model obtained with AI-NExT-Shape-NoAug.mat is already a full head model.

RGB_example

3. Rendering

The produced mesh and albedo/normal map can be used to render a realistic digital human head in a physically based rendering engine like Unreal Engine 4 (UE4). The results in our paper are rendered using UE4 engine, with the skin material settings the same as the digital human rendering showcase "Mike" provided by UE4.

For simpler visualization, we here provide two other rendering ways as follows.

  • Rendering with Meshlab: You can directly use Meshlab to open the obj file, with the mtl file in a same folder. Note that normal maps are not used in the rendering.
  • Rendering with Three.js: Please follow the instructions in this repo(https://github.com/cyj907/simple-mesh-visualizer). Normal maps can be used for rendering in this way.

The rendering results are as follows (eyeballs are attached in the UE4 rendering):

render_results

Note: The renderings are with different lighting settings. The mesh and albedo/normal map are the same (from RGBD reconstruction) in the renderings.


Contact

If you have any questions, please contact Linchao Bao.

Acknowledgement

Our code uses the code from the following repos. We thank them for providing the code.

Citation

If you use the code or 3DMM provided in this repository, please cite our paper as follows.

@article{hifi3dface2021tencentailab,
  title={High-Fidelity 3D Digital Human Head Creation from RGB-D Selfies},
  author={Bao, Linchao and Lin, Xiangkai and Chen, Yajing and Zhang, Haoxian and Wang, Sheng and Zhe, Xuefei and Kang, Di and Huang, Haozhi and Jiang, Xinwei and Wang, Jue and Yu, Dong and Zhang, Zhengyou},
  journal={ACM Transactions on Graphics},
  year={2021}
}

License

MIT License

Copyright (c) [2020-2021] [Tencent AI Lab]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

hifi3dface's People

Contributors

linchaobao avatar tencent-ailab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hifi3dface's Issues

question about the depth data.

Thank you for your excellent work.

I have a question about the depth data.

Since I don't have an ios compile environment, I have to capture depth data with other equipment such as kinect.

I can't find the clear physical meaning of the uint of the iphone truedepth data on their website.

Is it in millimeters after the calculation (dr*255 + dg)/ 10?

The data of kinect depth output stream is in millimeters, Can I take this data instead of the truedepth data of iphone.

Thank you.

Could not generate rasterize_triangles_kernel.so

Hi, Thanks for sharing this awesome work. Having utmost interest in the working of this paper, I tried to test it's execution in google colaboratory. The normal method of running the "install.sh" is not working for me and hence I followed the direct installation of tf-meshrenderer from its own source. Everything goes well until the "rasterize_triangles_impl_test" is getting executed in the runtest.sh,

ERROR: /content/hifi3dface/tf_mesh_renderer/mesh_renderer/kernels/BUILD:7:1: error loading package '@com_google_googletest//': Unable to load package for '@rules_cc//cc:defs.bzl': The repository could not be resolved and referenced by '//mesh_renderer/kernels:rasterize_triangles_impl_test'

ERROR: Analysis of target '//mesh_renderer/kernels:rasterize_triangles_impl_test' failed; build aborted: error loading package '@com_google_googletest//': Unable to load package for '@rules_cc//cc:defs.bzl': The repository could not be resolved

This is my problem. Please help me overcome this issue or suggest me a solution to generate rasterize_triangles_kernel.so

Thanks in Advance!

detect_2Dlmk68 and create lmk_2D_68pts_ori.txt error

use the sample imges and run_data_preparation,detect 3dlmk success,but detect_2Dlmk68 and create lmk_2D_68pts_ori.txt error

File "y:/python/human/face/hifi3dface/hifi3dface-main/data_prepare/run_data_preparation.py", line 70, in detect_2Dlmk_all_imgs
tf.import_graph_def(graph_def, name="")
File "C:\leo\WPy64_3680_2\python-3.6.8.amd64\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "C:\leo\WPy64_3680_2\python-3.6.8.amd64\lib\site-packages\tensorflow_core\python\framework\importer.py", line 405, in import_graph_def
producer_op_list=producer_op_list)
File "C:\leo\WPy64_3680_2\python-3.6.8.amd64\lib\site-packages\tensorflow_core\python\framework\importer.py", line 517, in _import_graph_def_internal
_ProcessNewOps(graph)
File "C:\leo\WPy64_3680_2\python-3.6.8.amd64\lib\site-packages\tensorflow_core\python\framework\importer.py", line 243, in _ProcessNewOps
for new_op in graph._add_new_tf_operations(compute_devices=False): # pylint: disable=protected-access
File "C:\leo\WPy64_3680_2\python-3.6.8.amd64\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3561, in _add_new_tf_operations
for c_op in c_api_util.new_tf_operations(self)
File "C:\leo\WPy64_3680_2\python-3.6.8.amd64\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3561, in
for c_op in c_api_util.new_tf_operations(self)
File "C:\leo\WPy64_3680_2\python-3.6.8.amd64\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3451, in _create_op_from_tf_operation
ret = Operation(c_op, self)
File "C:\leo\WPy64_3680_2\python-3.6.8.amd64\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1748, in init
self._traceback = tf_stack.extract_stack()

【BUG】RGB multiple people test error

Thanks for your amazing job~ One question, when I use demo code for rgb multiple people in your test_data file (three liuyifei images), one error occur:

ValueError: setting an array element with a sequence.
unwrap failed

But I got correct answer for rgb single people, why? PS: I have modified num_of_img to 3 in run_opt_rgb.sh.
Looking for your reply~

About the input image size:

Is it possible to input images with size 19201080 and not resize them to 640480? In addition, the camera intrinsic will maintain the same from the 19201080 camera calibration. I am not sure whether there are some limitations to force users to use a certain size 640480. And if a large size is possible, do I need to change the crop size 300*300?

tensorflow.python.framework.errors_impl.InvalidArgumentError:

hello when i run run_opt_rgbd.sh,
In the fourth step, the following problem occurred, can you help me solve it?

---- step4 start -----
running base: /home/lab105/data1/yly/hifi3dface-main/test_data/RGBD/test1//prefit/
End of rasterization
End of rasterization
End of rasterization
End of rasterization
End of rasterization
End of rasterization
uv_batch: (1, 512, 512, 3)
uv_rgb: (1, 512, 512, 3)
[0, 1, 2, 3]
[0, 1, 2, 3]
[0, 1, 2, 3]
[0, 1, 2, 3]
[0, 1, 2, 3]
[0, 1, 2, 3]
[0, 1, 2, 3]
[0, 1]
2022-02-09 14:52:43.335231: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2022-02-09 14:52:43.337366: I tensorflow/core/common_runtime/process_util.cc:63] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance.
2022-02-09 14:52:46.406315: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at gather_nd_op.cc:50 : Invalid argument: flat indices[23830, :] = [0, -1, -1] does not index into param (shape: [1,640,480,3]).
2022-02-09 14:52:46.421838: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at gather_nd_op.cc:50 : Invalid argument: flat indices[262140, :] = [0, -1, -1] does not index into param (shape: [1,640,480,3]).
2022-02-09 14:52:46.447786: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at gather_nd_op.cc:50 : Invalid argument: flat indices[238309, :] = [0, -1, -1] does not index into param (shape: [1,640,480,3]).
Traceback (most recent call last):
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call
return fn(*args)
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: flat indices[23830, :] = [0, -1, -1] does not index into param (shape: [1,640,480,3]).
[[Node: GatherNd_1 = GatherNd[Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](truediv, Reshape_9)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "step4A_prefit_Albedo_Global.py", line 308, in
tf.app.run(main)
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "step4A_prefit_Albedo_Global.py", line 230, in main
proj_xyz_right_batch: pro_xyz_list[2][np.newaxis,...] ,
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
run_metadata)
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: flat indices[23830, :] = [0, -1, -1] does not index into param (shape: [1,640,480,3]).
[[Node: GatherNd_1 = GatherNd[Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](truediv, Reshape_9)]]

Caused by op 'GatherNd_1', defined at:
File "step4A_prefit_Albedo_Global.py", line 308, in
tf.app.run(main)
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "step4A_prefit_Albedo_Global.py", line 146, in main
512)
File "../../utils/unwrap_utils.py", line 209, in unwrap_img_into_uv
uv_size,
File "../../utils/unwrap_utils.py", line 68, in warp_img_to_uv
uv_map = tf.gather_nd(img_attrs, batch_uv_pos)
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 2975, in gather_nd
"GatherNd", params=params, indices=indices, name=name)
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/lab105/anaconda3/envs/hifi3d/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1718, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): flat indices[23830, :] = [0, -1, -1] does not index into param (shape: [1,640,480,3]).
[[Node: GatherNd_1 = GatherNd[Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](truediv, Reshape_9)]]

非刚性对齐的使用demo

非常赞的工作!
我注意到您这边用python实现了一个版本的非刚性对齐,请问能提供该工具的使用demo和一些运行效果么

RGBD results are not same as the demo output.

I used the RGBD capture module in iphone 11 and captured the depth images similar to the test data. But my output seems to be messed. Not clear about where I went wrong. Help me generate the correct result as mentioned in the paper.

Also when I built the RGBD capture module in iphone X, the camera window opens, but capturing is not happening. What would be the reason for that?

FYI, I use Meshlab for viewing the outputs.
Thanks in Advance!

error

AddHead Female

Hello, I've been trying with custom data and seems like add head tool doesn't work for female.
Even though I set the flag is_add_head_male as false it still seems to only generate the male head.
Wondering how to get this option working.
Thank you so much!

About the face indices of eyes and mouth's bag

Thanks for your great work!
I want to obtain the mesh face indices of the eyes and mouth area in order to remove these components in subsequent processing. Is there any way to achieve this?

Negative dimensions are not allowed

I'm getting this message when running bash run_opt_rgb.sh. I followed everything in the documentation.

(3dvision) [email protected]:~/hifi3dface$ bash run_opt_rgb.shprepare datas
start MTCNNMTCNN detecthello
2022-06-02 15:21:15.284411: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA2022-06-02 15:21:15.590338: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties:name: NVIDIA RTX A5000 major: 8 minor: 6 memoryClockRate(GHz): 1.695pciBusID: 0000:44:00.0
totalMemory: 23.69GiB freeMemory: 23.48GiB
2022-06-02 15:21:15.590385: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0
2022-06-02 15:23:30.311559: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:2022-06-02 15:23:30.311599: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0
2022-06-02 15:23:30.311608: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N
2022-06-02 15:23:30.368724: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 22777 MB memory) -> physical GPU (device: 0, name: NVIDIA RTX A5000, pci bus id: 0000:44:00.0, compute capability: 8.6)=========================
Traceback (most recent call last):
  File "run_data_preparation.py", line 342, in <module>
    app.run(main)  File "/root/miniconda3/envs/3dvision/lib/python3.6/site-packages/absl/app.py", line 312, in run
    _run_main(main, args)
  File "/root/miniconda3/envs/3dvision/lib/python3.6/site-packages/absl/app.py", line 258, in _run_main
    sys.exit(main(argv))
  File "run_data_preparation.py", line 321, in main
    prepare_test_data_RGB(FLAGS.img_dir, FLAGS.out_dir)
  File "run_data_preparation.py", line 204, in prepare_test_data_RGB
    names_list = detect_face_with_mtcnn.detect_with_MTCNN(img_dir, mtcnn_dir, pb_path)
  File "/root/hifi3dface/data_prepare/detect_face_with_mtcnn.py", line 389, in detect_with_MTCNN
    img, minsize, pnet, rnet, onet, threshold, factor
  File "/root/hifi3dface/data_prepare/detect_face_with_mtcnn.py", line 123, in detect_face
    tmp = np.zeros((int(tmph[k]), int(tmpw[k]), 3))
ValueError: negative dimensions are not allowed
data prepare failed

68 landmarks

How get 68 landmark's index of hifi3d vertices,THANKS

/third_party/kernels/rasterize_triangles_kernel.so: cannot open shared object file: No such file or directory

step 4: prefit Albedo_Global uv
Traceback (most recent call last):
File "step4A_prefit_Albedo_Global.py", line 44, in
from utils.project import Projector
File "../../utils/project.py", line 39, in
from third_party.rasterize_triangles import rasterize_clip_space
File "../../third_party/rasterize_triangles.py", line 29, in
os.path.join(dirname, "kernels/rasterize_triangles_kernel.so")
File "/home/avatar/.local/lib/python3.6/site-packages/tensorflow_core/python/framework/load_library.py", line 61, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: ../../third_party/kernels/rasterize_triangles_kernel.so: cannot open shared object file: No such file or directory
(step 4) prefit uv failed

脸部挂件挂载

请教一下,生成人脸之后,如何将眼睛和头发之类的资源挂载到脸部和头部呢

【BUG】bfs find bug in SparseFusion.py

In file "optimization/rgbd/RGBD_utils/SparseFusion.py" line 57 :

queue = [[x + 1, y], [x - 1, y], [x, y - 1], [x, y - 1]]

the last element [x, y-1] should be [x, y+1] ?

because it is a bfs algorithm and coordinate [x, y+1] will be visited in next loop immediately, maybe this bug will not have much bad effect on result.

Why the result of female images' reconstruction seems like the males?

Hi,

Thanks for your excellent work and share the code for our test. I tried to run ' RGB' code with the image named liuyifei in your test data. But the outcome of 3d shape seems like the males. However, I saw the 'RGBD' code providing the option of female or male. What can do to improve my result if I use the 'RGB' code? The following image is my result.
屏幕截图

rasterize_triangles_kernel.so

tensorflow.python.framework.errors_impl.NotFoundError: /home/xiaoduo/liu/hifi3dface main/third_party/kernels/rasterize_triangles_kernel.so: undefined symbol: _ZN10tensorflow8OpKernel11TraceStringB5cxx11EPNS_15OpKernelContextEb

Help me to understand final compilable python and tensorflow version

Hi, Hope you are good there. Please help me to understand the version.

In google colab, we cant install in python 3.6, tensorflow 1.15.0

In conda, we can install 1.15.0 when python version 3.6

But, when I use tensorflow == 1.15.0 and run command bash install.sh
It throw error:
tensorflow/core/framework/op.h: No such file or directory
compilation terminated.

So, I tried install with Python 3.6 and tensorflow 2.4.0 using conda
It compite first step.

But for second step, when I use tensorflow 2.4.0 and python 3.6
I get following error:
AttributeError: module 'tensorflow' has no attribute 'GraphDef', to solve this error I have changed the tf.GraphDef to tf.compact.v1.GraphDef

After that I got error as: NHWC on device type CPU

when I check as:

print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
I got: Num GPUs Available: 0

Cuda Version → 10.0
Cudnn Version → 7.6

But to run with tensorflow 2.4.0 we need :
Cuda Version → 11.0
Cudnn Version → 8.0

hence it cant figure out the GPU device.

But, when I run the same second step with tensorflow== 1.15.0, It give me another error as:
tensorflow.python.framework.errors_impl.NotFoundError: /content/hifi3dface/third_party/kernels/rasterize_triangles_kernel.so
When I manually tried to put the .so file in directory it gave me "Invalid ELF error"

My question is how could same script run with two different tensorflow, cuda, cudnn version.
Can you please list final,
Python Version →
Cuda Version →
Tensorflow Version →
Cudnn Version →

Thanks

albedo maps

你好,
想问下在论文中 sec 6.2 的内容:"the 200 albedo maps and normal maps are created with very high-quality artistic efforts",这里介绍的albedo maps等素材是人工设计得到的么?如果是人工设计得到的,那么这些素材是设计师根据真人照片来创作的么

Why 3d landmark detect is still needed thus we already have depth data?

Why 3d landmark detect is still needed thus we already have depth data?

In the paper only mentioned "2D landmarks for each frame are lifted from 2D to 3D using depth data" but not mentioned using 3D landmark detector model to detect 86 3D-landmarks, can only use depth data to map 2D landmarks to 3D by bfs depth search in file "optimization/rgbd/RGBD_utils/SparseFusion.py" function "bfs_find_corrospondence"?

Error - self._traceback = tf_stack.extract_stack_for_node(self._c_op)

step: 0
time:7.65780782699585
step: 1
time:7.757291316986084
step: 2
time:0.8211584091186523
step: 3
time:0.8079657554626465
step: 4
time:0.8135664463043213
step: 5
time:0.8051269054412842
step: 6
time:0.831916332244873
step: 7
time:0.7899782657623291
step: 8
time:0.8506298065185547
step: 9
time:0.7943072319030762
step: 10
time:0.8280911445617676
step: 11
time:0.850764274597168
step: 12
time:0.8188886642456055
step: 13
time:0.8308606147766113
Traceback (most recent call last):
  File "/home/ai-ws/Desktop/hifi3dface/venv39/lib/python3.9/site-packages/tensorflow/python/client/session.py", line 1375, in _do_call
    return fn(*args)
  File "/home/ai-ws/Desktop/hifi3dface/venv39/lib/python3.9/site-packages/tensorflow/python/client/session.py", line 1359, in _run_fn
    return self._call_tf_sessionrun(options, feed_dict, fetch_list,
  File "/home/ai-ws/Desktop/hifi3dface/venv39/lib/python3.9/site-packages/tensorflow/python/client/session.py", line 1451, in _call_tf_sessionrun
    return tf_session.TF_SessionRun_wrapper(self._session, options, feed_dict,
tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
  (0) Invalid argument: input image must be of non-zero size
	 [[{{node resize/ResizeBilinear}}]]
  (1) Invalid argument: input image must be of non-zero size
	 [[{{node resize/ResizeBilinear}}]]
	 [[real_1/clip_by_value_4-0-0-TransposeNCHWToNHWC-LayoutOptimizer/_2477]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ai-ws/Desktop/hifi3dface/optimization/rgb/run_RGB_opt.py", line 392, in <module>
    app.run(RGB_opt)
  File "/home/ai-ws/Desktop/hifi3dface/venv39/lib/python3.9/site-packages/absl/app.py", line 312, in run
    _run_main(main, args)
  File "/home/ai-ws/Desktop/hifi3dface/venv39/lib/python3.9/site-packages/absl/app.py", line 258, in _run_main
    sys.exit(main(argv))
  File "/home/ai-ws/Desktop/hifi3dface/optimization/rgb/run_RGB_opt.py", line 272, in RGB_opt
    out_summary = sess.run(summary_op)
  File "/home/ai-ws/Desktop/hifi3dface/venv39/lib/python3.9/site-packages/tensorflow/python/client/session.py", line 967, in run
    result = self._run(None, fetches, feed_dict, options_ptr,
  File "/home/ai-ws/Desktop/hifi3dface/venv39/lib/python3.9/site-packages/tensorflow/python/client/session.py", line 1190, in _run
    results = self._do_run(handle, final_targets, final_fetches,
  File "/home/ai-ws/Desktop/hifi3dface/venv39/lib/python3.9/site-packages/tensorflow/python/client/session.py", line 1368, in _do_run
    return self._do_call(_run_fn, feeds, fetches, targets, options,
  File "/home/ai-ws/Desktop/hifi3dface/venv39/lib/python3.9/site-packages/tensorflow/python/client/session.py", line 1394, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
  (0) Invalid argument: input image must be of non-zero size
	 [[node resize/ResizeBilinear (defined at /optimization/rgb/../../utils/crop_render_img.py:109) ]]
  (1) Invalid argument: input image must be of non-zero size
	 [[node resize/ResizeBilinear (defined at /optimization/rgb/../../utils/crop_render_img.py:109) ]]
	 [[real_1/clip_by_value_4-0-0-TransposeNCHWToNHWC-LayoutOptimizer/_2477]]
0 successful operations.
0 derived errors ignored.

Errors may have originated from an input operation.
Input Source operations connected to node resize/ResizeBilinear:
 strided_slice_92 (defined at /optimization/rgb/../../utils/crop_render_img.py:108)

Input Source operations connected to node resize/ResizeBilinear:
 strided_slice_92 (defined at /optimization/rgb/../../utils/crop_render_img.py:108)

Original stack trace for 'resize/ResizeBilinear':
  File "/optimization/rgb/run_RGB_opt.py", line 392, in <module>
    app.run(RGB_opt)
  File "/venv39/lib/python3.9/site-packages/absl/app.py", line 312, in run
    _run_main(main, args)
  File "/venv39/lib/python3.9/site-packages/absl/app.py", line 258, in _run_main
    sys.exit(main(argv))
  File "/optimization/rgb/run_RGB_opt.py", line 246, in RGB_opt
    out_list = build_RGB_opt_graph(var_list, basis3dmm, imageH, imageW)
  File "/optimization/rgb/run_RGB_opt.py", line 159, in build_RGB_opt_graph
    tot_loss, tot_loss_illum = compute_loss(
  File "/optimization/rgb/../../utils/compute_loss.py", line 174, in compute_loss
    render_image_fake_M = crop_render_img.tf_crop_by_landmark(
  File "/optimization/rgb/../../utils/crop_render_img.py", line 128, in tf_crop_by_landmark
    image_crop = crop_render_img._tf_crop_resize_face_by_bbox(
  File "/optimization/rgb/../../utils/crop_render_img.py", line 109, in _tf_crop_resize_face_by_bbox
    image_crop = tf.image.resize(image_pad, (300, 300))
  File "/venv39/lib/python3.9/site-packages/tensorflow/python/util/dispatch.py", line 206, in wrapper
    return target(*args, **kwargs)
  File "/venv39/lib/python3.9/site-packages/tensorflow/python/ops/image_ops_impl.py", line 1717, in resize_images_v2
    return _resize_images_common(
  File "/venv39/lib/python3.9/site-packages/tensorflow/python/ops/image_ops_impl.py", line 1450, in _resize_images_common
    images = resizer_fn(images, size)
  File "/venv39/lib/python3.9/site-packages/tensorflow/python/ops/image_ops_impl.py", line 1699, in resize_fn
    return gen_image_ops.resize_bilinear(
  File "/venv39/lib/python3.9/site-packages/tensorflow/python/ops/gen_image_ops.py", line 3683, in resize_bilinear
    _, _, _op, _outputs = _op_def_library._apply_op_helper(
  File "/venv39/lib/python3.9/site-packages/tensorflow/python/framework/op_def_library.py", line 748, in _apply_op_helper
    op = g._create_op_internal(op_type_name, inputs, dtypes=None,
  File "/venv39/lib/python3.9/site-packages/tensorflow/python/framework/ops.py", line 3557, in _create_op_internal
    ret = Operation(
  File "/venv39/lib/python3.9/site-packages/tensorflow/python/framework/ops.py", line 2045, in __init__
    self._traceback = tf_stack.extract_stack_for_node(self._c_op)

RGB opt failed

train starting but ı have error like this. Do you know any idea.
tensorflow ---> 2.6.2
cuda ---> 11.7
gpu ---> quadro A5500 24GB

undefined symbol error in the generated .so library

When run the run_opt_rgbd.sh, this error occured:
step 4: prefit Albedo_Global uv Traceback (most recent call last): File "step4A_prefit_Albedo_Global.py", line 44, in <module> from utils.project import Projector File "../../utils/project.py", line 39, in <module> from third_party.rasterize_triangles import rasterize_clip_space File "../../third_party/rasterize_triangles.py", line 29, in <module> os.path.join(dirname, "kernels/rasterize_triangles_kernel.so") File "/home/liangxiao/anaconda3/envs/3dface/lib/python3.6/site-packages/tensorflow_core/python/framework/load_library.py", line 61, in load_op_library lib_handle = py_tf.TF_LoadLibrary(library_filename) tensorflow.python.framework.errors_impl.NotFoundError: ../../third_party/kernels/rasterize_triangles_kernel.so: undefined symbol: _ZN10tensorflow12OpDefBuilder4AttrESs (step 4) prefit uv failed
However, the rasterize_triangles_kernel.so has been successfully generated by running the install.sh.

CPU机器运行报错:InvalidArgumentError (see above for traceback): Default MaxPoolingOp only supports NHWC on device type CPU

运行bash run_opt_rgb.sh,报了InvalidArgumentError (see above for traceback): Default MaxPoolingOp only supports NHWC on device type CPU的错误。使用的CPU机器,安装的是cpu版本tensorflow

prepare datas
start MTCNN
MTCNN detect
hello
2020-11-05 15:07:19.810071: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
=========================
has run MTCNN: 1 / 1
start detect 86pt 3D lmk
hello
has run 86pt lmk: 1 / 1
start detect 68pt 2D lmk
hello
WARNING:tensorflow:From /root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py:118: initialize_all_variables (from tensorflow.python.ops.variables) is deprecated and will be removed after 2017-03-02.
Instructions for updating:
Use `tf.global_variables_initializer` instead.
W1105 15:07:21.785537 140196717344576 tf_logging.py:126] From /root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py:118: initialize_all_variables (from tensorflow.python.ops.variables) is deprecated and will be removed after 2017-03-02.
Instructions for updating:
Use `tf.global_variables_initializer` instead.
load lm: /data/hifi3dface/hifi3dface/test_data/RGB/test1/single_img//prepare_rgb/lmk_3D_86pts_ori.txt
2020-11-05 15:07:24.326655: E tensorflow/core/common_runtime/executor.cc:660] Executor failed to create kernel. Invalid argument: Default MaxPoolingOp only supports NHWC on device type CPU
         [[Node: max_pool = MaxPool[T=DT_FLOAT, data_format="NCHW", ksize=[1, 1, 2, 2], padding="VALID", strides=[1, 1, 2, 2], _device="/job:localhost/replica:0/task:0/device:CPU:0"](Relu_23)]]
Traceback (most recent call last):
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call
    return fn(*args)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU
         [[Node: max_pool = MaxPool[T=DT_FLOAT, data_format="NCHW", ksize=[1, 1, 2, 2], padding="VALID", strides=[1, 1, 2, 2], _device="/job:localhost/replica:0/task:0/device:CPU:0"](Relu_23)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run_data_preparation.py", line 342, in <module>
    app.run(main)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/absl/app.py", line 300, in run
    _run_main(main, args)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "run_data_preparation.py", line 321, in main
    prepare_test_data_RGB(FLAGS.img_dir, FLAGS.out_dir)
  File "run_data_preparation.py", line 217, in prepare_test_data_RGB
    pb_path, img_dir, lmk3D_ori_txt_path, lmk2D_ori_txt_path
  File "run_data_preparation.py", line 84, in detect_2Dlmk_all_imgs
    np.array([lmk3D]), np.array([img]), sess
  File "/data/hifi3dface/hifi3dface/data_prepare/detect_2D_landmark.py", line 226, in detect_2Dlmk68
    heatmap = sess.run(outputs, {inputs: test_img})
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
    run_metadata_ptr)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1135, in _run
    feed_dict_tensor, options, run_metadata)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
    run_metadata)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU
         [[Node: max_pool = MaxPool[T=DT_FLOAT, data_format="NCHW", ksize=[1, 1, 2, 2], padding="VALID", strides=[1, 1, 2, 2], _device="/job:localhost/replica:0/task:0/device:CPU:0"](Relu_23)]]

Caused by op 'max_pool', defined at:
  File "run_data_preparation.py", line 342, in <module>
    app.run(main)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/absl/app.py", line 300, in run
    _run_main(main, args)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "run_data_preparation.py", line 321, in main
    prepare_test_data_RGB(FLAGS.img_dir, FLAGS.out_dir)
  File "run_data_preparation.py", line 217, in prepare_test_data_RGB
    pb_path, img_dir, lmk3D_ori_txt_path, lmk2D_ori_txt_path
  File "run_data_preparation.py", line 70, in detect_2Dlmk_all_imgs
    tf.import_graph_def(graph_def, name="")
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 432, in new_func
    return func(*args, **kwargs)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 513, in import_graph_def
    _ProcessNewOps(graph)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 303, in _ProcessNewOps
    for new_op in graph._add_new_tf_operations(compute_devices=False):  # pylint: disable=protected-access
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3540, in _add_new_tf_operations
    for c_op in c_api_util.new_tf_operations(self)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3540, in <listcomp>
    for c_op in c_api_util.new_tf_operations(self)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3428, in _create_op_from_tf_operation
    ret = Operation(c_op, self)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1718, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Default MaxPoolingOp only supports NHWC on device type CPU
         [[Node: max_pool = MaxPool[T=DT_FLOAT, data_format="NCHW", ksize=[1, 1, 2, 2], padding="VALID", strides=[1, 1, 2, 2], _device="/job:localhost/replica:0/task:0/device:CPU:0"](Relu_23)]]

data prepare failed

Model training for the European race

Hello!
Thanks for a great job!
Could you tell me how to use your method for the European race? How can we train weights for this? Maybe there is some code?

De-light step

Where in the code is the de-light step mentioned in Fig 9 performed? I could not find it by reading the code.

FileNotFoundError

FileNotFoundError: [Errno 2] No such file or directory: './resources/diffuse/2k_F_EAS_face_026_D.tga'

How to use augmented 3dmm bases for single image input

I noticed that the run_RGB_opt with a single input image uses the no-augmented bases. The output geometry is a full head, which doesn't require another step to add the full head. And there is no difference between males and females about the shoulder and other geometries. Therefore, I try to modify the bash file to use augmented 3dmm bases and use the add_head tool in RGBD utils to make a full head for single image input. The final result for the face region is better than the previous but the backhead is too long and strange. Do you have any idea about how to solve it or where should I change?

Convert HiFi3D++ UV texture to FLAME UV texture

Hi !
Thanks a lot for sharing this amazing work!
I have a question I hope you could help me with.
I'm trying to convert a UV texture made for HiFi3D++ into a UV texture for FLAME.
In https://github.com/csbhr/FFHQ-UV/blob/main/FLAME_Apply_HIFI3D_UV/flame2hifi3d_assets/FLAME_w_HIFI3D_UV.obj , the UV coordinates of the HiFi3D++ UV-texture map corresponding to the Flame vertices/faces are provided (https://github.com/csbhr/FFHQ-UV/blob/main/README_flame2hifi3d.md), using these UV coordinates, the FLAME meshes can look for texture colors from the UV-maps in HiFi3D++ format.
I need to basically copy the pixels from one UV texture into the corresponding location in the new UV texture. Any tips on how to get this correspondence?

Thanks a lot !!
Best

rgb 图3d头部建模效果差

用rgb multi view 刘亦菲的3d头模型效果:
WeChatWorkScreenshot_03698d69-4204-4b6a-aae9-b5d74d32e671(1)

用rgb multi view 胡歌的3d头模型效果
WeChatWorkScreenshot_e1061808-a8a0-4a99-9d1f-77802890b71f(1)

用rgb图的效果比较差,这个是算法的问题吗

rasterize_triangles_kernel.so not found

Hi
Thanks for a great job. I've tried running it on Windows 10, but I've got an error in run_rgb_opt.
Is anyone run it on Windows, I install all packages and try to compile third-party files, but I failed.

Non-Asian .mat files

So your AI-NExT-Shape-NoAug.mat, AI-NExT-Shape.mat etc constructed/trained from 200 asian models. Is it possible us to create non-asian versions? Or both for global use?

tensorflow -gpu1.15 cuda 10.0 cudnn 7.5 上报错

prepare datas
start MTCNN
MTCNN detect
WARNING:tensorflow:From /home/cc/code/hifi3dface/data_prepare/detect_face_with_mtcnn.py:349: The name tf.GraphDef is deprecated. Please use tf.compat.v1.GraphDef instead.

W1224 16:22:07.315534 140424515024704 module_wrapper.py:139] From /home/cc/code/hifi3dface/data_prepare/detect_face_with_mtcnn.py:349: The name tf.GraphDef is deprecated. Please use tf.compat.v1.GraphDef instead.

hello
WARNING:tensorflow:From /home/cc/code/hifi3dface/data_prepare/detect_face_with_mtcnn.py:356: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

W1224 16:22:07.335879 140424515024704 module_wrapper.py:139] From /home/cc/code/hifi3dface/data_prepare/detect_face_with_mtcnn.py:356: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

2020-12-24 16:22:07.336520: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-12-24 16:22:07.369774: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-12-24 16:22:07.370135: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1660 Ti major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:01:00.0
2020-12-24 16:22:07.370294: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2020-12-24 16:22:07.371003: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2020-12-24 16:22:07.380746: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0
2020-12-24 16:22:07.382767: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0
2020-12-24 16:22:07.383489: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0
2020-12-24 16:22:07.392925: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0
2020-12-24 16:22:07.394720: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2020-12-24 16:22:07.394814: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-12-24 16:22:07.395156: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-12-24 16:22:07.395458: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2020-12-24 16:22:07.395700: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-12-24 16:22:07.400321: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2599990000 Hz
2020-12-24 16:22:07.401293: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55777bf37240 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-12-24 16:22:07.401307: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2020-12-24 16:22:07.462119: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-12-24 16:22:07.462506: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55777bfc9c10 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-12-24 16:22:07.462522: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): GeForce GTX 1660 Ti, Compute Capability 7.5
2020-12-24 16:22:07.462639: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-12-24 16:22:07.462913: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1660 Ti major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:01:00.0
2020-12-24 16:22:07.462943: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2020-12-24 16:22:07.462954: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2020-12-24 16:22:07.462964: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0
2020-12-24 16:22:07.462974: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0
2020-12-24 16:22:07.462984: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0
2020-12-24 16:22:07.462994: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0
2020-12-24 16:22:07.463004: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2020-12-24 16:22:07.463039: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-12-24 16:22:07.463320: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-12-24 16:22:07.463576: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2020-12-24 16:22:07.463598: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2020-12-24 16:22:07.464194: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-12-24 16:22:07.464205: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165] 0
2020-12-24 16:22:07.464210: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0: N
2020-12-24 16:22:07.464273: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-12-24 16:22:07.464565: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-12-24 16:22:07.464843: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 5071 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1660 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5)
WARNING:tensorflow:From /home/cc/code/hifi3dface/data_prepare/detect_face_with_mtcnn.py:358: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead.

W1224 16:22:07.466073 140424515024704 module_wrapper.py:139] From /home/cc/code/hifi3dface/data_prepare/detect_face_with_mtcnn.py:358: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead.

=========================
2020-12-24 16:22:07.789434: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2020-12-24 16:22:08.154596: E tensorflow/stream_executor/cuda/cuda_dnn.cc:329] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
2020-12-24 16:22:08.165649: E tensorflow/stream_executor/cuda/cuda_dnn.cc:329] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
Traceback (most recent call last):
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call
return fn(*args)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn
target_list, run_metadata)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.UnknownError: 2 root error(s) found.
(0) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[{{node pnet/conv1/Conv2D}}]]
(1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[{{node pnet/conv1/Conv2D}}]]
[[pnet/prob1/_5]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "run_data_preparation.py", line 342, in
app.run(main)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/absl/app.py", line 303, in run
_run_main(main, args)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "run_data_preparation.py", line 321, in main
prepare_test_data_RGB(FLAGS.img_dir, FLAGS.out_dir)
File "run_data_preparation.py", line 204, in prepare_test_data_RGB
names_list = detect_face_with_mtcnn.detect_with_MTCNN(img_dir, mtcnn_dir, pb_path)
File "/home/cc/code/hifi3dface/data_prepare/detect_face_with_mtcnn.py", line 388, in detect_with_MTCNN
img, minsize, pnet, rnet, onet, threshold, factor
File "/home/cc/code/hifi3dface/data_prepare/detect_face_with_mtcnn.py", line 89, in detect_face
out = pnet(img_y)
File "/home/cc/code/hifi3dface/data_prepare/detect_face_with_mtcnn.py", line 45, in
("pnet/conv4-2/BiasAdd:0", "pnet/prob1:0"), feed_dict={"pnet/input:0": img}
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 956, in run
run_metadata_ptr)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run
feed_dict_tensor, options, run_metadata)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run
run_metadata)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.UnknownError: 2 root error(s) found.
(0) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[node pnet/conv1/Conv2D (defined at /home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]
(1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[node pnet/conv1/Conv2D (defined at /home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]
[[pnet/prob1/_5]]
0 successful operations.
0 derived errors ignored.

Original stack trace for 'pnet/conv1/Conv2D':
File "run_data_preparation.py", line 342, in
app.run(main)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/absl/app.py", line 303, in run
_run_main(main, args)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "run_data_preparation.py", line 321, in main
prepare_test_data_RGB(FLAGS.img_dir, FLAGS.out_dir)
File "run_data_preparation.py", line 204, in prepare_test_data_RGB
names_list = detect_face_with_mtcnn.detect_with_MTCNN(img_dir, mtcnn_dir, pb_path)
File "/home/cc/code/hifi3dface/data_prepare/detect_face_with_mtcnn.py", line 354, in detect_with_MTCNN
tf.import_graph_def(graph_def, name="")
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/framework/importer.py", line 405, in import_graph_def
producer_op_list=producer_op_list)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/framework/importer.py", line 517, in _import_graph_def_internal
_ProcessNewOps(graph)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/framework/importer.py", line 243, in _ProcessNewOps
for new_op in graph._add_new_tf_operations(compute_devices=False): # pylint: disable=protected-access
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3561, in _add_new_tf_operations
for c_op in c_api_util.new_tf_operations(self)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3561, in
for c_op in c_api_util.new_tf_operations(self)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3451, in _create_op_from_tf_operation
ret = Operation(c_op, self)
File "/home/cc/anaconda3/envs/tf1.15/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1748, in init
self._traceback = tf_stack.extract_stack()

data prepare failed

Mismatch between vertex list and those reference by faces in AI-Next-Shape.mat and about the 86 landmarks

Hello, thank you for the amazing work I have two questions as follows.

  1. In the "AI-Next-Shape.mat' file, the total number of vertices is 20481 but 10963 of them are not referenced by any listed face in 'tri'. The vertices in 'AI-Next-Shape-NoAug.mat', however, seemed to be referenced by at least one face. I was wondering if the augmentation allowed the reduction of the number of required vertices by increasing the dimensionality of PCA or if the face list should be modified to something else.

  2. Are the 86 landmarks superset of the conventional 68 landmarks? Is it possible to know which index out of the 86 landmarks corresponds to the 68 landmarks?

Thank you so much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.