Aiming at the problem that due to the complex background of optical remote sensing images, non-rotating frame target detection is easy to introduce background information, resulting in image classification that is prone to errors and missed detections, a classification model based on improved YOLOv7-tiny was proposed. On the one hand, this method introduces rotating frame detection to YOLOv7-tiny, which avoids the prediction frame containing background information and effectively improves the classification recognition rate of the model. On the other hand, it proposes a dual-scale loss function, which effectively solves the problem of the rotation angle of the square prediction frame. The problem cannot be optimized, and the high-precision coverage target of the rotation prediction frame is achieved. This method has been tested on remote sensing ship, aircraft, and car classification data sets. The experimental results show that the average detection accuracy of the improved network is increased by about 8 %.