Aiming at the challenges of reliance on specific hardware, vulnerability to external signal interference, labor-intensive construction of extensive indoor datasets and image blurring due to device motion, an improved Building information modeling (BIM) aided indoor localization method via enhancing cross-domain image retrieval based on deep learning is proposed to achieve a cost-effective, accurate and efficient indoor localization methods in this paper. The proposed indoor localization method includes three processes. Firstly, the NAFNet is employed to remove the motion-blurred images to obtain a more clear and reliable image for image retrieval of indoor localization. Secondly, leverage BIM to create a dataset of rendered images enriched with position and orientation details, addressing labor-intensive construction challenges, reliance on specific hardware, vulnerability to external signal interference in gathering real-world datasets. The BIM rendered images are transformed into realistically styled synthetic images with CycleGAN to narrow the dissimilarity in spanning appearance and texture, facilitating the realism and credibility of cross-domain image retrieval of indoor localization. Lastly, the high adaptability features of synthetic images and indoor photographs are extracted with Swin Transformer, which has multi-scale attention mechanism and location coding prowess. The indoor localization is achieved based on prior position information of BIM rendered images obtained by image retrieval with the cosine similarity measure. The cross-domain image retrieval for BIM aided indoor localization was improved with the deep learning framework of NAFNet-CycleGAN-Swin Transformer. The indoor localization experiments with the public dataset from the University of Melbourne and a self-made dataset from Shandong Jianzhu University demonstrate that the average location accuracy of the proposed method reach of 94 % and 92 %. This advancement significantly enhances the efficiency, accuracy, and practicality of indoor localization, offering novel insights and technical pathways for the implementation of location-based services in the realm of building engineering.