Aiming at the problems of low contrast, poor recognition accuracy, and difficult detection of infrared targets in aerial scenes, this study proposes an aerial infrared target detection algorithm based on attention and quantization awareness. Firstly, the DC-ELAN module is innovatively constructed by using DCNv2 to replace the 3×3 convolution in the ELAN module, which effectively improves the ability of the model to capture local and global features, and then strengthens the feature representation ability of the network. Secondly, by cleverly integrating the SE attention mechanism into the SPPCSPC module and the ELAN module, the SE-SPPCSPC module and the SE-ELAN module are designed, which helps to enhance the spatial self-attention of the feature map, and the model can better focus on target areas. In addition, the QARepVGG module is introduced to improve the quantization awareness of the model and enhance its robustness to quantization errors. Finally, the DyHead module is introduced, which can dynamically adjust the detection head according to different input images, improve the detection ability of the model to targets of different sizes and shapes, and further improve the accuracy and robustness of infrared target detection. Experimental results show that compared with the original model, the improved YOLOv7-tiny model has 3.4% and 4.8% increases in mAP@0.5 and mAP@0.5:0.95 values without increasing the amount of calculation, which significantly improves model detection accuracy.