RM-Zhang / SCPNet

This is the official implementation of ECCV2024 paper “SCPNet: Unsupervised Cross-modal Homography Estimation via Intra-modal Self-supervised Learning”.
Apache License 2.0
16 stars 1 forks source link

About the homography estimation~ #2

Open huihuimaimaiti opened 1 month ago

huihuimaimaiti commented 1 month ago

Hello, I am a first-year graduate student. Your code is so excellent, but I want to know, what's the meaning of pair12/11/22_f_w, pair12/11/22_f_nw, pair12/11/22_pred_4p? If I input two pictures and only want to get a homography matrix, which part of the code should be modified? Thanks again!

RM-Zhang commented 1 month ago

Hello, thanks for your interest about our work. The pair11/12/22 denote two images with modality 11/12/22. For example, pair11 means the two images are both modality 1, and there is a homography transformation between them. f_nw and f_w denote the consistent feature maps of two images, and pred_4p denotes the offsets of four corner points. Please refer to the function network_forward() for more details. Moreover, you can use torchgeometry.get_perspective_transform() to obtain the homography matrix from the offsets.

huihuimaimaiti commented 1 month ago

Hello, thanks for your interest about our work. The pair11/12/22 denote two images with modality 11/12/22. For example, pair11 means the two images are both modality 1, and there is a homography transformation between them. f_nw and f_w denote the consistent feature maps of two images, and pred_4p denotes the offsets of four corner points. Please refer to the function network_forward() for more details. Moreover, you can use torchgeometry.get_perspective_transform() to obtain the homography matrix from the offsets.

Thank you for your patient reply. I added the return value pair12_pred_4p in forward. If I input two pictures, is pair12_pred_4p the final homography matrix result? I tested it with two pictures in the frame of the paper, and I didn't get satisfactory results. Why? 1727681857477

RM-Zhang commented 1 month ago

The pair12_pred_4p is the predicted offsets of four corner points. Could you show me your code?

huihuimaimaiti commented 1 month ago

Thank you for your reply. ① The red box in Figure 1 is the code I added in SCPNET.py to get the homography matrix H from pair12_pred4p during the test. ② I put img1 and img2 in the testA and testB folders respectively, and executed the command Python test scp net.py-model dir/home/b304/data2/SWH/scp net-main/ckpt/-model nameggmap.pth-dataset ggmap. ③ Then use the attached code in red box in Figure 2 to visually deform img2. No matter using matrix H or its inverse matrix, the result is not ideal. I want to know why. 1

2

RM-Zhang commented 3 weeks ago

Hello, as I'm not certain about the images and their resolutions used in your code, I'm unable to determine if there are any issues.

I've uploaded an example that demonstrates how to input two images and obtain the homography matrix between them. Please refer to https://github.com/RM-Zhang/SCPNet/blob/main/test_example.py.