ABSTRACT Aiming at the problems of low detection accuracy, slow detection speed and poor stability of traditional coal gangue detection based on image processing, a new YOLOv5s-EB (You Only Look Once Version-5s) network model is constructed for coal gangue target detection and location. Replace the PANet (Path Aggregation Network) layer of the original network with the BiFPN (Bidirectional Feature Pyramid Network) feature fusion network to enhance the global information extraction strength. And combined with the attention mechanism module of ECANet (Efficient Channel Attention Networks). 490 sets of multispectral data were obtained through the multispectral data acquisition system, and 980 original samples of coal and gangue were obtained, the original samples are preprocessed by histogram equalization to establish the coal gangue data set, they are trained in the original YOLOv5s, YOLOv5s-ECA, YOLOv5s-BiFPN, YOLOv5s-EB, YOLOv4 and YOLOv7 neural networks respectively. According to the results, the accuracy rate P of YOLOv5s-EB neural network model reaches 98.5%, and the recall rate R reaches 98.4%, the mAP reached 87.55%. Moreover, YOLOv5s-EB network model is relatively small, only 12.5MB. At the same time, the YOLOv5s-EB model obtains the coordinate information of the upper left and lower right corners of the target detection frame during the identification and detection process, and locates the coal gangue target for the convenience of subsequent sorting.