DECA icon indicating copy to clipboard operation
DECA copied to clipboard

Is it possible to use our own 68pts landmarks to reconstruct?

Open adevra opened this issue 3 years ago • 1 comments

I realised that landmark generation is not very accurate, especially the lip corners Is there a way to tweak landmark generation or maybe we can use custom generated 68pts landmarks as in txt or csv file?

coppin100mm_vis_original_size dorcas4_vis dorcas5_vis

adevra avatar Sep 08 '22 21:09 adevra

just try to modify the code in decalib/datasets/detectors.py

class FAN(object):
    def __init__(self):
        import face_alignment
        self.model = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=False)

    def run(self, image):
        '''
        image: 0-255, uint8, rgb, [h, w, 3]
        return: detected box list
        '''
        out = self.model.get_landmarks(image)
        if out is None:
            return [0], 'kpt68'
        else:
            kpt = out[0].squeeze()
            left = np.min(kpt[:,0]); right = np.max(kpt[:,0]); 
            top = np.min(kpt[:,1]); bottom = np.max(kpt[:,1])
            bbox = [left,top, right, bottom]
            return bbox, 'kpt68'

BlueWinters avatar Aug 25 '23 03:08 BlueWinters