Coal gangue detection method and system based on improved Yolov8m model
By combining the image acquisition scheme of 0-degree annular light source and bar light source and improving the MaSA and SAFM_UP method of the Yolov8m model, the problem of low detection accuracy in gangue sorting is solved, and intelligent automatic detection and sorting of gangue is realized.
Patent Information
- Application Number
- CN202510401942.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-07-18
AI Technical Summary
The existing coal gangue sorting methods have problems such as large human resources consumption, high water resources consumption and low detection accuracy, especially in complex environments, which are prone to missed inspection and missed inspection.
An image acquisition scheme is adopted that combines a 0-degree annular light source with a bar light source on both sides of the conveyor belt direction, and a MaSA attention mechanism and SAFM_UP upsampling method are introduced in the Yolov8m model to improve the model to improve detection accuracy.
In complex environments, the accuracy and sorting efficiency of coal gangue detection are significantly improved, intelligent automatic detection of coal gangue is realized, and missed inspections are reduced. It is suitable for industrial on-site applications with high dust and high humidity.
Smart Images

Figure CN120339212A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of target detection, and relates to a coal gangue detection method and system, specifically to a coal gangue detection method and system based on an improved Yolov8m model. Background Art
[0002] Coal gangue is a solid by-product generated during coal mining and processing, generally accounting for 15% to 20% of the total coal production. Its main components include inorganic components such as Al2O3, SiO2, and Fe2O3. Since the carbon content of coal gangue is relatively low, if coal gangue and coal are mixed and burned, more harmful gases such as SO2 and NO2 will be generated. If no relevant treatment is carried out, environmental problems such as acid rain will be caused. Therefore, coal gangue separation is an important link in the coal industry. Under the background of emphasizing environmental protection, the coal industry is vigorously developing clean technologies. The realization of efficient and energy-saving coal gangue separation is an important direction for the development of clean technologies. It can not only reduce the generation of harmful gases, but also the separated coal gangue can be used for special purposes such as backfilling mines, construction, and power generation, turning waste into treasure.
[0003] Currently, the main methods for separating coal gangue are manual sorting, mechanical wet separation, dry coal separation, and ray separation. Manual sorting relies on workers' own judgment of the color and texture of coal gangue for sorting. Due to its usually harsh working environment, it consumes a large amount of human resources, has a slow sorting speed, and cannot meet the requirements of modern fast sorting and large-scale sorting. The wet separation method mainly includes methods such as heavy medium shallow trough separation and heavy medium cyclone separation, which rely on separation media for mechanical sorting. This method requires a large amount of water resources. At present, the main coal utilization in China is concentrated in the central and western regions. The relative lack of water resources has led to the inability to widely promote the wet separation method in this region. The dry separation method mainly includes wind shakers, wind jigs, etc., which mainly utilize the physical property differences between coal and coal gangue for separation. Compared with the wet separation method, the dry separation method saves water resources, reduces production costs, and is more conducive to promotion in areas with less abundant water resources. The principle of ray separation is to use ray sensors to collect signals according to the different characteristics of coal gangue and coal in the absorption of medium and low-energy X-rays or γ-rays, and finally rely on models and the collected data for identification. However, for larger-sized gangue and coal, these rays cannot penetrate, so they cannot be distinguished. In addition, rays are radioactive, and stricter requirements are imposed on sorting operation specifications and protective measures. It can be seen that traditional coal gangue separation methods have many drawbacks. In order to solve the existing problems, there is an urgent need for intelligent and energy-saving and emission-reducing coal gangue separation methods.
[0004] With the rapid progress of artificial intelligence technology and GPU hardware technology, deep learning has made remarkable development in recent years and is widely used in various fields, such as voice assistants, license plate recognition, and access control systems based on face recognition. Deep learning has gradually replaced traditional machine learning methods with its powerful learning ability and has become a popular research field. This technology uses deep neural networks to learn the essential features of sample data, deeply analyzes images, sounds, etc., and enables machines to acquire the analysis and judgment abilities of specific things through learning like humans. For coal gangue target detection, if traditional machine learning methods are used, researchers need to design and extract features, such as color, shape, entropy value, etc. The quality of feature extraction directly affects the recognition results of the network model. In recent years, with the rapid development of artificial intelligence, more and more domestic and foreign researchers have used deep learning to automatically extract data features instead of the previous manual feature extraction. However, due to the interference of complex environments such as low light, uneven illumination, and dust in actual industrial production, there are still problems of low detection accuracy caused by missed detection and misdetection. Summary of the Invention
[0005] To solve the above problems, the present invention provides a coal gangue detection method and system based on an improved Yolov8m model for coal gangue sorting in coal gangue production scenarios. By designing a new image acquisition scheme combining 0-degree annular light and strip light, a coal gangue target detection model based on the improved Yolov8m model, and designing a sorting system, the accuracy of coal gangue detection is improved to solve the problems of missed detection and misdetection of coal gangue in complex environments, ensuring that coal gangue can be accurately identified and providing technical support for actual production.
[0006] The object of the present invention is achieved by the following technical solutions:
[0007] A coal gangue detection method based on an improved Yolov8m model, comprising the following steps:
[0008] Step 1. Image acquisition:
[0009] An image acquisition scheme combining a 0-degree annular light source and strip light sources on both sides of the conveyor belt direction is adopted for image acquisition;
[0010] Step 2. Coal gangue detection:
[0011] Step 2-1. Improve the Yolov8m model, and introduce the MaSA attention mechanism and the detailed upsampling method SAFM_UP into the backbone network and the neck network of the Yolov8m model respectively;
[0012] Step 2-2. Train the improved Yolov8m model;
[0013] Step 23: Obtain the collected real-time video from the server, and use the improved Yolov8m model trained in Step 22 to detect the video frames;
[0014] Step 3: Result output:
[0015] Input the video to be detected into the improved Yolov8m model for coal gangue detection and output the detection results.
[0016] A coal gangue detection system based on an improved Yolov8m model for implementing the above method, including an image acquisition module, a coal gangue detection module, and a result output module, where:
[0017] The image acquisition module is used to obtain the real-time running video on the coal gangue sorting conveyor belt;
[0018] The coal gangue detection module is used to detect coal gangue using the improved Yolov8m model for the video data collected by the image acquisition module;
[0019] The result output module is used to output the results detected by the coal gangue detection module.
[0020] Compared with the prior art, the present invention has the following advantages:
[0021] 1. In the coal gangue recognition system of the present invention, an image acquisition scheme of combining a 0-degree annular light source with two strip light sources in the conveyor belt direction is innovatively adopted, ensuring uniform illumination, shadow elimination, and surface feature enhancement. It is suitable for high-dust coal mine environments, with a compact design, easy installation, and low energy consumption, and has the following significant advantages and applicability:
[0022] (1) 0-degree annular light source: Directly irradiate from the front, providing uniform global illumination, effectively reducing local shadows caused by the uneven surface of coal and gangue, avoiding the loss of texture or color information, and ensuring that image details (such as cracks and color differences) are clearly visible; the diffuse reflection characteristic of the 0-degree annular light source can reduce the specular reflection on the surface of coal gangue, ensuring the authenticity of color information, such as gangue being slightly grayish-white and coal being black, and improving the classification accuracy based on the color model.
[0023] (2) Strip light source assistance: The strip light source arranged along the conveyor belt direction provides lateral supplementary light to further eliminate possible remaining shadows during dynamic transmission, such as the edges of coal blocks or the gaps of gangue, enhancing the overall consistency of the image. When the strip light source is obliquely irradiated at a low angle (such as 30° - 60°), it can highlight the microscopic texture and three-dimensional contour differences on the surface of coal and gangue, such as the rough surface of gangue and the smooth surface of coal, enhancing the algorithm's ability to extract morphological features.
[0024] (3) The size, shape, and stacking state of coal gangue vary greatly. The combination of ring light and bar light can cover the lighting requirements from multiple angles, and can handle complex scenarios such as material stacking and edge occlusion. The ring light source can be installed around the camera lens, and the bar light source is fixed laterally along the conveyor belt. The structure is compact and does not occupy extra space, making it suitable for the narrow environment of industrial sites. The LED light source has a long lifespan and low heat generation, making it suitable for long-term stable operation in high-dust and high-humidity environments such as coal mines, resulting in low energy consumption and maintenance costs for this solution.
[0025] 2. To solve detection problems such as missed detection and misdetection, the present invention proposes to improve the Yolov8m model, introduce the MaSA attention mechanism to enhance the feature extraction ability, and enhance non-local feature interaction through the SAFM_UP module to improve the accuracy of object detection. The improved model has improved the detection accuracy and sorting efficiency, promoting the intelligent development of the coal mining industry. This solution improves the detection accuracy while ensuring the real-time and reliability of image acquisition, which is an important progress in the automatic sorting of coal gangue. The main improvements are as follows:
[0026] (1) To solve the problem of missed detection in coal gangue detection, the present invention introduces an improved multi-axis self-attention (MaSA) mechanism into the Yolov8m model. First, through the relative position encoding generated by RetNetRelPos2d, the model can understand the spatial relationship between coal gangue and the background, reducing misjudgment. Then, MaSA decomposes the attention calculation into horizontal and vertical dimensions, improving the calculation efficiency without losing information integrity. In addition, depth convolution is used to process the values, and the feature representation is enhanced through local enhanced position encoding (lepe) and multiple linear projection layers, improving the model's adaptability to complex scenarios. In summary, the Yolov8m model integrated with the MaSA attention mechanism can identify coal gangue more accurately and efficiently, significantly reducing the situation of missed detection.
[0027] (2) To solve the problem of low detection accuracy caused by missed detection and misdetection in coal gangue detection, the present invention introduces the upsampling mechanism of the spatial adaptive feature modulation network (SAFMN) into the Yolov8m model. This mechanism effectively restores the feature map to high resolution through lightweight 3×3 convolution and pixel shuffle operations, enhancing the recognition ability of coal gangue. SAFMN particularly emphasizes the capture and fusion of multi-scale information, strengthens non-local feature interaction by dynamically adjusting the feature weights at each position, thereby improving the detection effect of coal gangue. In addition, the application of global residual connection helps to retain the high-frequency details in the image, further improving the detection accuracy. The Yolov8m model integrated with the SAFM_UP upsampling mechanism can better process information at different scales, significantly improving the detection accuracy of coal gangue.
[0028] 3. The video images in the coal gangue sorting process of the present invention are input into the coal gangue detection model, which can realize the intelligent detection of coal gangue. Moreover, the coal gangue detection process does not require manual intervention, can achieve the accuracy of coal gangue detection, and promote the intelligence of coal gangue sorting. Description of the Drawings
[0029] Figure 1 is the flowchart of the method of the present invention;
[0030] Figure 2 is the site of the coal gangue sorting equipment;
[0031] Figure 3 is the structure diagram of the acquisition box designed by the present invention;
[0032] Figure 4 is the model structure diagram of the improved Yolov8m model provided by the present invention;
[0033] Figure 5 is the schematic diagram of the attention mechanism MaSA structure introduced by the present invention;
[0034] Figure 6 is the structure diagram of the upsampling method SAFM_UP proposed by the present invention. Detailed Embodiment
[0035] The technical solutions of the present invention will be further described below in conjunction with the drawings, but are not limited thereto. Any modification or equivalent replacement of the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention shall be covered by the protection scope of the present invention.
[0036] In order to realize the automatic sorting of coal gangue and improve the accuracy and robustness of coal gangue detection, the present invention provides a coal gangue detection method based on an improved Yolov8m model, as Figure 1 shown, the method includes the following steps:
[0037] Step 1. Image acquisition:
[0038] An image acquisition scheme combining a 0-degree ring light source and bar light sources on both sides of the conveyor belt direction is adopted for image acquisition. The specific steps are as follows:
[0039] Step 11. Arrange bar light sources on both sides along the conveyor belt direction, and the bar light sources are irradiated at an inclination angle of 30° to 60°.
[0040] Step 12. Install a camera above the coal gangue sorting belt and install a 0-degree ring light source below the lens.
[0041] Step 13: Use a camera to collect real-time videos of coal and coal gangue on the conveyor belt, and transmit the collected real-time videos to the server.
[0042] Step 14: Perform data annotation and data augmentation on the collected images of coal gangue separation, and finally obtain a dataset for improving the training of the Yolov8m model.
[0043] The structure of the collection box is as Figure 3 shown. The combination of ring light + bar light is used to cover the multi-angle lighting requirements, and it can handle complex scenarios such as material stacking and edge occlusion.
[0044] Step 2: Coal gangue detection:
[0045] Step 21: Improve the Yolov8m model by introducing the MaSA attention mechanism and the detailed upsampling method SAFM_UP into the backbone network and the neck network of the Yolov8m model respectively.
[0046] Since the Yolov8m model can meet the requirements of industrial real-time detection, the present invention improves the Yolov8m model to realize the detection of coal gangue. The structure diagram of the improved Yolov8m model is as Figure 4 shown. The present invention respectively introduces the MaSA attention mechanism and the upsampling method SAFM_UP into the backbone network and the neck network of the Yolov8m model. Specifically, the MaSA attention mechanism is fused with the original C2f to obtain a new structural unit C2f_MaSA, which improves the learning ability and feature extraction efficiency of the network; the new upsampling method SAFM_UP is used to replace the upsampling module in the neck of Yolov8m. At the same time, in order to ensure that the model meets the enterprise lightweight requirements, only the second upsampling module is replaced. This makes the improved model pay more attention to the features of coal gangue during the training process, and better fuse features of different scales, enhancing the detection ability of coal gangue and improving the accuracy and robustness of model detection.
[0047] Step 22: In order to obtain the optimal weights of the coal gangue detection model, the present invention trains the improved Yolov8m model. The process of training the improved Yolov8m model mainly includes the following steps:
[0048] (1) Collect images of separated coal gangue in the real scene of the coal mine. For subsequent processing, the collected images are uniformly processed. Then, the labelme annotation software is used to annotate the category information and position information of coal and coal gangue in the images, and the annotated results are made into label files for subsequent training.
[0049] (2) The labeled image data is divided into a training set, a validation set, and a test set according to a ratio of 8:1:1. At the same time, in order to enhance the diversity of the data, improve the generalization performance of the model, and avoid overfitting in model training, the present invention performs data augmentation processing on the labeled image data using data augmentation methods such as flipping, changing the image brightness, and rotation.
[0050] (3) The training set and the validation set are input into the improved Yolov8m model, and the following parameters are set to complete the training process: the input image size is normalized to 640×640, and the SGD is used as the optimizer, where the momentum of the optimizer is 0.937. The number of model iterations (Epoch) is 100, the batch size is 8, and the learning rate is 0.01. After each Epoch of training, the weights obtained from the current training are verified on the validation set, and the verification results are returned. At the same time, the best model weights obtained so far are recorded, and the model weights with the best training results are saved after the training is completed.
[0051] (4) The images in the test set are detected using the model weights with the best results to test the effect of the improved Yolov8m model. At the same time, in order to better evaluate the effects of the model before and after improvement, the present invention uses the mean average precision (mAP), precision, recall, and F1-score as evaluation indicators.
[0052] mAP refers to the average of the average precisions of all classes. The closer the result is to 1, the higher the accuracy of the model detection. The calculation formula of this indicator is:
[0053]
[0054] In the formula: mAP is the average of the average precisions of all classes; m is the number of classes in the detection samples; P is the precision of the model; R is the recall of the model.
[0055] Precision refers to the ratio that the object detection model determines that the sample is a positive class and the sample is indeed a positive class. The closer the accuracy is to 1, the better the model effect.
[0056] Recall refers to the ratio of the correctly predicted samples by the model among all actual positive samples. The closer the recall result is to 1, the better the model.
[0057] The F1-score is the harmonic mean of the precision and the recall, which can better reflect the performance of the model. Its result ranges from 0 to 1, with the maximum value of 1. The closer the index result is to 1, the better the model detection accuracy. The above calculation formulas are shown in Formulas (2)-(4):
[0058]
[0059]
[0060] Where: P is the precision rate of the model; R is the recall rate of the model; F1 is the F1 score of the model; TP is the positive sample predicted by the model and actually a positive sample; FP is the positive sample predicted by the model but actually a negative sample; FN is the negative sample predicted by the model but actually a positive sample.
[0061] Step 23: Obtain the collected real-time video from the server, and use the improved Yolov8m model trained in Step 22 to detect the video frames;
[0062] Step 3: Result output:
[0063] Input the video to be detected into the improved Yolov8m model for coal gangue detection and output the detection result. The specific steps are as follows:
[0064] Input the video to be detected into the improved Yolov8m model. After using the improved Yolov8m model to detect the real-time video, use a rectangular box to mark the coal gangue and its position, and output the detection result to the robotic arm and the robotic gripper, and use the robotic arm and the robotic gripper to achieve the separation of coal gangue.
[0065] The present invention also provides a coal gangue detection system for implementing the above method. The system mainly includes three main modules: an image acquisition module, a coal gangue detection module, and a result output module, where:
[0066] The image acquisition module uses a camera installed above the coal gangue sorting belt to collect the real-time video of coal and coal gangue on the transportation belt, and transmits the collected real-time video to the server;
[0067] The coal gangue detection module obtains the collected real-time video from the server, and then uses the improved Yolov8m model to detect the video frames to achieve the detection of coal gangue;
[0068] After the result output module detects the real-time video through the coal gangue detection module, it uses a rectangular box to mark the coal gangue and its position, and outputs the detection result to the robotic arm and the robotic gripper, and uses the robotic arm and the robotic gripper to achieve the separation of coal gangue.
[0069] Through the above implementation methods, the present invention can effectively implement the experiment of coal gangue target detection based on the improved Yolov8m model in complex environments such as uneven illumination and high dust. The present invention realizes the automatic detection and sorting of coal gangue based on the improved Yolov8m model, and finally realizes the intelligent detection of coal gangue. The implementation process of the above coal gangue detection does not require manual intervention, and can achieve the accuracy of coal gangue detection, promoting the intelligence of coal gangue sorting.
Claims
1. A coal gangue detection method based on an improved Yolov8m model, characterized in that The method includes the following steps: Step 1, Image acquisition: An image acquisition scheme combining a 0-degree annular light source and strip light sources on both sides of the conveyor belt direction is adopted for image acquisition; Step 2, Coal gangue detection: Step 2-1, Improve the Yolov8m model by introducing the MaSA attention mechanism and the detail upsampling method SAFM_UP in the backbone network and the neck network of the Yolov8m model respectively; Step 2-2, Train the improved Yolov8m model; Step 2-3, Obtain the collected real-time video from the server, and use the improved Yolov8m model trained in Step 2-2 to detect the video frames; Step 3, Result output: Input the video to be detected into the improved Yolov8m model for coal gangue detection and output the detection result.
2. The coal gangue detection method based on the improved Yolov8m model according to claim 1, wherein The specific steps of Step 1 are as follows: Step 1-1, Arrange strip light sources on both sides along the conveyor belt direction; Step 1-2, Install a camera above the coal gangue sorting belt and install a 0-degree annular light source below the lens; Step 1-3, Use the camera to collect the real-time video of coal and coal gangue on the conveyor belt and transmit the collected real-time video to the server; Step 1-4, Perform data annotation and data augmentation processing on the collected images of coal gangue sorting, and finally obtain a dataset for improving the training of the Yolov8m model.
3. The coal gangue detection method based on the improved Yolov8m model according to claim 2, wherein The strip light source is irradiated at an inclination angle of 30° to 60°.
4. The coal gangue detection method based on the improved Yolov8m model according to claim 1, wherein The specific steps of Step 2-1 are as follows: Fuse the MaSA attention mechanism with C2f to obtain the structural unit C2f_MaSA; replace the second upsampling module in the neck with the upsampling method SAFM_UP.
5. The coal gangue detection method based on the improved Yolov8m model according to claim 1, characterized in that The specific steps of Step 2-2 are as follows: (1) Collect images of sorting coal gangue in the real scene of the coal mine, uniformly process the collected images, and then use the labelme annotation software to annotate the category information and position information of coal and coal gangue in the images for the collected dataset, and make the annotated results into label files; (2) Divide the annotated image data into a training set, a validation set and a test set, and perform data augmentation processing on the divided data; (3) Input the training set and the validation set into the improved Yolov8m model. Every time the model completes one Epoch of training, the weights obtained from the current training will be verified on the validation set, and the verification result will be returned. At the same time, record the current best model weights, and save the model weights with the best training results after training; (4) Use the model weights with the best results to detect the images in the test set to test the effect of the improved Yolov8m model.
6. The coal gangue detection method based on the improved Yolov8m model according to claim 1, wherein The specific steps of Step 3 are as follows: Input the video to be detected into the improved Yolov8m model. After using the improved Yolov8m model to detect the real-time video, use a rectangular box to mark the coal gangue and its position therein, and output the detection result to the robotic arm and the robotic gripper, and use the robotic arm and the robotic gripper to realize the sorting of coal gangue.
7. A coal gangue detection system based on an improved Yolov8m model for implementing the method according to any one of claims 1-6, characterized in that The system includes an image acquisition module, a coal gangue detection module and a result output module, where: The image acquisition module is used to obtain the video of the real-time operation on the coal gangue sorting conveyor belt; The coal gangue detection module is used to detect coal gangue in the video data collected by the image acquisition module by using the improved Yolov8m model; The result output module is used to output the results detected by the coal gangue detection module.