Coal gangue sorting is an important link in the coal mining and processing process,which can effectively reduce the difficulty and cost of coal processing in the later stage.A deep learning based coal gangue detection method was proposed to address the problems of complex coal gangue sorting processes,low sorting efficiency,and high difficulty in manual selection in China.This method adopts the YOLOv7 deep learning algorithm as the core,and achieves real-time intelligent sorting of coal gangue by creating a coal gangue dataset,training detection models,and building a coal gangue detection platform.The experimental results showed that the mAP of YOLOv7 model was 96.70%,and the detection speed was 69fps,which had significant advantages compared to YOLOv5,SSD,and Faster-RCNN algorithms.