Weak spot ore separation method, device, readable storage medium and equipment

By introducing dense convolution and hierarchical attention modules into the neural network, the problem of the disappearance of weak and fine mineral spot features in deep learning ore sorting is solved, and the accuracy and precision of ore sorting are improved.

CN117975167BActive Publication Date: 2024-09-10EAST CHINA JIAOTONG UNIVERSITY
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202410354307.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-27
Publication Date
2024-09-10
Estimated Expiration
2044-03-27

AI Technical Summary

Technical Problem

When existing deep learning-based ore sorting technology sorts weak and fine mineral spots, too many network layers lead to downsampling of the ore image and the disappearance of the characteristics of weak and fine mineral spots, thereby reducing the sorting accuracy.

Method used

Construct a neural network, including a dense convolution module and a hierarchical attention module. The dense convolution module avoids feature disappearance, and the hierarchical attention module integrates local and global features. A pre-trained ore sorting model is obtained through deep learning training.

Benefits of technology

It improves the accuracy of ore sorting, ensures high-resolution feature transmission, improves the accuracy of model training, and solves the problem of low accuracy in identifying weak and fine mineral spot features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117975167B
    Figure CN117975167B
Patent Text Reader

Abstract

The present invention discloses a method, device, readable storage medium and equipment for sorting weak spot ore, the method comprising: constructing a neural network, the neural network at least comprising dense convolution modules and hierarchical attention modules respectively distributed front and back, the dense convolution modules are used to prevent the spot features from disappearing during the training process, and the hierarchical attention modules are used to fuse the local features of the spot with the global features; deep learning training is performed on the neural network to obtain a pre-trained ore sorting model; an ore image to be sorted is obtained, and the ore image to be sorted is input into the pre-trained ore sorting model to obtain the final sorting result. The present invention solves the problem of low accuracy in ore sorting in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of ore sorting, and in particular to a method, a device, a readable storage medium and equipment for sorting weak spot ore. Background Art

[0002] The earliest ore sorting was highly dependent on manual on-site selection, and workers used their naked eyes and experience to judge the waste one by one. This sorting method was extremely inefficient and faced with different ore characteristics of different types of ores, which required experienced workers to identify well. In addition, some types of ores can be sorted by their physical properties. Magnetic separators can attract certain ores through high-strength magnets to achieve sorting effects. In addition, there are also methods to sort raw ores according to the density of waste, such as the floating and sinking method to distinguish clean coal, intercalated coal and gangue. The gravity separation method uses gravity to separate useful minerals and waste rocks in the ore according to the difference in ore density in the ore. For example, sorting is carried out through equipment such as vibrating tables and cyclones.

[0003] In terms of mineral processing, deep learning-based mineral processing technology stands out among many other processing technologies due to its advantages of ultra-high efficiency, high accuracy, and environmental friendliness. The principle of deep learning-based mineral processing is to input images that distinguish the characteristics of mineral waste into a neural network. The network will learn the characteristics of mineral waste and obtain a model. The model can quickly determine whether the mineral image is mineral or waste, and cooperate with mineral processing equipment to continuously sort the ore.

[0004] In the existing deep learning-based ore sorting technology, the number of backbone network layers used is generally large, because in theory, the more network layers there are in deep learning, the deeper and higher the features that the network can learn, and the better the feature learning. However, when sorting weak and fine mineral spots, blindly pursuing network depth is no longer so important. As the number of network layers increases, the ore images are continuously downsampled and the weak and fine mineral spot features gradually disappear. The high-resolution features of the shallow layers of the network cannot be passed to the deep layers of the network, resulting in them not being able to learn these mineral spot features. This leads to the problem of poor sorting accuracy, so it is crucial to accurately identify the weak and fine mineral spot features and retain them in the deep network for identification. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a method, device, readable storage medium and equipment for sorting weak mineral spot ores, aiming to solve the problem of low accuracy in the prior art when sorting weak spot ores.

[0006] The embodiment of the present invention is implemented as follows:

[0007] A method for separating weak spot ore, the method comprising:

[0008] Constructing a neural network, the neural network at least comprising a dense convolution module and a hierarchical attention module respectively distributed front and back, the dense convolution module is used to prevent the mineral spot features from disappearing during the training process, and the hierarchical attention module is used to fuse the local features of the mineral spot with the global features;

[0009] Performing deep learning training on the neural network to obtain a pre-trained ore separation model;

[0010] The image of the ore to be sorted is obtained, and the image of the ore to be sorted is input into the pre-trained ore sorting model to obtain the final sorting result.

[0011] Furthermore, in the above-mentioned weak spot ore separation method, the step of performing deep learning training on the neural network to obtain the pre-trained ore separation model includes:

[0012] Collecting historical ore image data, and creating a training data set based on the historical ore image data, wherein the training data set includes a training set, a test set, and a validation set;

[0013] The training data set is subjected to data enhancement and contrast processing, and then input into the neural network for deep learning training;

[0014] The hyperparameters are fine-tuned through training, a plurality of ore sorting models to be selected are determined using the validation set, and the ore sorting model is determined from the plurality of ore sorting models to be selected through the test set.

[0015] Furthermore, in the above-mentioned weak spot ore separation method, the contrast processing formula is:

[0016] ;

[0017] in, represents the output pixel value, represents the input pixel value, and They represent the minimum and maximum pixel values ​​in the image respectively, ɑ is a constant, θ and β are gamma values, ranging from 0.1 to 3.0, and C is a constant.

[0018] Furthermore, in the above-mentioned weak spot ore sorting method, the data enhancement step includes:

[0019] Randomly rotating the training set by a preset angle according to a preset probability;

[0020] The training set is randomly cropped according to a preset probability and pasted on the center of a white background image of a preset size;

[0021] The training set is added with two different noises according to preset probabilities.

[0022] Furthermore, in the above-mentioned weak spot ore sorting method, the step of the dense convolution module for preventing the disappearance of the spot feature during the training process includes:

[0023] Convolution calculation is performed on each input position and all weights in the neural network to generate corresponding outputs.

[0024] Furthermore, in the above-mentioned weak spot ore sorting method, the step of the hierarchical attention module for fusing the local features of the spot with the global features comprises:

[0025] Extracting a plurality of local windows from the input feature map received by the hierarchical attention module, each of the local windows being represented by a set of markers;

[0026] Configuring a carrier tag containing summary information for each local window, and subjecting the carrier tag to multi-head self-attention operation, layer normalization and multi-layer perceptron operation in sequence;

[0027] splicing the mark of the local window and the carrier mark to realize the communication of spatial information;

[0028] Segmenting the spliced ​​local window mark and carrier mark, iterating repeatedly, and performing global information propagation;

[0029] The output result is obtained by upsampling the carrier mark and combining it with the mark of the local window.

[0030] Furthermore, in the above-mentioned weak spot ore sorting method, the neural network further includes a multi-scale attention module, the multi-scale attention module uses GELU as an activation function, and the method further includes:

[0031] After the multi-scale attention module receives the feature image, a maximum pooling operation is performed on the feature image in the X-axis and the Y-axis to obtain high-dimensional and wide-dimensional pooling results;

[0032] The pooling results are concatenated in the channel dimension, and after convolution, they are split into two parts, height and width, in the channel dimension, and the weights of the two parts are calculated respectively;

[0033] The weights of the height and width parts and the direct calculation result of the weight calculation of the feature image are grouped and normalized to obtain a first result, and the feature image is convolved to obtain a second result;

[0034] The weights obtained by calculating the first result through the maximum pooling layer and the softmax activation function are respectively subjected to matrix multiplication with the second result, and the weights obtained by calculating the second result through the maximum pooling layer and the softmax activation function layer are subjected to matrix multiplication with the first result;

[0035] The two matrix multiplication results are added together and then calculated using the GELU function to obtain a weight, which is then calculated based on the weight and the feature image to obtain the final output feature image.

[0036] Another object of the present invention is to provide a weak spot ore separation device, the device comprising:

[0037] A construction module, used to construct a neural network, the neural network at least comprising a dense convolution module and a hierarchical attention module respectively distributed front and back, the dense convolution module is used to prevent the mineral spot features from disappearing during the training process, and the hierarchical attention module is used to fuse the local features of the mineral spot with the global features;

[0038] A training module, used for performing deep learning training on the neural network to obtain a pre-trained ore sorting model;

[0039] The sorting module is used to obtain the image of the ore to be sorted, and input the image of the ore to be sorted into the pre-trained ore sorting model to obtain the final sorting result.

[0040] Another object of the present invention is to provide a readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the steps of any one of the methods described above.

[0041] Another object of the present invention is to provide an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.

[0042] The present invention realizes automatic ore sorting by training an ore sorting model. Since the ore sorting module masters the logic of ore sorting, automatic ore sorting can be realized. In addition, when constructing a neural network for training the ore sorting model, dense convolution and hierarchical attention modules are introduced. The dense convolution module makes the output obtained during training serve as the input of the next module, ensuring that high-resolution features can be passed into each module to solve the problem of feature disappearance. The hierarchical attention module focuses on fusing local and overall features to learn the weak and fine mineral spot features after dense convolution, thereby improving the accuracy of model training and ultimately realizing the accuracy of automatic ore sorting, solving the problem of low accuracy in ore sorting in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A schematic diagram of the structure of a weak ore spot ore separation system provided by an embodiment of the present invention;

[0044] Figure 2 It is a flow chart of the weak spot ore separation method in the first embodiment of the present invention;

[0045] Figure 3 It is a dense convolution structure in ResNet18-HAT in the weak spot ore separation method in the first embodiment of the present invention;

[0046] Figure 4 It is a schematic diagram of the structure of the residual block in the weak spot ore separation method in the first embodiment of the present invention;

[0047] Figure 5 It is a schematic diagram of dual-energy imaging in the weak spot ore separation method in the first embodiment of the present invention;

[0048] Figure 6 Schematic diagram of the structure of a multi-layer perceptron MLP in the weak spot ore separation method in the first embodiment of the present invention;

[0049] Figure 7 It is a schematic diagram of the structure of the hierarchical attention module in the weak spot ore separation method in the first embodiment of the present invention;

[0050] Figure 8 It is a schematic diagram of the structure of the multi-layer attention mechanism in the weak spot ore separation method in the first embodiment of the present invention;

[0051] Fig. 9 It is a schematic diagram of the structure of a multi-scale attention module in the weak spot ore separation method in the first embodiment of the present invention;

[0052] Fig.10 It is a structural block diagram of a weak ore spot ore separation device in the fourth embodiment of the present invention.

[0053] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION

[0054] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.

[0055] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0056] The following embodiments can be applied to Figure 1 In the backbone neural network of the weak mineral spot ore sorting model shown in the figure, the backbone neural network is improved from the residual network (ResNet18). The first half of the network consists of a dense convolution module consisting of a convolutional layer, a pooling layer, and four convolutional blocks. The second half consists of two hierarchical attention modules, a multi-scale attention mechanism module, a pooling layer, and a fully connected layer.

[0057] In the network structure, the initial network layer usually has a larger spatial dimension and fewer channels, while the spatial dimension of the feature image after entering the second half of the network is smaller and the number of channels is larger. According to the calculation formula of the convolution kernel, it can be found that the initial part of the network is more suitable for dense convolution calculations, while the calculation amount of the second half of the network is already very large. Due to memory limitations, it is no longer suitable for dense convolution operations. In contrast, it is more suitable for operations that have little impact on throughput, such as attention mechanisms and layer normalization.

[0058] The network backbone proposed in the embodiment of the present invention introduces dense convolution operations to ensure that high-resolution features can be transmitted to each residual block of the residual network, and replaces the simple residual block with two hierarchical attention mechanisms. Simply increasing the number of network convolution layers cannot better learn weak mineral spot features, because these weak features have been lost in the second half of the network, so it is replaced by an attention mechanism to focus on feature learning.

[0059] It should be pointed out that Figure 1 The structure shown does not constitute a limitation on the backbone neural network in the weak mineral spot ore separation model. In other embodiments, the backbone neural network may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0060] How to improve the accuracy of weak spot ore separation will be described in detail below with reference to specific embodiments and drawings.

[0061] Embodiment 1

[0062] See also Figure 2 , shown is a method for separating weak mineral spot ores in a first embodiment of the present invention, the method comprising steps S10 to S12.

[0063] Step S10, constructing a neural network, which at least includes a dense convolution module and a hierarchical attention module distributed front and back respectively, the dense convolution module is used to prevent the mineral spot features from disappearing during the training process, and the hierarchical attention module is used to fuse the local features of the mineral spots with the global features.

[0064] Among them, the main problems solved by the present invention are: first, the problem that the features of weak and fine mineral spots disappear during network propagation. Therefore, dense convolution operations are introduced into the first four residual blocks, so that the output of each residual block will be used as the input of the next residual block, ensuring that these high-resolution features can be passed into each residual block to solve the problem of feature disappearance; second, a hierarchical module is added to replace several residual blocks of the original network. The hierarchical module integrates Transformer and hierarchical attention mechanism. Compared with the original network superimposed convolution layer, the hierarchical module focuses on integrating local and overall features to learn the features of weak and fine mineral spots after dense convolution.

[0065] In addition, the computational load of the front and back parts of the current neural network structure is unevenly distributed, and it is easy to exceed the memory during operation. One of the reasons for this is that as the network deepens, the number of channels of the feature image increases rapidly, and the computational load increases rapidly, resulting in the problem that the computing power of the front part of the network is sufficient but the computing power of the back part is insufficient. The network structure adopted in the present invention places dense convolution calculations in the front part of the network to fully utilize the computing power, and the back part of the network performs operations with low memory access throughput such as attention.

[0066] Dense convolution refers to an operation in which each input position in a convolutional neural network is convolved with all weights. Unlike ordinary convolution operations, dense convolution has no jump connections, and each input position participates in the calculation. In dense convolution, for each input position, its convolution with all weights is calculated to generate the corresponding output. This means that each input position in the network will produce a corresponding output value.

[0067] The embodiment of the present invention integrates dense convolution into the residual block of the residual network ResNet18, takes the residual block as the object of dense convolution, retains the addition operation of the residual network and adds channel merging between residual blocks. Because the feature image at the beginning of the network contains high-resolution features, and the weak mineral spot features will be gradually lost with the layers of convolution, using dense convolution in the initial stage of the network helps the network learn high-resolution features. In addition, dense convolution also has a similar effect to multi-scale fusion, that is, it uses the shallow high-resolution features as the input of the deep convolution kernel, which is helpful for the feature learning of weak mineral spots.

[0068] Specifically, Figure 3As shown in Figure 1, the dense convolution module includes multiple convolution modules. Convolution module 1 and convolution module 2 are actually not much different from the original residual block of ResNet18. Figure 4 As shown in the figure, the main change is to replace the activation function ReLU with GELU, which is more suitable for the residual structure. The negative value area of ​​the ReLU activation function is 0 and the reciprocal is 0, resulting in a gradient of 0. As a result, when the input is negative during the back-propagation process, the gradient corresponding to the negative value area will be truncated to zero and cannot be passed to the previous layer, causing the gradient to disappear and the network to be unable to learn effectively. The residual connection allows the network to directly transmit the gradient, thereby alleviating the gradient disappearance and making the training more stable and efficient.

[0069] The convolution module contains two residual structures, namely the solid residual structure and the dotted residual structure in the figure. After the feature image enters the backbone network at the same time, it is added to the residual branch to obtain the fused feature. The residual branch of the solid line part does not operate on the input feature image and is directly added to the backbone network; the residual branch of the dotted line part undergoes a 1x1 convolution with a step size of 2. The reason is that the backbone network feature image has passed through a 3x3 convolution kernel with a step size of 2. At this time, the spatial dimension of the feature image in the backbone network is reduced to one-fourth of the original, and the number of channels becomes twice the original. In order to ensure the smooth addition operation, the output spatial dimension and number of channels of the residual branch must also be consistent with the backbone.

[0070] The embodiment of the present invention integrates dense convolution into the residual block of the residual network ResNet18, takes the residual block as the object of dense convolution, retains the addition operation of the residual network and adds channel merging between residual blocks. Because the feature image at the beginning of the network contains high-resolution features, and the weak mineral spot features will be gradually lost with the layers of convolution, using dense convolution in the initial stage of the network helps the network learn high-resolution features. In addition, dense convolution also has a similar effect to multi-scale fusion, that is, it uses the shallow high-resolution features as the input of the deep convolution kernel, which is helpful for the feature learning of weak mineral spots.

[0071] Step S11, performing deep learning training on the neural network to obtain a pre-trained ore separation model.

[0072] Among them, deep learning training of neural networks can obtain an accurate ore sorting model.

[0073] Specifically, the step of performing deep learning training on the neural network to obtain the pre-trained ore separation model includes:

[0074] Collecting historical ore image data, and creating a training data set based on the historical ore image data, wherein the training data set includes a training set, a test set, and a validation set;

[0075] The training data set is subjected to data enhancement and contrast processing, and then input into the neural network for deep learning training;

[0076] The hyperparameters are fine-tuned through training, a plurality of ore sorting models to be selected are determined using the validation set, and the ore sorting model is determined from the plurality of ore sorting models to be selected through the test set.

[0077] Among them, historical ore image data is collected, for example, pictures and images of ore to be sorted. In the embodiment of the present invention, the image type of the ore image can be a dual-energy image. In ore sorting, the ore mined without distinguishing between ore waste is called raw ore. After the raw ore enters the conveyor belt of the sorting equipment, Figure 5 As shown, XRT technology is used to image the raw ore. The radiation source in the equipment emits radiation to irradiate the ore on the conveyor belt. A radiation sensor is installed under the belt. The radiation penetrates the raw ore and forms an image on the radiation sensor.

[0078] The image obtained by a specific single radiation sensor is a single-channel image, called a single-energy image; when two sensors separated by a certain distance receive radiation imaging, they will each produce a single-channel single-energy image. The image obtained by the upper sensor is a low-energy image, and the image obtained by the lower sensor is a high-energy image. The so-called dual-energy image is a three-channel image, and the three channels are low-energy image, high-energy image, and third channel value image (the third channel value image is calculated from the high-energy image and the low-energy image).

[0079] Among them, a training data set is prepared, and the training data set is divided into a training set, a test set, and a validation set. In specific implementation, the division can be based on a preset ratio, for example, there are 2,200 images of ore and 2,200 images of waste rock in the training set; 500 images of ore and 500 images of waste rock in the test set, and 500 images of ore and 500 images of waste rock in the validation set. The training set is input into the training framework and then into the neural network for training. The relevant hyperparameters are fine-tuned N times, such as the initial value of the learning rate, the method of changing the learning rate, and the feature fusion structure. The validation set is used to find the optimal N models, and finally the test set is used for testing to obtain a model with the best sorting effect.

[0080] In addition, in order to further improve the accuracy of the trained model, each sample image will be preprocessed and enhanced before model training. Specifically, the contrast processing formula is:

[0081] ;

[0082] in, represents the output pixel value, represents the input pixel value, and They represent the minimum and maximum pixel values ​​in the image respectively, ɑ is a constant, θ and β are gamma values, the value range of ɑ is 0.1~3.0, and C is a constant.

[0083] Among them, C can adjust the overall brightness of the image, and the default value is 0. This contrast processing can increase the difference in pixel values ​​in the image and highlight the characteristics of the mineral spots.

[0084] The steps of data augmentation include:

[0085] Randomly rotating the training set by a preset angle according to a preset probability;

[0086] The training set is randomly cropped according to a preset probability and pasted on the center of a white background image of a preset size;

[0087] The training set is added with two different noises according to preset probabilities.

[0088] For example, there is a 60% probability that the training set images are randomly rotated by a certain angle, a 50% probability that the training set images are randomly cropped and pasted on the center of the 122×122 white background image, and there is a 30% probability that two different noises are added to the training set images.

[0089] Step S12, obtaining an image of the ore to be sorted, and inputting the image of the ore to be sorted into the pre-trained ore sorting model to obtain a final sorting result.

[0090] Among them, the trained ore sorting model has mastered the logic of ore sorting. Therefore, the ore can be automatically sorted through the ore sorting model, and because the precision of the ore sorting model is improved, the accuracy of ore sorting is improved.

[0091] In summary, the weak mineral spot ore sorting method in the above embodiment of the present invention realizes automatic ore sorting by training the ore sorting model. Since the ore sorting module masters the logic of ore sorting, it can realize automatic ore sorting. In addition, when constructing the neural network for training the ore sorting model, dense convolution and hierarchical attention modules are introduced. The dense convolution module makes the output obtained during training serve as the input of the next module, ensuring that high-resolution features can be passed into each module to solve the problem of feature disappearance. The hierarchical attention module focuses on fusing local and overall features to learn the weak and fine mineral spot features after dense convolution, thereby improving the accuracy of model training, and finally realizing the accuracy of automatic ore sorting, solving the problem of low accuracy in ore sorting in the prior art.

[0092] Embodiment 2

[0093] The difference between the weak spot ore separation method in this embodiment and the weak spot ore separation method in the first embodiment is that:

[0094] The step of the hierarchical attention module for fusing the local features of the mineral spots with the global features comprises:

[0095] Extracting a plurality of local windows from the input feature map received by the hierarchical attention module, each of the local windows being represented by a set of markers;

[0096] Configuring a carrier tag containing summary information for each local window, and subjecting the carrier tag to multi-head self-attention operation, layer normalization and multi-layer perceptron operation in sequence;

[0097] splicing the mark of the local window and the carrier mark to realize the communication of spatial information;

[0098] Segmenting the spliced ​​local window mark and carrier mark, iterating repeatedly, and performing global information propagation;

[0099] The output result is obtained by upsampling the carrier mark and combining it with the mark of the local window.

[0100] Among them, the hierarchical attention module is a Vision Transformer structure that integrates the hierarchical attention mechanism. It is a window attention mechanism that can promote the exchange of local and global information at a lower computational cost. The hierarchical attention module contains carrier markers CTs and integrates the hierarchical self-attention mechanism. The hierarchical attention mechanism integrates global feature information with local feature information, which is conducive to the network's learning of large-area foggy weak mineral spot features.

[0101] Specifically, the hierarchical attention module operates on the local features of the feature image and the global features of the local window respectively. First, the input feature map is extracted into several local windows using a method similar to the window moving Swin method, and each local window is represented by a set of tags. For the global feature extraction of local windows, the key idea is to introduce carrier tags CTs to summarize the overall information within each local window. The carrier tags CTs are obtained through pooling and convolution operations, and they provide summary information of their respective local windows. Each local window has a unique carrier tag to be fused with the corresponding local features later. In the branch of the hierarchical attention module that extracts the overall features of the window, the carrier tags undergo a multi-head self-attention operation, followed by layer normalization and multi-layer perceptron MLP operations. This attention process allows the carrier tags to exchange information and summarize global features. Next, the local window tags and carrier tags are concatenated, and another set of attention operations are applied to model the interaction between them, thereby achieving the exchange of spatial information. Subsequently, the tags are split into their respective local windows and carrier tags again, and then the hierarchical attention module is iterated repeatedly. In order to promote long-range interactions, global information propagation is performed at the last stage. The output result is calculated by upsampling the carrier tags and merging them with the local window tags.

[0102] Further, such as Figure 6 As shown in the figure, the multilayer perceptron MLP consists of an input layer, a hidden layer, and an output layer. The input layer receives input data, the hidden layer represents the features through learning, and the output layer produces the final prediction result. Each neuron in the hidden layer and the output layer has an activation function, which is used to introduce nonlinear mapping. The multilayer perceptron MLP is capable of complex feature learning and can capture nonlinear relationships between inputs. Combining MLP with the attention mechanism can give full play to the advantages of both, so that the model can have the ability to pay attention to global features and local features at the same time, thereby improving the expressive power of the model. Combining it with the attention mechanism can better capture and learn the features that the attention focuses on, while improving the performance and generalization ability of the model in complex tasks.

[0103] To incorporate position information, the hierarchical attention module uses a two-layer multi-layer perceptron to add absolute position biases to the carrier mark and the local window mark. In addition, the logarithmic space relative position bias proposed in SwinV2 is also adopted to enhance the attention with the locality of the image sample. The hierarchical attention module realizes the information exchange between the local window and the global features, effectively promoting the spatial reasoning ability in the entire feature map hierarchy.

[0104] The formula for generating vector-marked CTs is:

[0105] ;

[0106] ;

[0107] in, Represents the input data, which is first processed through a 3x3 convolutional layer to generate , and then use average pooling (AvgPool) to reduce the spatial resolution of the features to generate carrier markers , L represents the feature depth.

[0108] Self-attention formula for carrier labeling:

[0109] ;

[0110] ;

[0111] Among them, the vector marker . It is processed by multi-head self-attention (MHSA) and passes through a multi-layer perceptron (MLP) module, which has a process of dimensional expansion and reduction (from d dimensions to 4d dimensions and then back to d dimensions) to increase nonlinearity and improve the expressiveness of the model. LN stands for layer normalization, and is the learned scaling factor.

[0112] Local window self-attention mechanism formula:

[0113] ;

[0114] ;

[0115] ;

[0116] Among them, the local window feature , which is a local feature and carrier markers This feature goes through the same processing steps as the vector tag: multi-head self-attention and multi-layer perceptron modules.

[0117] In order to improve the long-distance modeling capability, the carrier marker information is injected into the local window:

[0118] ;

[0119] ;

[0120] in, Divided into and , then these segmented features are resized (upsampled) and fused together to form the final feature representation X.

[0121] Among them, H, W, d are the height, width, and number of channels of the input features, and n is the size of the split local window (n×n).

[0122] In order to incorporate the position information, the hierarchical module uses a two-layer MLP to add absolute position biases to CTs and local window markers. In addition, the logarithmic space relative position bias proposed in SwinV2 is also adopted to enhance the attention with image sample locality. Figure 7 It is a hierarchical attention module structure.

[0123] The attention structure in the hierarchical attention iteration module is a multi-head attention mechanism, the structure is as follows Figure 8 The MHSA multi-head attention mechanism allows the model to simultaneously learn multiple sets of feature maps that can represent different aspects of the input sequence in different subspaces. By computing multiple heads in parallel, the training process of the model can be greatly accelerated.

[0124] For a given input sequence, firstly, a linear transformation is performed to obtain h different sequence groups, each of which contains three sequences: query sequence Q, key sequence K, and value sequence V. Using query sequence Q and key sequence K, the attention score matrix is ​​calculated by dot product. This matrix represents the attention weight of each position to other positions. In order to stabilize the calculation, when calculating the attention score, the result is divided by a scaling factor, which is usually the square root of the dimension of the query sequence. This scaling can help prevent the attention score from becoming too large. Then, the scaled attention score is softmaxed to obtain the normalized attention weight of each position to other positions. The obtained attention weight is used to perform matrix multiplication on the value sequence V to obtain the attention output. The h in the figure is the number of attention heads. In this network, the value of h is 4. The four attention heads are merged and passed through the linear transformation layer to obtain the final output value. Since the input sequence is divided into h groups at the beginning, the sequence dimension of each group is actually only one-fourth of the original sequence, so the output has feature information extracted from multiple dimensions without increasing the actual amount of calculation.

[0125] In summary, the weak mineral spot ore sorting method in the above embodiment of the present invention realizes automatic ore sorting by training the ore sorting model. Since the ore sorting module masters the logic of ore sorting, it can realize automatic ore sorting. In addition, when constructing the neural network for training the ore sorting model, dense convolution and hierarchical attention modules are introduced. The dense convolution module makes the output obtained during training serve as the input of the next module, ensuring that high-resolution features can be passed into each module to solve the problem of feature disappearance. The hierarchical attention module focuses on fusing local and overall features to learn the weak and fine mineral spot features after dense convolution, thereby improving the accuracy of model training, and finally realizing the accuracy of automatic ore sorting, solving the problem of low accuracy in ore sorting in the prior art.

[0126] Embodiment 3

[0127] The difference between the weak spot ore separation method in this embodiment and the weak spot ore separation method in the first embodiment is that:

[0128] The neural network also includes a multi-scale attention module EMA-MG, the multi-scale attention module uses GELU as an activation function, and the method also includes:

[0129] After the multi-scale attention module receives the feature image, a maximum pooling operation is performed on the feature image in the X-axis and the Y-axis to obtain high-dimensional and wide-dimensional pooling results;

[0130] The pooling results are concatenated in the channel dimension, and after convolution, they are split into two parts, height and width, in the channel dimension, and then the weights of the two parts are calculated respectively;

[0131] The weights of the height and width parts and the direct calculation result of the weight calculation of the feature image are grouped and normalized to obtain a first result, and the feature image is convolved to obtain a second result;

[0132] The weights obtained by calculating the first result through the maximum pooling layer and the softmax activation function are respectively subjected to matrix multiplication with the second result, and the weights obtained by calculating the second result through the maximum pooling layer and the softmax activation function layer are subjected to matrix multiplication with the first result;

[0133] The two matrix multiplication results are added together and then calculated using the GELU function to obtain a weight, which is then calculated based on the weight and the feature image to obtain the final output feature image.

[0134] Among them, EMA-MG is an improvement on EMA attention. The average pooling layer used in weak and fine mineral spots is not suitable for local features, which makes the weak mineral spot features blurred and affects the model's perception of these detail features. This algorithm replaces the average pooling layer with the maximum pooling layer to retain the features of weak and small mineral spots. In addition, although EMA helps to improve network convergence, there is still room for optimization in the stability of training accuracy. This algorithm replaces the Softmax activation function in EMA attention with GELU. Compared with the original activation function, the mean of the GELU function is close to zero. Compared with the traditional Sigmoid function, it is easier to achieve zero centering in the network. It helps to reduce the offset problem in network training. In addition, due to its smoothness and close to zero center characteristics, GELU performs well when using residual connections, which fits the residual structure in EMA attention.

[0135] Specifically, Fig. 9As shown in the figure, the feature image is input into the EMA-MG module and then grouped to obtain four branches. The second and third branches perform maximum pooling operations on the feature image on the X-axis and Y-axis respectively to obtain high-dimensional and wide-dimensional pooling results. The height and width pooling results are spliced ​​in the channel dimension and subjected to 1x1 convolution. The result is split into two parts in the channel dimension, which are used to calculate x_h and x_w respectively and the weights of the two are obtained through the GELU activation function. The result is calculated according to the weight of the feature image of the first branch and input into the group normalization layer. Group normalization improves the generalization ability and stability of the model and obtains the output x1. After the weight is calculated by the maximum pooling layer and the softmax activation function, x1 is matrix multiplied with the output x2 of the fourth branch. x2 is obtained by the 3x3 convolution of the feature image of the fourth branch. x2 is weighted after the maximum pooling layer and the softmax activation function layer, and matrix multiplication is performed with x1 to form a cross-matrix multiplication operation. The two matrix multiplication results are added together and then calculated by the GELU function to obtain the weight, which is then calculated based on the weight and the feature image of the first branch to obtain the final output feature image. The length, width and number of channels of the output feature image are consistent with the input feature image.

[0136] In summary, the weak mineral spot ore sorting method in the above embodiment of the present invention realizes automatic ore sorting by training the ore sorting model. Since the ore sorting module masters the logic of ore sorting, it can realize automatic ore sorting. In addition, when constructing the neural network for training the ore sorting model, dense convolution and hierarchical attention modules are introduced. The dense convolution module makes the output obtained during training serve as the input of the next module, ensuring that high-resolution features can be passed into each module to solve the problem of feature disappearance. The hierarchical attention module focuses on fusing local and overall features to learn the weak and fine mineral spot features after dense convolution, thereby improving the accuracy of model training, and finally realizing the accuracy of automatic ore sorting, solving the problem of low accuracy in ore sorting in the prior art.

[0137] Embodiment 4

[0138] See also Fig.10 , shown is a weak spot ore separation device proposed in the fourth embodiment of the present invention, the device comprises:

[0139] A construction module 100 is used to construct a neural network, wherein the neural network at least includes a dense convolution module and a hierarchical attention module which are respectively distributed front and back, wherein the dense convolution module is used to prevent the mineral spot feature from disappearing during the training process, and the hierarchical attention module is used to fuse the local feature of the mineral spot with the global feature;

[0140] A training module 200 is used to perform deep learning training on the neural network to obtain a pre-trained ore separation model;

[0141] The sorting module 300 is used to obtain the image of the ore to be sorted, and input the image of the ore to be sorted into the pre-trained ore sorting model to obtain the final sorting result.

[0142] Furthermore, in some optional embodiments of the present invention, the training module includes:

[0143] An acquisition unit, used for acquiring historical ore image data, and preparing a training data set according to the historical ore image data, wherein the training data set includes a training set, a test set, and a validation set;

[0144] A training unit, used for performing data enhancement and contrast processing on the training data set, and then inputting the data set into the neural network for deep learning training;

[0145] A fine-tuning unit is used to fine-tune the hyperparameters through training, determine multiple ore sorting models to be selected using the verification set, and determine the ore sorting model from the multiple ore sorting models to be selected through the test set.

[0146] Furthermore, in some optional embodiments of the present invention, the contrast processing formula is:

[0147] ;

[0148] in, represents the output pixel value, represents the input pixel value, and They represent the minimum and maximum pixel values ​​in the image respectively, ɑ is a constant, θ and β are gamma values, and C is a constant.

[0149] Furthermore, in some optional embodiments of the present invention, the step of data enhancement includes:

[0150] Randomly rotating the training set by a preset angle according to a preset probability;

[0151] The training set is randomly cropped according to a preset probability and pasted on the center of a white background image of a preset size;

[0152] The training set is added with two different noises according to preset probabilities.

[0153] Furthermore, in some optional embodiments of the present invention, the building blocks include:

[0154] The convolution unit is used to perform convolution calculation on each input position and all weights in the neural network to generate corresponding outputs.

[0155] Furthermore, in some optional embodiments of the present invention, the building module further includes:

[0156] A fusion unit, configured to extract a plurality of local windows from the input feature map received by the hierarchical attention module, each of the local windows being represented by a set of markers;

[0157] Configuring a carrier tag containing summary information for each local window, and subjecting the carrier tag to multi-head self-attention operation, layer normalization and multi-layer perceptron operation in sequence;

[0158] splicing the mark of the local window and the carrier mark to realize the communication of spatial information;

[0159] Segmenting the spliced ​​local window mark and carrier mark, iterating repeatedly, and performing global information propagation;

[0160] The output result is obtained by upsampling the carrier mark and combining it with the mark of the local window.

[0161] Further, in some optional embodiments of the present invention, the neural network further includes a multi-scale attention module, the multi-scale attention module uses GELU as an activation function, and the device further includes:

[0162] A pooling module, configured to perform maximum pooling operations on the feature image in the X-axis and Y-axis respectively to obtain high-dimensional and wide-dimensional pooling results after the multi-scale attention module receives the feature image;

[0163] The pooling results are concatenated in the channel dimension, and after convolution, they are split into two parts, height and width, in the channel dimension, and then the weights of the two parts are calculated respectively;

[0164] The weights of the height and width parts and the direct calculation result of the weight calculation of the feature image are grouped and normalized to obtain a first result, and the feature image is convolved to obtain a second result;

[0165] The weights obtained by calculating the first result through the maximum pooling layer and the softmax activation function are respectively subjected to matrix multiplication with the second result, and the weights obtained by calculating the second result through the maximum pooling layer and the softmax activation function layer are subjected to matrix multiplication with the first result;

[0166] The two matrix multiplication results are added together and then calculated using the GELU function to obtain a weight, which is then calculated based on the weight and the feature image to obtain the final output feature image.

[0167] The functions or operation steps implemented when the above modules are executed are substantially the same as those in the above method embodiments, and will not be repeated here.

[0168] Embodiment 5

[0169] Another aspect of the present invention further provides a readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the steps of the method described in any one of the above-mentioned embodiments 1 to 3 are implemented.

[0170] Embodiment 6

[0171] Another aspect of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the method described in any one of the above-mentioned embodiments 1 to 3 are implemented.

[0172] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0173] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable storage medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, a "computer-readable storage medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0174] More specific examples (a non-exhaustive list) of computer-readable storage media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable storage medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0175] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0176] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0177] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A method for separating weak ore spots, characterized in that: The method comprises: Constructing a neural network, the neural network at least comprising a dense convolution module and a hierarchical attention module respectively distributed front and back, the dense convolution module is used to prevent the mineral spot features from disappearing during the training process, and the hierarchical attention module is used to fuse the local features of the mineral spot with the global features; Performing deep learning training on the neural network to obtain a pre-trained ore separation model; Acquire an image of the ore to be sorted, and input the image of the ore to be sorted into the pre-trained ore sorting model to obtain a final sorting result; The steps of the dense convolution module for preventing the mineral spot features from disappearing during the training process include: Performing convolution calculations on each input position and all weights in the neural network to generate corresponding outputs; The step of the hierarchical attention module for fusing the local features of the mineral spots with the global features comprises: Extracting a plurality of local windows from the input feature map received by the hierarchical attention module, each of the local windows being represented by a set of markers; Configuring a carrier tag containing summary information for each local window, and subjecting the carrier tag to multi-head self-attention operation, layer normalization and multi-layer perceptron operation in sequence; splicing the mark of the local window and the carrier mark to realize the communication of spatial information; Segmenting the spliced ​​local window mark and carrier mark, iterating repeatedly, and performing global information propagation; The output result is obtained by upsampling the carrier mark and combining it with the mark of the local window; The step of performing deep learning training on the neural network to obtain the pre-trained ore separation model includes: Collecting historical ore image data, and creating a training data set based on the historical ore image data, wherein the training data set includes a training set, a test set, and a validation set; The training data set is subjected to data enhancement and contrast processing, and then input into the neural network for deep learning training; Fine-tune the hyperparameters through training, determine a plurality of ore sorting models to be selected using the validation set, and determine the ore sorting model from the plurality of ore sorting models to be selected through the test set; The formula for the contrast processing is: ; in, represents the output pixel value, represents the input pixel value, and Respectively represent the minimum pixel value and the maximum pixel value in the image, ɑ is a constant, θ and β are gamma values, and C is a constant; The data enhancement steps include: Randomly rotating the training set by a preset angle according to a preset probability; The training set is randomly cropped according to a preset probability and pasted on the center of a white background image of a preset size; The training set is added with two different noises according to preset probabilities.

2. The method for separating weak ore spots according to claim 1, characterized in that: The neural network also includes a multi-scale attention module, the multi-scale attention module uses GELU as an activation function, and the method also includes: After the multi-scale attention module receives the feature image, a maximum pooling operation is performed on the feature image in the X-axis and the Y-axis to obtain high-dimensional and wide-dimensional pooling results; The pooling results are concatenated in the channel dimension, and after convolution, they are split into two parts, height and width, in the channel dimension, and then the weights of the two parts are calculated respectively; The weights of the height and width parts and the direct calculation result of the weight calculation of the feature image are grouped and normalized to obtain a first result, and the feature image is convolved to obtain a second result; The weights obtained by calculating the first result through the maximum pooling layer and the softmax activation function are respectively subjected to matrix multiplication with the second result, and the weights obtained by calculating the second result through the maximum pooling layer and the softmax activation function layer are subjected to matrix multiplication with the first result; The two matrix multiplication results are added together and then calculated using the GELU function to obtain a weight, which is then calculated based on the weight and the feature image to obtain the final output feature image.

3. A weak ore spot ore separation device, characterized in that: The device is used to implement the weak spot ore separation method according to any one of claims 1 to 2, comprising: A construction module, used to construct a neural network, the neural network at least comprising a dense convolution module and a hierarchical attention module respectively distributed front and back, the dense convolution module is used to prevent the mineral spot features from disappearing during the training process, and the hierarchical attention module is used to fuse the local features of the mineral spot with the global features; A training module, used for performing deep learning training on the neural network to obtain a pre-trained ore sorting model; The sorting module is used to obtain the image of the ore to be sorted, and input the image of the ore to be sorted into the pre-trained ore sorting model to obtain the final sorting result.

4. A readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 2 are implemented.

5. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 2 when executing the program.

Citation Information

Patent Citations

  • An ore sorting method based on a convolutional neural network

    CN109740656A

  • Image recognition method, system and device in combination with breadth and dense convolutional neural networks, and medium

    CN113177559A

  • Sample classification and identification method based on convolutional neural network

    CN114118309A

  • Single remote sensing image height information estimation method based on deep learning algorithm

    CN114972989A

  • Conveyor belt real-time empty judgment detection method and system based on improved ResNet network

    CN115205363A