Fire is the main disaster that causes economic losses and threats to life safety. The target detector can detect the flame and send an alarm in the early stage of the fire, preventing the deterioration of the fire and causing more losses. Most current target detection models are too large to be deployed on flame detection equipment. In this work, we improved the efficiency of YOLOv5 for real-time flame detection. We pruned the YOLOv5s model at the BatchNormalization (BN) layer, and further distilled the pruned model to fine-tune the accuracy. The compressed YOLOv5s model can reach 76.9% mAP at 44 FPS on our expanded dataset. The accuracy of the compressed model does not decrease compared with the original YOLOv5 model. The Flops is reduced by 54.5%, the parameter amount is reduced by 37.8%, the weight storage file size is reduced by 37.5%, and the inference rate has an increase of four frames per second.