Comments (15)
The author adopted the Basel Face Model (BFM) facial mesh triangle topology as stated in his paper. @HOMGH
the problem is that I'm getting always the same 3D mesh for each input (the below 3D mesh). It seems I'm getting the mean shape!
Hi, @HOMGH Can you share the code for outputing 3D face mesh? thank you very much!
The part of the code which is used to generate 3D mesh is :
write_obj_with_colors(('./test' '.obj'), vertices_in, trian.T, colors_in) #save 3d face(can open with meshlab)
in which the inputs are as follows:
trian= load_3DMM_tri_reduce() or load_3DMM_tri()
colors_in = np.ones((VERTEX_NUM_REDUCE,3)) (if you just want to display textureless 3D mesh)
vertices_in = np.reshape(verti,(VERTEX_NUM_REDUCE,3)) (this is the vertices output of network)
The write_obj_with_colors function can be found in write.py file:
def write_obj_with_colors(obj_name, vertices, triangles, colors):
''' Save 3D face model with texture represented by colors.
Args:
obj_name: str
vertices: shape = (nver, 3)
colors: shape = (nver, 3)
triangles: shape = (ntri, 3)
'''
triangles = triangles.copy()
triangles += 1 # meshlab start with 1
if obj_name.split('.')[-1] != 'obj':
obj_name = obj_name + '.obj'
# write obj
with open(obj_name, 'w') as f:
# write vertices & colors
for i in range(vertices.shape[0]):
# s = 'v {} {} {} \n'.format(vertices[0,i], vertices[1,i], vertices[2,i])
s = 'v {} {} {} {} {} {}\n'.format(vertices[i, 0], vertices[i, 1], vertices[i, 2], colors[i, 0], colors[i, 1], colors[i, 2])
f.write(s)
# write f: ver ind/ uv ind
[k, ntri] = triangles.shape
for i in range(triangles.shape[0]):
# s = 'f {} {} {}\n'.format(triangles[i, 0], triangles[i, 1], triangles[i, 2])
s = 'f {} {} {}\n'.format(triangles[i, 2], triangles[i, 1], triangles[i, 0])
f.write(s)
from nonlinear_face_3dmm.
Hello, did you manage to create? I have been meaning to do the same thing
from nonlinear_face_3dmm.
Hello, did you manage to create? I have been meaning to do the same thing
No I couldn't get the correct 3D mesh. This is what I got:
from nonlinear_face_3dmm.
Did you use the generated txt to create the model? And there is no texture?
from nonlinear_face_3dmm.
Did you use the generated txt to create the model? And there is no texture?
For now, I just want to display the shape. with no texture.
from nonlinear_face_3dmm.
And how did you create this mesh?
from nonlinear_face_3dmm.
And how did you create this mesh?
I used write_obj_with_colors(('./test' '.obj'), vertices_in, tri_in, colors_in) #save 3d face(can open with meshlab).
vertices is the generated shape vertices. But I'm not sure about triangle. I used load_3DMM_tri_reduce() function, but it seems something is wrong! Any idea?
from nonlinear_face_3dmm.
Is this function available on this git repository, I did not find it in here. Is it from another repository? And I have no idea how to estimate the triangles.
from nonlinear_face_3dmm.
The author adopted the Basel Face Model (BFM) facial mesh triangle topology as stated in his paper. @HOMGH
from nonlinear_face_3dmm.
The author adopted the Basel Face Model (BFM) facial mesh triangle topology as stated in his paper. @HOMGH
the problem is that I'm getting always the same 3D mesh for each input (the below 3D mesh). It seems I'm getting the mean shape!
from nonlinear_face_3dmm.
The author adopted the Basel Face Model (BFM) facial mesh triangle topology as stated in his paper. @HOMGH
the problem is that I'm getting always the same 3D mesh for each input (the below 3D mesh). It seems I'm getting the mean shape!
Hi,@HOMGH Can you share the code for outputting 3D face mesh? thank you very much!
from nonlinear_face_3dmm.
The author adopted the Basel Face Model (BFM) facial mesh triangle topology as stated in his paper. @HOMGH
the problem is that I'm getting always the same 3D mesh for each input (the below 3D mesh). It seems I'm getting the mean shape!
Hi, @HOMGH Can you share the code for outputing 3D face mesh? thank you very much!
from nonlinear_face_3dmm.
The author adopted the Basel Face Model (BFM) facial mesh triangle topology as stated in his paper. @HOMGH
the problem is that I'm getting always the same 3D mesh for each input (the below 3D mesh). It seems I'm getting the mean shape!
Hi, @HOMGH Can you share the code for outputing 3D face mesh? thank you very much!
The part of the code which is used to generate 3D mesh is :
write_obj_with_colors(('./test' '.obj'), vertices_in, trian.T, colors_in) #save 3d face(can open with meshlab)
in which the inputs are as follows:
trian= load_3DMM_tri_reduce() or load_3DMM_tri()
colors_in = np.ones((VERTEX_NUM_REDUCE,3)) (if you just want to display textureless 3D mesh)
vertices_in = np.reshape(verti,(VERTEX_NUM_REDUCE,3)) (this is the vertices output of network)The write_obj_with_colors function can be found in write.py file:
def write_obj_with_colors(obj_name, vertices, triangles, colors): ''' Save 3D face model with texture represented by colors. Args: obj_name: str vertices: shape = (nver, 3) colors: shape = (nver, 3) triangles: shape = (ntri, 3) ''' triangles = triangles.copy() triangles += 1 # meshlab start with 1 if obj_name.split('.')[-1] != 'obj': obj_name = obj_name + '.obj' # write obj with open(obj_name, 'w') as f: # write vertices & colors for i in range(vertices.shape[0]): # s = 'v {} {} {} \n'.format(vertices[0,i], vertices[1,i], vertices[2,i]) s = 'v {} {} {} {} {} {}\n'.format(vertices[i, 0], vertices[i, 1], vertices[i, 2], colors[i, 0], colors[i, 1], colors[i, 2]) f.write(s) # write f: ver ind/ uv ind [k, ntri] = triangles.shape for i in range(triangles.shape[0]): # s = 'f {} {} {}\n'.format(triangles[i, 0], triangles[i, 1], triangles[i, 2]) s = 'f {} {} {}\n'.format(triangles[i, 2], triangles[i, 1], triangles[i, 0]) f.write(s)
Hi, @HOMGH Thank you so much for replying to me so quickly。
I have another question. Where should the code you share be added to the model file? Can you give me some tips? Thank you very much for sharing and look forward to hearing from you.
Hi, I want to ask what does "trian.T" in the red box mean above image?
Is it convenient to contact you by email? My email address is "[email protected]". Looking forward to your reply.
from nonlinear_face_3dmm.
Hello, did you manage to create? I have been meaning to do the same thing
Hi,@HOMGH can you share code of the G_loss_frecon for me ? Thank you.
from nonlinear_face_3dmm.
The author adopted the Basel Face Model (BFM) facial mesh triangle topology as stated in his paper. @HOMGH
the problem is that I'm getting always the same 3D mesh for each input (the below 3D mesh). It seems I'm getting the mean shape!
Hi, @HOMGH Can you share the code for outputing 3D face mesh? thank you very much!
The part of the code which is used to generate 3D mesh is :
write_obj_with_colors(('./test' '.obj'), vertices_in, trian.T, colors_in) #save 3d face(can open with meshlab)
in which the inputs are as follows:
trian= load_3DMM_tri_reduce() or load_3DMM_tri()
colors_in = np.ones((VERTEX_NUM_REDUCE,3)) (if you just want to display textureless 3D mesh)
vertices_in = np.reshape(verti,(VERTEX_NUM_REDUCE,3)) (this is the vertices output of network)The write_obj_with_colors function can be found in write.py file:
def write_obj_with_colors(obj_name, vertices, triangles, colors): ''' Save 3D face model with texture represented by colors. Args: obj_name: str vertices: shape = (nver, 3) colors: shape = (nver, 3) triangles: shape = (ntri, 3) ''' triangles = triangles.copy() triangles += 1 # meshlab start with 1 if obj_name.split('.')[-1] != 'obj': obj_name = obj_name + '.obj' # write obj with open(obj_name, 'w') as f: # write vertices & colors for i in range(vertices.shape[0]): # s = 'v {} {} {} \n'.format(vertices[0,i], vertices[1,i], vertices[2,i]) s = 'v {} {} {} {} {} {}\n'.format(vertices[i, 0], vertices[i, 1], vertices[i, 2], colors[i, 0], colors[i, 1], colors[i, 2]) f.write(s) # write f: ver ind/ uv ind [k, ntri] = triangles.shape for i in range(triangles.shape[0]): # s = 'f {} {} {}\n'.format(triangles[i, 0], triangles[i, 1], triangles[i, 2]) s = 'f {} {} {}\n'.format(triangles[i, 2], triangles[i, 1], triangles[i, 0]) f.write(s)
What is the vertices_in
? Do you mean the output 'pred_shape.txt' ? Many thanks.
from nonlinear_face_3dmm.
Related Issues (20)
- Finetunning Manually reduce the m_loss, shape_loss weight by 10 times
- G_loss_frecon = tf.zeros(1)??? HOT 11
- Missing perceptual loss (G_loss_frecon = tf.zeros(1)) HOT 5
- InternalError: Failed to create session. HOT 1
- About requirements HOT 5
- Demo (Test) code HOT 8
- NameError: global name 'load_FaceAlignment_vt2pixel' is not defined
- Error in running rendering_example.py : undefined symbol: _ZN10tensorflow12OpDefBuilder5InputESs HOT 4
- Training config. (Training set size?)
- After training your model, the Rendered Image has no texture on it! HOT 7
- Pretrained model HOT 12
- Rendering Layer Not Differentiable. Cannot train with wild images. HOT 3
- Does G_loss_frecon need to modify it when using VGG-Face?
- Has anyone solved the code in the model_non_linear_3DMM file for solving the perceptual loss G_loss_frecon?
- Complie the render layer the error HOT 3
- The file ‘good_images.dat’ was not found
- About the l2,1 loss
- What is the version of tf?
- Generate 3DMM parameters.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nonlinear_face_3dmm.