Aiming at solving the issues that fire detection is prone to be affected by environmental factors, and the accuracy of flame and smoke detection remains relatively low at the incipient stage of fire, a fire detection algorithm based on GCM-YOLO is put forward. Firstly, GhostNet is introduced to optimize the backbone network, enabling the model to be lightweight without sacrificing model accuracy. Secondly, the upsampling module is reorganized with content-aware features to enhance the detail capture and information fusion effect of the model. Finally, by incorporating the mixed local channel attention mechanism in the neck, the model can enhance the processing capability of complex scenes. The experimental results reveal that, compared with the baseline model YOLOv8n, the GCM-YOLO model in fire detection increases the mAP@0.5 by 1.2%, and the number of parameters and model size decrease by 38.3% and 34.9%, respectively. The GCM-YOLO model can raise the accuracy of fire detection while reducing the computational burden and is suitable for deployment in practical application scenarios such as mobile terminals.