justusschock / deep_alignment_network_pytorch

PyTorch Implementation of the Deep Alignment Network
https://justusschock.github.io/deep_alignment_network_pytorch/
BSD 2-Clause "Simplified" License
38 stars 8 forks source link

Hi some problems about image transform. #3

Open wqz960 opened 5 years ago

wqz960 commented 5 years ago

sorry to take your time! I used your imagetransfrom layer, landmarkstransfrom layer and the Heatmap layer for some tests. When the estimatetransform layer process a affine matrix. the landmarks are good to be transformed. But the image is not transformed, the transformed image become almost black! the images are all [batch, 3, 256, 256] Here is my define: mean_shape = torch.Tensor(np.load("meanshape.npy")) trafo_param_layer = EstimateAffineParams(mean_shape.squeeze(0)) img_trafo_layer = AffineImageTransformation((256, 256)) landmark_trafo_layer = AffineLandmarkTransformation() heatmap_layer = HeatMap((256, 256), 32) Here is my transform process: affine_params = trafo_param_layer(out.data.cpu()) transformed_img = img_trafo_layer(inp.data.cpu(), affine_params) transformed_lmks = landmark_trafo_layer(out.data.cpu(), affine_params) heatmap = heatmap_layer(transformed_lmks) Here is my debug show: ori_inp = inp.data.cpu().numpy() debug_inp = transformed_img.numpy() debug_lmk = transformed_lmks.numpy() for num in range(out.size(0)): plt.imshow(ori_inp[num].transpose(1,2,0)) plt.show() plt.imshow(debug_inp[num].transpose(1,2,0)) plt.plot(debug_lmk[num][:,0], debug_lmk[num][:,1], ".") plt.show() Figure_1 It is the result. I don't know why the transformed image is wrong? can you help me? please! Thank you!

justusschock commented 5 years ago

I don't know either but i'll definately have a look at this. Can you somehow provide your meanshape and the files for image and landmark coordinates?