Image matching is the key to accurate camera pose estimation.In recent years,the research on image matching based on the attention mechanism of deep learning has made great progress,but it is still a great challenge to reduce the high computational complexity of Transformer-like image matching networks.In order to improve the matching network efficiency,in this paper a self-cross attention mechanism based on ranking optimization was proposed.By reshaping the one-dimensional input feature map after position encoding and using a spatial-like attention mechanism to pick Top-m active pixel points to sparse the attention map,the time complexity of dot product attention was successfully reduced from quadratic to nearly linear.Experimental results show that the method is less time consuming in forward inference and can improve the accuracy of pose estimation to a certain extent.