zjjMaiMai / Deep-Alignment-Network-A-convolutional-neural-network-for-robust-face-alignment

This is a Tensorflow implementations of paper "Deep Alignment Network: A convolutional neural network for robust face alignment".
https://github.com/zjjMaiMai/Deep-Alignment-Network-A-convolutional-neural-network-for-robust-face-alignment
221 stars 71 forks source link

About GetMeanShape #5

Open mariolew opened 6 years ago

mariolew commented 6 years ago

In the function GetMeanShape, halfsize = int((ymean - ymin) * 2.0), I think it's not proper to *2.

zjjMaiMai commented 6 years ago

i did not use the bounding boxes to get face position.

but ground truth max_min boxes is too small, so * 2.0 (or * 1.5) just make sure the face information is all included in the picture.

zj463261929 commented 6 years ago

problem1: Tensorflow1.2.0 can be used instead of tensroflow1.3.0??? problem2: Whether the theano version of the model "DAN-Menpo.npz" is available??? problem3: What do you need to pay attention to when using this code as a test??? thanks.

zjjMaiMai commented 6 years ago

@zj463261929 1: yes , maybe need a few modifications. 2: no 3: see function Landmark68Test in DAN.py

zj463261929 commented 6 years ago

thanks. problem1: Do you have the model parameters for the tensorflow version? zj463261929@163.com problem2: Should the theano version of the model "DAN-Menpo.npz" turn into a tensorflow version? What do you need to pay attention to, thanks.

zjjMaiMai commented 6 years ago

@zj463261929 there is no pretrain model , you can train by yourself. I think there is no way to convert "DAN-Menpo.npz" into a tensorflow version.

zj463261929 commented 6 years ago

thanks

mariolew commented 6 years ago

@zjjMaiMai in DAN.py, https://github.com/zjjMaiMai/Deep-Alignment-Network-A-convolutional-neural-network-for-robust-face-alignment/blob/master/DAN/DAN/DAN.py#L71

T = tf.reverse(T,[-1]) A = tf.matrix_transpose(A)

But the original theano implementation didn't do transpose on A and reverse on T. So what's the purpose?

zjjMaiMai commented 6 years ago

@mariolew Sorry for not answering , I will check it soon.

zjjMaiMai commented 6 years ago

T = tf.reverse(T,[-1]) A = tf.matrix_transpose(A) But the original theano implementation didn't do transpose on A and reverse on T. So what's the purpose?

hi, 我们的T,A是用来计算旋转后图片的每一个像素位置映射到未旋转图片上的位置索引。注意到在后面的代码中,使用了tf.gather_nd来获取图片上对应索引上的像素值。因为tensorflow的中我们以[NHWC]的格式来保存,那么在这之前我们需要确保我们的索引是这样的排列 [height_idx,weight_idx]。所以我们调换了矩阵的排列,使得我们按照我们预想的取到正确的像素值。

请注意在作者的实现中,在code取值时的顺序pixels[:, 1], pixels[:, 0]

Edwardmark commented 6 years ago

@zjjMaiMai in https://github.com/zjjMaiMai/Deep-Alignment-Network-A-convolutional-neural-network-for-robust-face-alignment/blob/master/DAN/DAN/DataSetPre.py#L67 what does the code mean? And what is the meaning of RandomSRT? R = np.linalg.inv(R) T = np.dot(-T, R) Img = ndimage.interpolation.affine_transform(img,R,T[[1,0]],output_shape=(IMGSIZE,IMGSIZE)) Best, Edward

zjjMaiMai commented 6 years ago

@Edwardmark RandomSRT mean scale/rotate/translate image and shape randomly. if s1 = s0 r + t, then: s1 - t = s0 r (s1 - t) r_inv = s0 s1 r_inv + (-t * r_inv) = s0

so we have R = np.linalg.inv(R) and T = np.dot(-T, R)