## 1 Introduction
In the field of coal gangue recognition, the gangue recognition method based on industrial camera images can capture more gangue features, however, this method has difficulty achieving ideal recognition results for coal gangue that is seriously wrapped by coal sludge in the coal mine. In addition, although the image recognition method based on projected imaging is not easily disturbed by the complex environment of coal mines, a series of algorithms represented by the R-value method mostly have complex calculation, difficultly in determining the threshold value, and rely on a large amount of manual experience, which greatly limits the application of this method in the actual scene. Therefore, to meet the demand for efficient and intelligent sorting in coal mines and to maximize the recognition precision and sorting efficiency of coal gangue, this paper combines the advantages of YOLOv5 precision and efficiency with the weak environmental sensitivity of the projection recognition method, and proposes a target detection algorithm for coal gangue based on the combination of dual-energy X-rays and the improved YOLOv5 model (DX-YOLOv5), together with the design of a new type of intelligent gangue sorting system which can sort the gangue with high precision and efficiency without the intervention of human beings and can overcome the harsh underground conditions without being influenced by the temperature, dust, and hazardous gases. The principal contributions of this paper are as follows. First, dataset construction: given that there is no publicly available dataset of dual-energy X-ray images of coal and gangue, this paper creates a customized dataset for learning and testing by collecting coal mine data in the field and combining it with LableImg. Second, backbone network: to address the fact that the network parameters and calculation complexity of CSPDarknet consume a large amount of computing resources of hardware devices, in this paper, EfficientNetv2, a lightweight network, is used as the backbone network of YOLOv5-S to enhance computational productivity and precision. Third, neck design: to achieve further network performance enhancement by lightweighting the network, this paper designs a LPAN in the neck instead of the original PAN module, and seamlessly integrates the CBAM into the feature fusion module to maximize the learning effect. Fourth, detection head optimization: to promote the multi-scale target inspection performance of the algorithms presented by this paper, this paper adds the L2 output block to achieve the detection of small targets with a resolution of 160 \(\times\) 160. Fifth, modification of the loss function: to achieve a higher rate of convergence and optimized positioning, this paper chooses the EIOU-loss to substitute the CIOU-loss in the previous network architecture to improve regression precision. Sixth, the design of a new type of intelligent gangue sorting system, which can overcome the harsh environment of coal mines and achieve high-speed and high-efficiency sorting of coal gangue with a large range of particle size. The remainder of this article is as follows. Section 2 presents the process flow of the coal gangue sorting system designed in this paper and the principle of dual-energy X-ray identification. Section 3 describes the structure of YOLOv5 and the main points of creativity in this paper. Section 4 gives the relevant experiments of this paper's methodology on the self-built dataset and the performance is compared with that of other classically based algorithms. Finally, Section 5 gives the conclusion.