sicxu / Deep3dPortrait

Deep 3D Portrait from a Single Image
MIT License
381 stars 72 forks source link

semantic segmantation #25

Open sumedhsonu opened 3 years ago

sumedhsonu commented 3 years ago

which face areas do you required to form a face like ears, hair face, mouth (lower or upper or both lips) and what else

sicxu commented 3 years ago

As shown in the figure blow, the 2nd column is the head region decided by semantic segmentation, including face, ear, and hair. The 3nd column shows the region of rendered face , and the last column shows the region for our depth estimation, which is calculated by . mask_0e3e5f0f6b1f4e22ac1e55c3bdde02fd

For the definition of face region in semantic segmentation, please refer to Face Parsing with RoI Tanh-Warping.

LeoGitGuy commented 3 years ago

Thank you for the great code! The code works well with the provided example images. However, to use my own images, I do not know how to generate the initial .mat file with the semantic segmentation. Do you have any links to an implementation of "Face Parsing with RoI Tanh-Warping" that returns the matrix or directly creates the .mat file? Unfortunately, I did not find any.

Help would be greatly appreciated, thank you already!

sicxu commented 3 years ago

For your purpose, you can refer to #15 .

LeoGitGuy commented 3 years ago

Thanks for your reply. For anybody else struggling with this: In the meantime I found this repo that does an excellent job with segmentation. It produces an segmentation image with the different regions coloured, but some small changes to the code (you can check the branch on my profile) let you create a .mat file that works really well with this repository here.

sicxu commented 3 years ago

@LeoGitGuy , cool! Thanks for your suggestion, I will keep this issue open for other people's reference.

jly0810 commented 2 years ago

感谢您的回复。对于其他一些苦苦的人的人:在楼上,我发现这个repo在对颜色的证明上非常棒。它会生成一个带有不同区域的分割图像,但是有一些更改(您可以在我的个人资料中查看)让您创建一个 .mat 文件,该文件非常适合这里的存储库。

I want to use my photos to generate a 3D portrait model. 

I can't find a specific method to generate mat files on your home page. I am a novice. I hope you can give me as detailed steps as possible to answer my doubts. Thank you very much for your help.

LeoGitGuy commented 2 years ago

I can't find a specific method to generate mat files on your home page. I am a novice. I hope you can give me as detailed steps as possible to answer my doubts. Thank you very much for your help.

You can use the repo of the face segmentation on my profile. If you execute the main function test_enhance_single_unalign.py it creates a .mat file in the results folder

oo92 commented 2 years ago

I can't find a specific method to generate mat files on your home page. I am a novice. I hope you can give me as detailed steps as possible to answer my doubts. Thank you very much for your help.

You can use the repo of the face segmentation on my profile. If you execute the main function test_enhance_single_unalign.py it creates a .mat file in the results folder

@LeoGitGuy How about the _landmark.txt and _detection.txt files?

oo92 commented 2 years ago

Also, the said python file does NOT generate a .mat file.

mawenjie1111 commented 2 years ago

I can't find a specific method to generate mat files on your home page. I am a novice. I hope you can give me as detailed steps as possible to answer my doubts. Thank you very much for your help.

You can use the repo of the face segmentation on my profile. If you execute the main function test_enhance_single_unalign.py it creates a .mat file in the results folder

but,in your repo, after running test_enhance_single_unalign.py . I can't find .mat in results folder

Ravindu-Yasas-Nagasinghe commented 2 years ago

Is there a repo or any method to generate the _detection.txt input file so I can test with my own input image. @sicxu @LeoGitGuy

Suvi-dha commented 2 years ago

You can use this code to generate landmark.txt

import face_alignment
import cv2
import numpy as np
fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=False)
img = cv2.imread('./test.png')
preds = fa.get_landmarks(img)[0] # (68,2)
w0 = img.shape[1]
h0 = img.shape[0]
lm = np.stack([preds[:,0],h0 - 1 - preds[:,1]], axis = 1) 
np.savetxt("_landmark.txt", lm)

pip install face_alignment before running this code

syysummer commented 11 months ago

I can't find a specific method to generate mat files on your home page. I am a novice. I hope you can give me as detailed steps as possible to answer my doubts. Thank you very much for your help.

You can use the repo of the face segmentation on my profile. If you execute the main function test_enhance_single_unalign.py it creates a .mat file in the results folder

Can you provide the details of the modifications to test_enhance_single_unalign.py when you generated the .mat file? Thank you so much!