CN117975167A - Weak ore spot ore sorting method, device, readable storage medium and equipment - Google Patents

Weak ore spot ore sorting method, device, readable storage medium and equipment Download PDF

Info

Publication number
CN117975167A
CN117975167A CN202410354307.5A CN202410354307A CN117975167A CN 117975167 A CN117975167 A CN 117975167A CN 202410354307 A CN202410354307 A CN 202410354307A CN 117975167 A CN117975167 A CN 117975167A
Authority
CN
China
Prior art keywords
ore
training
sorting
module
neural network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410354307.5A
Other languages
Chinese (zh)
Inventor
王杉
陈浩祖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
East China Jiaotong University
Original Assignee
East China Jiaotong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by East China Jiaotong University filed Critical East China Jiaotong University
Priority to CN202410354307.5A priority Critical patent/CN117975167A/en
Publication of CN117975167A publication Critical patent/CN117975167A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Analysis (AREA)

Abstract

The invention discloses a weak ore spot ore sorting method, a device, a readable storage medium and equipment, wherein the method comprises the following steps: the method comprises the steps of constructing a neural network, wherein the neural network at least comprises a dense convolution module and a layered attention module which are distributed back and forth respectively, the dense convolution module is used for avoiding the disappearance of ore spot characteristics in the training process, and the layered attention module is used for fusing local characteristics and global characteristics of the ore spots; deep learning training is carried out on the neural network so as to obtain a pre-trained ore sorting model; and acquiring an ore image to be sorted, and inputting the ore image to be sorted into the pre-trained ore sorting model to obtain a final sorting result. The invention solves the problem of low accuracy in ore sorting in the prior art.

Description

Weak ore spot ore sorting method, device, readable storage medium and equipment
Technical Field
The invention relates to the technical field of ore sorting, in particular to a weak ore-spotted ore sorting method, a weak ore-spotted ore sorting device, a readable storage medium and equipment.
Background
The earliest ore sorting is highly dependent on manual field selection, and the ore waste is judged by adding experience to the naked eyes of workers, so that the sorting method is extremely low in efficiency and can be well identified by experienced workers in the face of different ore characteristics of different ore types, besides, some ore types can be sorted through the physical properties of the ore types, and the magnetic separator can attract some ore to achieve the sorting effect through a high-strength magnet, and in addition, raw ore is sorted according to different densities of the ore waste, such as clean coal, gangue-clamping coal and gangue, by a sink-float method. Gravity separation is used to separate useful minerals from waste rock in ore according to differences in ore density. Sorting is performed, for example, by means of a vibrating table, cyclone, or the like.
In the aspect of ore dressing, the ore sorting technology based on deep learning has the advantages of ultrahigh efficiency, high accuracy, environmental friendliness and the like, and stands out from a plurality of sorting technologies. The ore sorting principle based on deep learning is that images for distinguishing ore-separating waste features are input into a neural network, the network learns the ore-separating waste features and obtains a model, and the model can rapidly judge whether an ore image is ore or waste and cooperate with ore dressing equipment to continuously sort the ore.
In the existing ore sorting technology based on deep learning, the number of layers of a main network is generally large, because in theory, the larger the number of layers of the network in the deep learning, the higher the dimension of the feature which can be learned by the network is, and the better the feature learning is. However, when weak fine ore-spotted ore seeds are sorted, the pursuit of network depth is not important, as the number of layers of the network is deepened, the ore image continuously downsampled weak fine ore-spotted features gradually disappear, and the high-resolution features of the shallow layers of the network cannot be transferred to the deep layers of the network, so that the ore-spotted features cannot be learned. And the problem of poor separation precision occurs, so how to accurately identify the weak fine ore spots and keep the weak fine ore spots in a deep network for identification is important.
Disclosure of Invention
In view of the above, the present invention aims to provide a weak ore spot ore sorting method, a device, a readable storage medium and a device, which aim to solve the problem of low accuracy in weak poor ore sorting in the prior art.
The embodiment of the invention is realized as follows:
a method of weak ore macula ore sorting, the method comprising:
The method comprises the steps of constructing a neural network, wherein the neural network at least comprises a dense convolution module and a layered attention module which are distributed back and forth respectively, the dense convolution module is used for avoiding the disappearance of ore spot characteristics in the training process, and the layered attention module is used for fusing local characteristics and global characteristics of the ore spots;
deep learning training is carried out on the neural network so as to obtain a pre-trained ore sorting model;
and acquiring an ore image to be sorted, and inputting the ore image to be sorted into the pre-trained ore sorting model to obtain a final sorting result.
Further, in the weak ore plaque ore sorting method, the step of performing deep learning training on the neural network to obtain the pre-trained ore sorting model includes:
collecting historical ore image data, and manufacturing a training data set according to the historical ore image data, wherein the training data set comprises a training set, a testing set and a verification set;
the training data set is subjected to data enhancement and contrast processing and then is input into the neural network for deep learning training;
And (3) fine tuning the super parameters through training, determining a plurality of ore sorting models to be sorted by utilizing the verification set and determining the ore sorting model from the plurality of ore sorting models to be sorted by utilizing the test set.
Further, in the weak ore plaque sorting method, the formula of the contrast treatment is as follows:
Wherein, Representing the output pixel value,/>Representing input pixel values,/>And/>The method respectively represents a minimum pixel value and a maximum pixel value in the image, alpha is a constant, theta and beta are gamma values, the value range is 0.1-3.0, and C is a constant.
Further, the weak ore plaque sorting method, wherein the step of data enhancement comprises:
randomly rotating the training set by a preset angle according to a preset probability;
Randomly cutting the training set according to a preset probability and then attaching the training set to the white background image center with a preset size;
And adding two different noises into the training set according to the preset probability.
Further, in the weak ore plaque sorting method, the step of using the dense convolution module to avoid the disappearance of ore plaque features in the training process includes:
and carrying out convolution calculation on each input position and all weights in the neural network to generate corresponding output.
Further, in the weak ore plaque ore sorting method, the step of merging the local features and the global features of the ore plaque by the hierarchical attention module comprises the following steps:
Extracting a plurality of local windows from the input feature map received by the hierarchical attention module, wherein each local window is represented by a group of marks;
configuring carrier marks containing abstract information of each local window, and sequentially carrying out multi-head self-attention operation, layer normalization and multi-layer perceptron operation on the carrier marks;
Splicing the marks of the local window and the carrier marks to realize the communication of space information;
Dividing the spliced marks of the local window and the carrier mark, repeatedly iterating, and carrying out global information propagation;
And carrying out up-sampling on the carrier marks, and merging and calculating with the marks of the local window to obtain an output result.
Further, the weak ore plaque ore sorting method, wherein the neural network further comprises a multi-scale attention module, the multi-scale attention module adopts GELU as an activation function, and the method further comprises:
after the multi-scale attention module receives the characteristic images, carrying out maximum pooling operation on the characteristic images on an X axis and a Y axis respectively to obtain pooling results with high dimension and wide dimension;
splicing the pooling results in a channel dimension, splitting the pooling results into two parts of height and width in the channel dimension after convolution, and respectively calculating weights of the two parts of height and width;
Grouping and normalizing the weights of the two parts of the height and the width and the direct calculation result of the weight calculation of the characteristic image to obtain a first result, and carrying out convolution operation on the characteristic image to obtain a second result;
Respectively calculating the first result through a maximum pooling layer and a softmax activation function to obtain a weight, and then performing matrix multiplication on the first result and the second result, wherein the second result is calculated through the maximum pooling layer and the softmax activation function to obtain the weight, and performing matrix multiplication on the weight and the first result;
And adding the two matrix multiplication results, performing GELU function calculation to obtain a weight, and performing calculation according to the weight and the characteristic image to obtain a final output characteristic image.
Another object of the present invention is to provide a weak ore-spotting ore-sorting apparatus, the apparatus comprising:
the building module is used for building a neural network, the neural network at least comprises a dense convolution module and a layered attention module, the dense convolution module and the layered attention module are respectively distributed front and back, the dense convolution module is used for avoiding the disappearance of ore spot characteristics in the training process, and the layered attention module is used for fusing local characteristics and global characteristics of the ore spots;
The training module is used for performing deep learning training on the neural network to obtain a pre-trained ore sorting model;
And the sorting module is used for acquiring the ore images to be sorted, and inputting the ore images to be sorted into the pre-trained ore sorting model to obtain a final sorting result.
It is a further object of the present invention to provide a readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of any of the above.
It is a further object of the invention to provide an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, which processor implements the steps of the method described above when executing the program.
According to the invention, automatic separation of ores is realized by training an ore separation model, because an ore separation module grasps the logic of ore separation, automatic separation of ores can be realized, and when a neural network for training the ore separation model is constructed, a dense convolution module and a layered attention module are introduced, so that the output obtained during training can be used as the input of the next module, the high-resolution characteristics can be transmitted into each module, the problem of characteristic disappearance is solved, the layered attention module focuses on weak fine ore spot characteristics after dense convolution of local and integral characteristic learning, the accuracy of model training is improved, the accuracy of automatic separation of ores is finally realized, and the problem of low accuracy during ore separation in the prior art is solved.
Drawings
FIG. 1 is a schematic diagram of a weak ore plaque ore separation system according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of sorting weak ore plaque ore in a first embodiment of the invention;
FIG. 3 is a close-packed convolution structure in ResNet-HAT in a weak ore-spotted ore sorting process in accordance with a first embodiment of the present invention;
FIG. 4 is a schematic diagram of the structure of a residual block in a weak ore sorting method according to a first embodiment of the present invention;
FIG. 5 is a schematic diagram of dual-energy imaging in a method for sorting weak ore plaque ore in accordance with a first embodiment of the invention;
FIG. 6 is a schematic view of the structure of a multi-layer perceptron MLP in a method of sorting weak ore plaque ore according to a first embodiment of the invention;
FIG. 7 is a schematic diagram showing the structure of a hierarchical attention module in a method for classifying weak ore spots according to a first embodiment of the present invention;
FIG. 8 is a schematic diagram of the structure of the multi-layer attention mechanism in the weak ore sorting method according to the first embodiment of the present invention;
FIG. 9 is a schematic diagram of a multi-scale attention module in a method for classifying weak ore spots according to a first embodiment of the present invention;
fig. 10 is a block diagram showing the construction of a weak spot ore sorting apparatus according to a fourth embodiment of the present invention.
The invention will be further described in the following detailed description in conjunction with the above-described figures.
Detailed Description
In order that the invention may be readily understood, a more complete description of the invention will be rendered by reference to the appended drawings. Several embodiments of the invention are presented in the figures. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and/or" as used herein includes any and all combinations of one or more of the associated listed items.
The following embodiments are applicable to the main neural network of the weak ore-spotted ore sorting model shown in fig. 1, where the main neural network is formed by improving a residual network (ResNet) and the first half of the network is composed of a convolution layer, a pooling layer and a dense convolution module composed of four convolution blocks, and the second half is composed of two layered attention modules, a multi-scale attention mechanism module, a pooling layer and a full connection layer.
In the network structure, the initial network layer generally has larger spatial dimension and fewer channels, while the spatial dimension of the rear feature image 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, the initial part of the network is more suitable for performing intensive convolution calculation, the calculation amount obtained by the latter half of the network is very huge, and the calculation amount is limited by that the memory is not suitable for intensive convolution operation any more, and is more suitable for operations with small influence on throughput, such as attention mechanism, layer normalization and the like.
The network backbone provided by the embodiment of the invention introduces dense convolution operation, ensures that high-resolution features can be transmitted to each residual block of the residual network, replaces simple residual blocks with two hierarchical attention mechanisms, simply increases the number of network convolution layers and cannot learn weak ore-spotting features better, and because the weak features are lost in the latter half of the network, the attention mechanisms are replaced to concentrate on feature learning.
It should be noted that the structure shown in fig. 1 does not constitute a limitation on the backbone neural network among the weak ore sorting models, and in other embodiments, the backbone neural network may include fewer or more components than shown, or some components in combination, or a different arrangement of components.
How to improve the accuracy in sorting weak ore spots will be described in detail below with reference to specific examples and drawings.
Example 1
Referring to fig. 2, a method for sorting weak ore with spots according to a first embodiment of the present invention is shown, and includes steps S10 to S12.
Step S10, constructing a neural network, wherein the neural network at least comprises a dense convolution module and a layered attention module which are distributed back and forth respectively, the dense convolution module is used for avoiding the disappearance of ore-spot features in the training process, and the layered attention module is used for fusing the local features and the global features of the ore spots.
The invention mainly solves the problem that the characteristics of the fine ore spots of the weak ore disappear in network propagation, so that dense convolution operation is introduced to the first four residual blocks, and therefore, the output obtained by each residual block can be used as the input of the next residual block, the high-resolution characteristics can be ensured to be transmitted into each residual block, the problem of characteristic disappearance is solved, and a layering module is added to replace a plurality of residual blocks of the original network, and fuses a transducer and a layering attention mechanism.
In addition, the distribution of the calculated amount of the front and rear parts of the conventional neural network structure is uneven, and the problem that the calculated amount easily exceeds a memory during operation is caused, one of the reasons for the situation is that the calculated amount is rapidly increased along with the increase of the network, and the problem that the calculated amount of the front part of the network has residual calculated force and the calculated amount of the rear part of the network is insufficient. In the network structure adopted in the invention, dense convolution calculation is put at the front part of the network to fully exert the calculation power, and the rear part of the network performs operations such as attention and the like with smaller throughput for memory access.
The dense convolution operation (Dense Convolution) refers to one way of performing convolution calculations with all weights for each input location in the convolutional neural network. Unlike normal convolution operations, dense convolution has no jump connections, and each input position participates in the computation. In dense convolution, for each input position, its convolution with the ownership weight is computed, producing a corresponding output. This means that each input location in the network will produce a corresponding output value.
The embodiment of the invention integrates the dense convolution into the residual blocks of the residual network ResNet, takes the residual blocks as the object of the dense convolution, reserves the addition operation of the residual network and adds the channel combination between the residual blocks. Because the initial feature image of the network contains high-resolution features, and the weak ore-spotting features are gradually lost along with the layer-by-layer convolution, the dense convolution is used in the initial stage of the network to help the network learn the high-resolution features. In addition, the dense convolution has a similar function to the multi-scale fusion, namely shallow high-resolution features are used as the input of a deep convolution kernel, and the feature learning of weak ore spots is facilitated.
Specifically, as shown in fig. 3, the dense convolution module includes a plurality of convolution modules, and the convolution modules 1 and 2 are not different from the original residual block of ResNet, as shown in fig. 4, and the main modification is that the activation function ReLU is replaced by GELU which is more suitable for the residual structure. The negative value of the ReLU activation function is 0 and the reciprocal is 0, so that the gradient is 0, and the gradient corresponding to the negative value region is truncated to zero when the input is negative in the back propagation process, and cannot be transmitted to the previous layer, so that the gradient disappears, and the network cannot learn effectively. Residual connection enables the network to directly transfer the gradient, thereby relieving the condition of gradient disappearance and enabling training to be more stable and efficient.
The convolution module contains two residual structures, namely a solid line residual structure and a dashed line residual structure in the figure. And the feature images enter the main network at the same time and then branch from the residual errors, and then are added to obtain fusion features. Residual branches of the solid line part do not operate the input characteristic image and are directly added with a backbone network; the residual branches of the dotted line part are subjected to 1x1 convolution with the step length of 2, because the characteristic images of the main network are subjected to a convolution kernel with the step length of 2 and 3x3, at the moment, the space dimension characteristics of the characteristic images in the main network are reduced to one fourth, the number of channels is doubled, and in order to ensure that the addition operation is smoothly carried out, the output space dimension and the number of channels of the residual branches also need to be consistent with the main network.
The embodiment of the invention integrates the dense convolution into the residual blocks of the residual network ResNet, takes the residual blocks as the object of the dense convolution, reserves the addition operation of the residual network and adds the channel combination between the residual blocks. Because the initial feature image of the network contains high-resolution features, and the weak ore-spotting features are gradually lost along with the layer-by-layer convolution, the dense convolution is used in the initial stage of the network to help the network learn the high-resolution features. In addition, the dense convolution has a similar function to the multi-scale fusion, namely shallow high-resolution features are used as the input of a deep convolution kernel, and the feature learning of weak ore spots is facilitated.
And S11, performing deep learning training on the neural network to obtain a pre-trained ore sorting model.
The neural network is subjected to deep learning training, and an ore sorting model with accurate sorting can be obtained.
Specifically, the step of performing deep learning training on the neural network to obtain the pre-trained ore sorting model includes:
collecting historical ore image data, and manufacturing a training data set according to the historical ore image data, wherein the training data set comprises a training set, a testing set and a verification set;
the training data set is subjected to data enhancement and contrast processing and then is input into the neural network for deep learning training;
And (3) fine tuning the super parameters through training, determining a plurality of ore sorting models to be sorted by utilizing the verification set and determining the ore sorting model from the plurality of ore sorting models to be sorted by utilizing the test set.
In the embodiment of the present invention, the image type of the ore image may be a dual-energy image, in the ore sorting process, mined ore without distinction of ore waste is called raw ore, after the raw ore enters a conveyor belt of a sorting device, as shown in fig. 5, the raw ore is imaged by using XRT technology, a ray source in the device emits rays to irradiate the ore on the conveyor belt, a ray sensor is installed below the belt, and the rays penetrate through the raw ore and are imaged on the ray sensor.
The specific image obtained by imaging the single ray sensor is a single-channel image, which is called a single-energy image; when two sensors which are separated from each other up and down by a certain distance receive radiographic imaging, a single-channel single-energy image is generated respectively, 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 dual-energy image is a three-channel image, and the three channels are a low-energy image, a high-energy image and a third channel value image in sequence (the third channel value image is calculated by the high-energy image and the low-energy image).
The training data set is manufactured and divided into a training set, a testing set and a verification set, and when the training data set is implemented, the training data set can be divided according to a preset proportion, for example 2200 ore images and 2200 waste stones in the training set; 500 pieces of ore collection, 500 pieces of waste rocks, 500 pieces of ore collection and 500 pieces of waste rocks are tested and verified. The training set is input into a training frame, the training set is input into a neural network for training, relevant super parameters such as a learning rate initial value, a learning rate change method and a feature fusion structure are continuously fine-tuned for N times, the verification set is utilized to find the optimal N models, and finally the test set is utilized to test, so that one model with the best sorting effect is obtained.
In addition, in order to further improve the accuracy of the trained model training, sample pretreatment and enhancement are performed on each mineral sample image before the model training, and specifically, the formula of contrast treatment is as follows:
Wherein, Representing the output pixel value,/>Representing input pixel values,/>And/>The method respectively represents a minimum pixel value and a maximum pixel value in an image, alpha is a constant, theta and beta are gamma values, the value range of alpha is 0.1-3.0, and C is a constant.
The contrast processing can pull the difference of pixel values in the image, and the ore spot characteristics are highlighted.
The data enhancement step includes:
randomly rotating the training set by a preset angle according to a preset probability;
Randomly cutting the training set according to a preset probability and then attaching the training set to the white background image center with a preset size;
And adding two different noises into the training set according to the preset probability.
For example, the training set image is randomly rotated by a certain angle with 60% probability, the training set image is randomly cut with 50% probability, the training set image is attached to the center of the 122×122 white background image, and two different noises are added to the training set image with 30% probability respectively.
And S12, acquiring an ore image to be sorted, and inputting the ore image to be sorted into the pre-trained ore sorting model to obtain a final sorting result.
The trained ore separation model grasps the logic of ore separation, so that the ore can be automatically separated through the ore separation model, and the accuracy of the ore separation model is improved because the accuracy of the ore separation model is improved.
In summary, according to the weak ore spot ore sorting method in the embodiment of the invention, the ore sorting is automatically performed by training the ore sorting model, and because the ore sorting module grasps the ore sorting logic, the automatic sorting of the ore can be realized, and when a neural network for training the ore sorting model is constructed, a dense convolution module is introduced, so that the output obtained during training can be used as the input of the next module, the high-resolution characteristics can be transmitted into each module, the problem of feature disappearance is solved, the layered convolution module focuses on the weak fine ore spot characteristics after the dense convolution of the local and whole characteristic learning, the accuracy of model training is improved, the automatic sorting accuracy of the ore is finally realized, and the problem of low accuracy during ore sorting in the prior art is solved.
Example two
The weak ore-spotted ore sorting method in the present embodiment is different from the weak ore-spotted ore sorting method in the first embodiment in that:
The step of the hierarchical attention module for fusing the local features and the global features of the ore spots comprises the following steps:
Extracting a plurality of local windows from the input feature map received by the hierarchical attention module, wherein each local window is represented by a group of marks;
configuring carrier marks containing abstract information of each local window, and sequentially carrying out multi-head self-attention operation, layer normalization and multi-layer perceptron operation on the carrier marks;
Splicing the marks of the local window and the carrier marks to realize the communication of space information;
Dividing the spliced marks of the local window and the carrier mark, repeatedly iterating, and carrying out global information propagation;
And carrying out up-sampling on the carrier marks, and merging and calculating with the marks of the local window to obtain an output result.
The hierarchical attention module is Vision Transformer structure integrated with hierarchical attention mechanism, is a window attention mechanism, can promote local and global information exchange with lower calculation cost, and contains carrier marked CTs and integrated with hierarchical self-attention mechanism. The global characteristic information and the local characteristic information are fused through a layered attention mechanism, so that the learning of the network on the large-area mist weak ore spot characteristics is facilitated.
Specifically, the hierarchical attention module operates on the local features of the feature image and the overall features of the local window respectively. The input feature map is first extracted into a number of partial windows, each of which is represented by a set of labels, using a method similar to window movement Swin. For global feature extraction of local windows, the key idea is to introduce carrier-tagged CTs for summarizing the global information within each local window. The carrier-tagged CTs obtain summary information that they provide respective local windows through pooling and convolution operations. Each partial window has a unique carrier label for later fusion with the corresponding partial feature. In the branch where the hierarchical attention module extracts the window global features, the carrier tags go through a multi-headed self-attention operation, then a layer normalization and multi-layer perceptron MLP operation, this attention process allows the carrier tags to exchange information and summarize global features. Next, the local window markers and the carrier markers are stitched and another set of attention operations is applied to model the interaction between them, thereby enabling communication of spatial information. Subsequently, the markers are again segmented into respective local windows and carrier markers, after which the hierarchical attention module iterates over. To facilitate long-range interactions, global information propagation is finally performed at this stage. The output result is calculated by upsampling the carrier mark and merging with the local window mark.
Further, as shown in fig. 6, the multi-layer perceptron MLP is composed of an input layer, a hidden layer, and an output layer. The input layer receives input data, the hidden layer is represented by learning features, and the output layer generates a final prediction result. Each neuron of the hidden layer and the output layer has an activation function for introducing a nonlinear mapping. The multi-layer perceptron MLP can perform complex feature learning and capture nonlinear relationships between inputs. The advantages of the MLP and the attention mechanism can be fully exerted by combining the MLP and the attention mechanism, and the model can have the capacity of focusing on global features and local features, so that the expression capacity of the model is improved, the MLP and the attention mechanism are combined, the attention features are better captured and learned, and the performance and generalization capacity of the model in complex tasks are improved.
To incorporate position information, the hierarchical attention module adds absolute position bias to the carrier mark and the local window mark using a two-layer multi-layer perceptron. In addition, the logarithmic spatial relative position offset set forth in SwinV is employed to enhance attention to locality of the image samples. The hierarchical attention module realizes information exchange between the local window and the global feature, and effectively promotes the space reasoning capability in the whole feature map hierarchical structure.
Vector tagged CTs generation formula:
Wherein, Representing input data, first processed through a 3x3 convolutional layer to generate/>The spatial resolution of the features is then reduced using averaging pooling (AvgPool) to generate carrier markers/>L represents the feature depth.
Self-attention formula for carrier labeling:
Wherein the carrier is labeled . A multi-headed self-attention (MHSA) process is received and passed through a multi-layer perceptron (MLP) module having a process of dimension expansion and contraction (from d-dimension to 4 d-dimension back to d-dimension) to increase nonlinearity and enhance expressive power of the model. LN representative layer normalization,/>And/>Is the learned scaling factor.
Local window self-attention mechanism formula:
wherein the local window feature Is a local feature/>And vector markers/>Is a combination of (a) and (b). This feature is subjected to the same processing steps as the carrier label, multi-headed self-attention and multi-layer perceptron module.
To improve long-range modeling capability, carrier-tagged information is injected into the local window:
Wherein, Is divided into/>And/>These segmented features are then resized (upsampled) and fused together to form the final feature representation X.
Wherein H, W, d is the height, width, channel number of the input feature, n is the split partial window size (n×n).
The layering module adds absolute position offsets to CTs and local window markers using a two-layer MLP for incorporation into the position information module. In addition, the logarithmic space relative position offset proposed in SwinV2 is also employed to enhance attention with image sample locality, fig. 7 is a hierarchical attention module structure.
The attention structure in the hierarchical attention iteration module is a multi-head attention mechanism, and the structure is shown in fig. 8. The MHSA multi-headed attention mechanism allows the model to learn multiple sets of feature maps simultaneously, which 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.
For a given input sequence, h different sets of sequences are first obtained by linear transformation, each set comprising three sequences: query sequence Q, key sequence K, value sequence V. The attention score matrix is obtained through dot product calculation by using the query sequence Q and the key sequence K. This matrix represents the attention weight of each location to the other locations. To stabilize the calculation, the result is divided by a scaling factor, typically the square root of the dimension of the query sequence, when calculating the attention score. This scaling may help to avoid the attention score becoming too large. And then carrying out softmax operation on the scaled attention score to obtain the normalized attention weight of each position to other positions. And (3) performing matrix multiplication on the value sequence V by using the obtained attention weight to obtain attention output, wherein h in the figure is the number of attention heads, the value of h is 4 in the network, the 4 attention heads are combined and pass through a linear transformation layer to obtain a final output value, and the input sequence is divided into h groups at the beginning, so that the sequence dimension of each group is only one fourth of the original sequence in practice, and the output of the characteristic information with multiple dimension extraction is realized under the condition that the actual calculated amount is not increased greatly.
In summary, according to the weak ore spot ore sorting method in the embodiment of the invention, the ore sorting is automatically performed by training the ore sorting model, and because the ore sorting module grasps the ore sorting logic, the automatic sorting of the ore can be realized, and when a neural network for training the ore sorting model is constructed, a dense convolution module is introduced, so that the output obtained during training can be used as the input of the next module, the high-resolution characteristics can be transmitted into each module, the problem of feature disappearance is solved, the layered convolution module focuses on the weak fine ore spot characteristics after the dense convolution of the local and whole characteristic learning, the accuracy of model training is improved, the automatic sorting accuracy of the ore is finally realized, and the problem of low accuracy during ore sorting in the prior art is solved.
Example III
The weak ore-spotting method in this embodiment is different from the weak ore-spotting method in the first embodiment in that:
the neural network further includes a multi-scale attention module EMA-MG that employs GELU as an activation function, the method further comprising:
after the multi-scale attention module receives the characteristic images, carrying out maximum pooling operation on the characteristic images on an X axis and a Y axis respectively to obtain pooling results with high dimension and wide dimension;
Splicing the pooling results in a channel dimension, splitting the pooling results into two parts of height and width in the channel dimension after convolution, and respectively calculating weights of the two parts of height and width;
Grouping and normalizing the weights of the two parts of the height and the width and the direct calculation result of the weight calculation of the characteristic image to obtain a first result, and carrying out convolution operation on the characteristic image to obtain a second result;
Respectively calculating the first result through a maximum pooling layer and a softmax activation function to obtain a weight, and then performing matrix multiplication on the first result and the second result, wherein the second result is calculated through the maximum pooling layer and the softmax activation function to obtain the weight, and performing matrix multiplication on the weight and the first result;
And adding the two matrix multiplication results, performing GELU function calculation to obtain a weight, and performing calculation according to the weight and the characteristic image to obtain a final output characteristic image.
Wherein EMA-MG is an improvement in EMA attention, the average pooling layer used in weak fine ore spots is not suitable for local features, blurring the weak ore spot features, and affecting the model's perception of these detailed features. The algorithm replaces the average pooling layer with the maximum pooling layer to preserve the weak and small ore-spotting characteristics. In addition, although EMA is helpful for improving network convergence, there is still an optimization space in training accuracy stability, and the algorithm replaces the Softmax activation function in EMA attention with GELU, compared with the original activation function, the average value of the GELU function is close to zero, and compared with the traditional Sigmoid function, zero centering is easier to achieve in the network. Helping to reduce the drift problem in network training. Also GELU, due to its smoothness and near zero center properties, performs well when using residual connections, fitting the residual structure in EMA attention.
Specifically, as shown in fig. 9, after the feature images are input into the EMA-MG module, grouping operation is performed to obtain four branches, the second and third branches perform maximum pooling operation on the feature images on the X axis and the Y axis respectively to obtain pooled results with high dimension and wide dimension, and the pooled results with high and wide dimensions are spliced on the channel dimension and convolved by 1X 1. Splitting the result into two parts of height and width in the channel dimension, respectively calculating x_h and x_w, activating a function through GELU to obtain weights of the two parts, inputting the two parts and the characteristic image of the first branch into a grouping normalization layer according to the weight calculation result, and grouping normalization to improve the generalization capability and stability of the model and obtain output x 1. And x1 is subjected to matrix multiplication with the output x2 of the fourth branch after weight is obtained through the maximum pooling layer and softmax activation function calculation, and x2 is obtained through 3x3 convolution of the characteristic image of the fourth branch. And x2 is subjected to maximum pooling layer and softmax activation function layer calculation to obtain a weight, matrix multiplication is performed on the weight and x1, so that cross matrix multiplication operation is formed, the weight is obtained through GELU function calculation after the addition of two matrix multiplication results, and the final output characteristic image is obtained according to the weight and the first branch characteristic image calculation, wherein the length and the width of the output characteristic image and the channel number are consistent with those of the input characteristic image.
In summary, according to the weak ore spot ore sorting method in the embodiment of the invention, the ore sorting is automatically performed by training the ore sorting model, and because the ore sorting module grasps the ore sorting logic, the automatic sorting of the ore can be realized, and when a neural network for training the ore sorting model is constructed, a dense convolution module is introduced, so that the output obtained during training can be used as the input of the next module, the high-resolution characteristics can be transmitted into each module, the problem of feature disappearance is solved, the layered convolution module focuses on the weak fine ore spot characteristics after the dense convolution of the local and whole characteristic learning, the accuracy of model training is improved, the automatic sorting accuracy of the ore is finally realized, and the problem of low accuracy during ore sorting in the prior art is solved.
Example IV
Referring to fig. 10, there is shown a weak spot ore separation apparatus according to a fourth embodiment of the present invention, the apparatus comprising:
the building module 100 is configured to build a neural network, where the neural network at least includes a dense convolution module and a hierarchical attention module, the dense convolution module is configured to avoid disappearance of ore-plaque features in a training process, and the hierarchical attention module is configured to fuse local features and global features of the ore-plaque;
The training module 200 is used for performing deep learning training on the neural network to obtain a pre-trained ore sorting model;
the sorting module 300 is configured to obtain an image of ore to be sorted, and input the image of ore to be sorted into the pre-trained ore sorting model to obtain a final sorting result.
Further, in some optional embodiments of the present invention, the training module includes:
the acquisition unit is used for acquiring historical ore image data and manufacturing a training data set according to the historical ore image data, wherein the training data set comprises a training set, a testing set and a verification set;
the training unit is used for carrying out data enhancement and contrast processing on the training data set and then inputting the training data set into the neural network for deep learning training;
And the fine tuning unit is used for carrying out fine tuning on the super parameters through training, determining a plurality of ore sorting models to be sorted by utilizing the verification set and determining the ore sorting model from the plurality of ore sorting models to be sorted by utilizing the test set.
Further, in some optional embodiments of the present invention, the formula of the contrast processing is:
Wherein, Representing the output pixel value,/>Representing input pixel values,/>And/>Respectively representing the minimum pixel value and the maximum pixel value in the image, wherein alpha is a constant, theta and beta are gamma values, and C is a constant.
Further, in some optional embodiments of the invention, the step of data enhancement includes:
randomly rotating the training set by a preset angle according to a preset probability;
Randomly cutting the training set according to a preset probability and then attaching the training set to the white background image center with a preset size;
And adding two different noises into the training set according to the preset probability.
Further, in some optional embodiments of the present invention, the building block includes:
And the convolution unit is used for carrying out convolution calculation on each input position and all weights in the neural network to generate corresponding output.
Further, in some optional embodiments of the present invention, the building block further comprises:
The fusion unit is used for extracting a plurality of local windows from the input feature map received by the hierarchical attention module, and each local window is represented by a group of marks;
configuring carrier marks containing abstract information of each local window, and sequentially carrying out multi-head self-attention operation, layer normalization and multi-layer perceptron operation on the carrier marks;
Splicing the marks of the local window and the carrier marks to realize the communication of space information;
Dividing the spliced marks of the local window and the carrier mark, repeatedly iterating, and carrying out global information propagation;
And carrying out up-sampling on the carrier marks, and merging and calculating with the marks of the local window to obtain an output result.
Further, in some optional embodiments of the present invention, the neural network further includes a multi-scale attention module, the multi-scale attention module employing GELU as the activation function, and the apparatus further includes:
The pooling module is used for carrying out maximum pooling operation on the characteristic images in an X axis and a Y axis respectively after the multi-scale attention module receives the characteristic images to obtain pooling results with high dimension and wide dimension;
Splicing the pooling results in a channel dimension, splitting the pooling results into two parts of height and width in the channel dimension after convolution, and respectively calculating weights of the two parts of height and width;
Grouping and normalizing the weights of the two parts of the height and the width and the direct calculation result of the weight calculation of the characteristic image to obtain a first result, and carrying out convolution operation on the characteristic image to obtain a second result;
Respectively calculating the first result through a maximum pooling layer and a softmax activation function to obtain a weight, and then performing matrix multiplication on the first result and the second result, wherein the second result is calculated through the maximum pooling layer and the softmax activation function to obtain the weight, and performing matrix multiplication on the weight and the first result;
And adding the two matrix multiplication results, performing GELU function calculation to obtain a weight, and performing calculation according to the weight and the characteristic image to obtain a final output characteristic image.
The functions or operation steps implemented when the above modules are executed are substantially the same as those in the above method embodiments, and are not described herein again.
Example five
Another aspect of the present invention also provides a readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method described in any one of the above embodiments one to three.
Example six
In another aspect, the present invention further provides an electronic device, where the electronic device includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor executes the program to implement the steps of the method according to any one of the first to third embodiments.
The technical features of the above embodiments may be arbitrarily combined, and for brevity, all of the possible combinations of the technical features of the above embodiments are not described, however, they should be considered as the scope of the description of the present specification as long as there is no contradiction between the combinations of the technical features.
Those of skill in the art will appreciate that the logic and/or steps represented in the flow diagrams or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable storage medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable storage medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable storage medium may even be paper or other suitable medium upon which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted, or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The foregoing examples illustrate only a few embodiments of the invention and are described in detail herein without thereby limiting the scope of the invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention. Accordingly, the scope of protection of the present invention is to be determined by the appended claims.

Claims (8)

1. A method of weak ore spotting, the method comprising:
The method comprises the steps of constructing a neural network, wherein the neural network at least comprises a dense convolution module and a layered attention module which are distributed back and forth respectively, the dense convolution module is used for avoiding the disappearance of ore spot characteristics in the training process, and the layered attention module is used for fusing local characteristics and global characteristics of the ore spots;
deep learning training is carried out on the neural network so as to obtain a pre-trained ore sorting model;
acquiring an ore image to be sorted, and inputting the ore image to be sorted into the pre-trained ore sorting model to obtain a final sorting result;
the step of the dense convolution module for avoiding the disappearance of ore plaque features during the training process comprises the following steps:
performing convolution calculation on each input position and all weights in the neural network to generate corresponding output;
The step of the hierarchical attention module for fusing the local features and the global features of the ore spots comprises the following steps:
Extracting a plurality of local windows from the input feature map received by the hierarchical attention module, wherein each local window is represented by a group of marks;
configuring carrier marks containing abstract information of each local window, and sequentially carrying out multi-head self-attention operation, layer normalization and multi-layer perceptron operation on the carrier marks;
Splicing the marks of the local window and the carrier marks to realize the communication of space information;
Dividing the spliced marks of the local window and the carrier mark, repeatedly iterating, and carrying out global information propagation;
And carrying out up-sampling on the carrier marks, and merging and calculating with the marks of the local window to obtain an output result.
2. The weak ore sorting method of claim 1, wherein the step of deep learning training the neural network to obtain the pre-trained ore sorting model comprises:
collecting historical ore image data, and manufacturing a training data set according to the historical ore image data, wherein the training data set comprises a training set, a testing set and a verification set;
the training data set is subjected to data enhancement and contrast processing and then is input into the neural network for deep learning training;
And (3) fine tuning the super parameters through training, determining a plurality of ore sorting models to be sorted by utilizing the verification set and determining the ore sorting model from the plurality of ore sorting models to be sorted by utilizing the test set.
3. The weak ore sorting method of claim 2, wherein the formula of the contrast treatment is:
Wherein, Representing the output pixel value,/>Representing input pixel values,/>And/>Respectively representing the minimum pixel value and the maximum pixel value in the image, wherein alpha is a constant, theta and beta are gamma values, and C is a constant.
4. The weak spot ore sorting method of claim 2, wherein the step of data enhancement comprises:
randomly rotating the training set by a preset angle according to a preset probability;
Randomly cutting the training set according to a preset probability and then attaching the training set to the white background image center with a preset size;
And adding two different noises into the training set according to the preset probability.
5. The weak ore sorting method of claim 1, wherein the neural network further comprises a multi-scale attention module employing GELU as an activation function, the method further comprising:
after the multi-scale attention module receives the characteristic images, carrying out maximum pooling operation on the characteristic images on an X axis and a Y axis respectively to obtain pooling results with high dimension and wide dimension;
Splicing the pooling results in a channel dimension, splitting the pooling results into two parts of height and width in the channel dimension after convolution, and respectively calculating weights of the two parts of height and width;
Grouping and normalizing the weights of the two parts of the height and the width and the direct calculation result of the weight calculation of the characteristic image to obtain a first result, and carrying out convolution operation on the characteristic image to obtain a second result;
Respectively calculating the first result through a maximum pooling layer and a softmax activation function to obtain a weight, and then performing matrix multiplication on the first result and the second result, wherein the second result is calculated through the maximum pooling layer and the softmax activation function to obtain the weight, and performing matrix multiplication on the weight and the first result;
And adding the two matrix multiplication results, performing GELU function calculation to obtain a weight, and performing calculation according to the weight and the characteristic image to obtain a final output characteristic image.
6. A weak spot ore sorting apparatus for carrying out the weak spot ore sorting method of any one of claims 1 to 5, the apparatus comprising:
the building module is used for building a neural network, the neural network at least comprises a dense convolution module and a layered attention module, the dense convolution module and the layered attention module are respectively distributed front and back, the dense convolution module is used for avoiding the disappearance of ore spot characteristics in the training process, and the layered attention module is used for fusing local characteristics and global characteristics of the ore spots;
The training module is used for performing deep learning training on the neural network to obtain a pre-trained ore sorting model;
And the sorting module is used for acquiring the ore images to be sorted, and inputting the ore images to be sorted into the pre-trained ore sorting model to obtain a final sorting result.
7. A readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 5.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method according to any one of claims 1 to 5 when the program is executed.
CN202410354307.5A 2024-03-27 2024-03-27 Weak ore spot ore sorting method, device, readable storage medium and equipment Pending CN117975167A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410354307.5A CN117975167A (en) 2024-03-27 2024-03-27 Weak ore spot ore sorting method, device, readable storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410354307.5A CN117975167A (en) 2024-03-27 2024-03-27 Weak ore spot ore sorting method, device, readable storage medium and equipment

Publications (1)

Publication Number Publication Date
CN117975167A true CN117975167A (en) 2024-05-03

Family

ID=90864920

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410354307.5A Pending CN117975167A (en) 2024-03-27 2024-03-27 Weak ore spot ore sorting method, device, readable storage medium and equipment

Country Status (1)

Country Link
CN (1) CN117975167A (en)

Similar Documents

Publication Publication Date Title
CN111275688B (en) Small target detection method based on context feature fusion screening of attention mechanism
CN111259930B (en) General target detection method of self-adaptive attention guidance mechanism
CN112966684B (en) Cooperative learning character recognition method under attention mechanism
EP3349048B1 (en) Inspection devices and methods for detecting a firearm in a luggage
CN109784203B (en) Method for inspecting contraband in weak supervision X-ray image based on layered propagation and activation
CN114120102A (en) Boundary-optimized remote sensing image semantic segmentation method, device, equipment and medium
CN111091105A (en) Remote sensing image target detection method based on new frame regression loss function
CN103049763B (en) Context-constraint-based target identification method
CN108830188A (en) Vehicle checking method based on deep learning
Gu et al. Automatic and robust object detection in x-ray baggage inspection using deep convolutional neural networks
CN108182454A (en) Safety check identifying system and its control method
CN106557778A (en) Generic object detection method and device, data processing equipment and terminal device
CN106408030A (en) SAR image classification method based on middle lamella semantic attribute and convolution neural network
CN111932511B (en) Electronic component quality detection method and system based on deep learning
CN114495029B (en) Traffic target detection method and system based on improved YOLOv4
CN114998220B (en) Tongue image detection and positioning method based on improved Tiny-YOLO v4 natural environment
CN112613350A (en) High-resolution optical remote sensing image airplane target detection method based on deep neural network
CN110349167A (en) A kind of image instance dividing method and device
CN110008899B (en) Method for extracting and classifying candidate targets of visible light remote sensing image
CN109977968A (en) A kind of SAR change detecting method of deep learning classification and predicting
CN114332473A (en) Object detection method, object detection device, computer equipment, storage medium and program product
CN102024149B (en) Method of object detection and training method of classifier in hierarchical object detector
Zhou et al. Building segmentation from airborne VHR images using Mask R-CNN
CN113657414B (en) Object identification method
CN115019133A (en) Method and system for detecting weak target in image based on self-training and label anti-noise

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication