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()
It is the result. I don't know why the transformed image is wrong? can you help me? please! Thank you!
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()
It is the result. I don't know why the transformed image is wrong? can you help me? please! Thank you!