The project's aim is to compare the results obtained with the pretrained Extreme 3D Faces CNN (https://github.com/anhttran/extreme_3d_faces) [1] and a ground truth using a well-known dataset (http://kunzhou.net/zjugaps/facewarehouse/) [2] to measure the similarity between the two models and, hence, estimate the performance of the net. The aligment phase is realized with cpd rigid algorithm [3].
To build and run the files, you will need the following libraries:
- scikit-learn 0.21.2
- matplotlib 3.1.1
- pycpd 1.0.5
- numpy 1.16.2
- open3d-python 0.7.0.0
- scipy 1.3.0
- h5py 2.9.0
To run the whole project, you are required to follow some steps. The parameters of each function will be explained in the next subsection.
- Download the Extreme 3D Faces
and follow the instructions to make it work correctly. Otherwise, you will need
some 3D models from another CNN in a
.plyformat (in this case, you will also need to adapt the next steps). - Save the
.plyfiles of the network in thefilePlyRetefolder. - Get the FaceWarehouse dataset
- Copy the data of the dataset in a
faceWarehousefolder. - Run the
plyTotxt()function inplyConverter.pychoosing the right values of the parameters. This will convert the.plyfiles in a bunch of.txt(stored in thedatafolder) files in order to make the next steps easier. - Run the
MatTotxt()function in thematConverter.pyfile. This will convert the dataset's.mat3D models in a.txtformat and store them in agroudtruthfolder. - Run
distancesTest()intest.pyto find out how much the two models are similar. If you want an overview of the accuracy of the different poses, you can also runposesPrecision(). - To build a heatmap of the alignment, you can run the
open3Dheatmap()function in theheatmap.pyfile.
plyTotxt():directorystands for the directory where you can find the.plyfiles. If you follow the steps above, this should be set to'filePlyRete/';compressionLevelstands for the sampling parameterKof the KNNSearch algorithm: since a single model has over 170.000 points, you will probably need to sample the model (depending on your hardware). If you have a single-node cluster, we recommend you to leave this parameter to its default value;radiusstands for the maximum distance (from the nose tip) of the useful points: the CNN we've used reconstructs the ears, while the ground truth models have not also those points so, to achieve a better alignment, we've focused just on the face setting this parameter properly.MatTotxt(): same asplyTotxt(), but with ground truth Matlab files.distancesTest(): the FaceWarehouse dataset is structured this way: there are 150 candidates and 20 poses for each candidate. This means we can choose a subset of the candidates and also a subset of poses to run the test.testersandposesare two lists in which you just need to put the number of the testers and the poses you want to test.posesPrecision(): same asdistancesTest()open3Dheatmap():targetstands for the ground truth.txtmodel file path, whilesourcestands for the CNN.txtmodel file path.
[1] A. Tran, T. Hassner, I. Masi, E. Paz, Y. Nirkin, G. Medioni, Extreme 3D Face Reconstruction: Seeing Through Occlusions, IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2018.
[2] Cao Chen, Yanlin Weng, Shun Zhou, Yiying Tong, Kun Zhou: "FaceWarehouse: a 3D Facial Expression Database for Visual Computing", IEEE Transactions on Visualization and Computer Graphics, 20(3): 413-425, 2014.
[3] Andriy Myronenko and Xubo Song, Point Set Registration: Coherent Point Drift, IEEE Trans. on Pattern Analysis and Machine Intelligence, vol. 32, issue 12, pp. 2262-2275, 2009.



