An iron ore image recognition method based on improved ShufflenetV2 network
By building an iron ore identification model through the improved ShufflenetV2 network, the problems of manual identification in traditional methods being easily affected by experience and having high equipment costs are solved, and fast and accurate iron ore type identification is achieved, which improves production efficiency and reduces costs.
Patent Information
- Application Number
- CN202510330959.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-03-20
AI Technical Summary
Traditional iron ore identification methods rely on manual visual inspection and are easily affected by human experience. In addition, modern methods have high equipment costs and environmental factors affect the analysis results, making it difficult to achieve fast and real-time iron ore identification and classification.
An improved ShufflenetV2 network is used to build an iron ore recognition model. Through the attention mechanism and data augmentation technology, the training set includes hematite, magnetite, siderite and chlorite sample pictures, and geometric and color transformations are performed. Combined with the SK attention mechanism and the ECA attention mechanism, the H-Swish activation function is used to construct the SEH-ShuffleNetV2s network model.
It achieves fast and accurate identification of iron ore types, improves production efficiency, reduces production costs, and has an identification accuracy rate of 96.3%.
Smart Images

Figure CN120259750B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of iron ore recognition, and in particular to an iron ore image recognition method based on an improved ShufflenetV2 network. Background Art
[0002] The iron ore sorting process is cumbersome, and the process flow makes the entire sorting process slow, which is not suitable for fast and real-time production. Traditional iron ore identification is mainly through manual visual identification, which is easily affected by subjective factors of human experience. Although the technology of current iron ore identification methods has made significant progress compared with traditional methods, there are still some technical defects. Many modern iron ore identification methods, such as X-ray fluorescence spectroscopy (XRF), X-ray diffraction (XRD), laser induced breakdown spectroscopy (LIBS), etc., can provide high-precision mineral composition analysis, but the equipment cost is high and requires specialized technicians to operate and maintain; and the mine environment may contain dust, humidity changes, and temperature fluctuations, which may affect the sample surface due to oxidation, weathering or pollution, resulting in unstable analysis results. Therefore, the present invention proposes an iron ore image recognition method based on an improved ShufflenetV2 network. Summary of the Invention
[0003] The purpose of the present invention is to solve the above technical problems and provide an iron ore image recognition method based on an improved ShufflenetV2 network to achieve real-time and rapid iron ore recognition and classification.
[0004] To achieve the above object, the present invention provides the following solutions:
[0005] An iron ore image recognition method based on an improved ShufflenetV2 network, comprising:
[0006] Acquire an image of the iron ore to be inspected;
[0007] The iron ore image to be detected is input into a preset iron ore recognition model, and the iron ore category recognition result is output, wherein the iron ore recognition model is obtained by training with a training set, and the training set includes sample images of several hematite, magnetite, siderite and chlorite. The iron ore recognition model is constructed using the ShuffleNetV2 network improved based on the attention mechanism.
[0008] Optionally, before training the iron ore recognition model using the training set, the step further includes expanding the training set, and the expanding includes:
[0009] Constructing a first training set based on the sample images of hematite, magnetite, siderite and chlorite;
[0010] Performing a geometric transformation on the first training set, adding the sample images after the geometric transformation to the first training set, and constructing a second training set, wherein the geometric transformation includes flipping and rotating,
[0011] Performing color transformation on the second training set, adding the sample images after color transformation to the second training set, and constructing a third training set, wherein the color transformation is performed by adding salt and pepper noise.
[0012] Optionally, the iron ore recognition model includes n processing modules connected in sequence, which are used to extract information layer by layer from the input image and output recognition results.
[0013] Optionally, the n processing modules include a first processing module, a second processing module, a third processing module, a fourth processing module, and a fifth processing module, wherein the first processing module includes a 3×3 convolutional layer and a 3×3 depth-separable convolutional layer connected in sequence; the second processing module, the third processing module, and the fourth processing module all include ShuffleNetV2 Unit2 and ShuffleNetV2 Unit1 improved by the attention mechanism connected in sequence; the fifth processing module includes a 1×1 convolutional layer, a global pooling layer, and a fully connected layer connected in sequence.
[0014] Optionally, improving the ShuffleNetV2 Unit2 and ShuffleNetV2Unit1 using an attention mechanism includes:
[0015] A hybrid attention layer is added after the Channel Shuffle layer of ShuffleNetV2 Unit2 and ShuffleNetV2 Unit1, wherein the hybrid attention layer adopts the tandem fusion of the SK attention mechanism and the ECA attention mechanism.
[0016] Optionally, the 3×3 convolutional layer, the 1×1 convolutional layer, and the convolutional layers in the ShuffleNetV2 Unit2 and ShuffleNetV2 Unit1 all use an H-Swish activation function.
[0017] Optionally, before inputting the iron ore image to be detected into the iron ore recognition model, the method further includes normalizing and cropping the iron ore image to be detected.
[0018] The beneficial effects of the present invention are:
[0019] The present invention constructs an iron ore recognition model through the ShuffleNetV2 network improved by the attention mechanism. The model can accurately, quickly and in real time predict the type of iron ore, thereby improving production efficiency and saving production costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0021] Figure 1 This is the original ShuffleNetV2 network structure diagram of an embodiment of the present invention;
[0022] Figure 2 This is a diagram of the SE-ShuffleNetV2 network structure that introduces the fusion attention mechanism in an embodiment of the present invention;
[0023] Figure 3 This is a diagram of the improved SEH-ShuffleNetV2s network structure according to an embodiment of the present invention;
[0024] Figure 4 This is a flow chart of an iron ore image recognition method based on an improved ShufflenetV2 network according to an embodiment of the present invention;
[0025] Figure 5 This is a magnetite identification effect diagram of an embodiment of the present invention;
[0026] Figure 6 This is a hematite identification effect diagram of an embodiment of the present invention;
[0027] Figure 7 This is a siderite identification effect diagram of an embodiment of the present invention;
[0028] Figure 8 This is a chlorite identification effect diagram of an embodiment of the present invention;
[0029] Figure 9 The following is a comparison curve of the accuracy of the original ShuffleNetV2 network model, SE-ShuffleNetV2 network model, and SEH-ShuffleNetV2s network model. DETAILED DESCRIPTION
[0030] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0031] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0032] This embodiment provides an iron ore image recognition method based on an improved ShufflenetV2 network. Figure 4 Shown, including:
[0033] Acquire an image of the iron ore to be inspected;
[0034] The iron ore image to be detected is input into a preset iron ore recognition model, and the iron ore category recognition result is output, wherein the iron ore recognition model is obtained by training with a training set, and the training set includes sample images of several hematite, magnetite, siderite and chlorite. The iron ore recognition model is constructed using the ShuffleNetV2 network improved based on the attention mechanism.
[0035] Specifically, this embodiment constructs an iron ore recognition model through the ShuffleNetV2 network improved by the attention mechanism. The model can accurately, quickly and in real time predict the type of iron ore, thereby improving production efficiency and saving production costs.
[0036] Furthermore, the training set is prepared:
[0037] Before training the iron ore recognition model using the training set, the training set is further expanded, and the expansion includes:
[0038] Constructing a first training set based on the sample images of hematite, magnetite, siderite and chlorite;
[0039] Performing a geometric transformation on the first training set, adding the sample images after the geometric transformation to the first training set, and constructing a second training set, wherein the geometric transformation includes flipping and rotating,
[0040] Performing color transformation on the second training set, adding the sample images after color transformation to the second training set, and constructing a third training set, wherein the color transformation is performed by adding salt and pepper noise.
[0041] Specifically, this example uses sample images of hematite, magnetite, siderite, and chlorite. Following the principle of diversity in the characteristics of different iron ores, as much sample data as possible is selected. To improve the accuracy of the network, the dataset is augmented and divided into training and test sets. Traditional data augmentation methods are used to augment the dataset, as follows:
[0042] 1. Geometric transformation:
[0043] 1) Flip: Mirror the left and right parts of the image around the vertical axis of the image. Assume the original image has a height of h and a width of w. A pixel P(x,y) in the original image becomes P(w-1-x,y) after horizontal transformation.
[0044] 2) Rotation: Rotate 45°, 90° and 135° on the axis respectively.
[0045] 2. Color transformation: Use salt and pepper noise to transform the image color. Adding an appropriate amount of noise can enhance the learning ability of the model. The specific method is as follows:
[0046] 1) Randomly select the signal-to-noise ratio (SNR) between [0, 1]. In this invention, SNR=0.5 is selected;
[0047] 2) Calculate the total number of pixels SP and obtain the number of pixels to be added with noise NP = SP*(1-SNR);
[0048] 3) Randomly obtain the pixel position P(i, j) to which noise is to be added;
[0049] 4) Specify the pixel value as 255;
[0050] 5) Repeat steps 3) and 4) until NP pixels of all pixels are completed;
[0051] 6) Output the image after adding noise.
[0052] In this embodiment, the addition of salt and pepper noise randomly generates black and white pixels on the image, making the image more robust.
[0053] Furthermore, the model is constructed:
[0054] The iron ore recognition model includes n processing modules connected in sequence, which are used to extract information layer by layer from the input image and output recognition results.
[0055] Specifically, it includes a first processing module, a second processing module, a third processing module, a fourth processing module, and a fifth processing module, wherein the first processing module includes a 3×3 convolutional layer and a 3×3 depth-separable convolutional layer connected in sequence; the second processing module, the third processing module, and the fourth processing module all include ShuffleNetV2 Unit2 and ShuffleNetV2 Unit1 improved by the attention mechanism connected in sequence; the fifth processing module includes a 1×1 convolutional layer, a global pooling layer, and a fully connected layer connected in sequence.
[0056] The improvements of ShuffleNetV2 Unit2 and ShuffleNetV2 Unit1 using the attention mechanism include:
[0057] A hybrid attention layer is added after the Channel Shuffle layer of ShuffleNetV2 Unit2 and ShuffleNetV2 Unit1, wherein the hybrid attention layer adopts the tandem fusion of the SK attention mechanism and the ECA attention mechanism.
[0058] The 3×3 convolutional layer, the 1×1 convolutional layer, and the convolutional layers in the ShuffleNetV2 Unit2 and ShuffleNetV2Unit1 all use the H-Swish activation function.
[0059] Specifically, such as Figure 1 As shown, this embodiment uses the ShuffleNetV2 network to fuse shallow surface features with deep abstract features at multiple scales, and on this basis uses the fusion attention mechanism to further enhance the network's ability to capture image details. The specific methods of improvement are as follows:
[0060] (1) Figure 2 As shown in the figure, the SK attention mechanism and the ECA attention mechanism are first fused in series based on their structural characteristics to construct the SE-ShuffleNetV2 network model. The SK module first uses different convolution kernels to adjust the receptive field size based on the input information. The ECA module then adaptively adjusts the weights of channel features to better focus on important features and suppress unimportant ones, thereby enhancing the network's representational capabilities without significantly increasing parameters and computational cost. Integrating this fused module into the network can enhance the model's generalization and robustness.
[0061] (2) The H-Swish activation function proposed by MobieNetV3 can effectively replace the ReLU activation function, which helps to improve the nonlinear modeling capabilities of the model. Compared with ReLU, H-Swish has better smoothing performance at the boundary, which helps to reduce the gradient vanishing problem, and is also more efficient in terms of computational complexity, which improves the overall training speed and stability. Due to the simple hardware implementation, it can effectively improve the inference speed, especially for edge computing scenarios, especially in resource-constrained situations. It can reduce energy consumption and increase response speed while ensuring computational efficiency and improving overall performance.
[0062] (3) This embodiment classifies four different types of iron ore images. The classification task is relatively simple, and the required network model depth does not need to be too deep. Therefore, in order to reduce the consumption of parameters and computational complexity, the number of stacks of Unit1 and Unit2 in stages 2, 3, and 4 of the original network is reduced to 1, so that the ratio of the number of stacked units of Unit1 and Unit2 is 1:1. The original network uses a maximum pooling layer for downsampling after a 3×3 ordinary convolution to reduce the dimension and the number of parameters, and finally forms an improved SEH-ShuffleNetV2s network model. The improved network replaces the maximum pooling layer with a 3×3 depthwise separable convolution with a small step size of 2, see Figure 3 ,This change not only avoids information loss, but also captures subtle features in the image more accurately.
[0063] Further, model training and testing:
[0064] The original ShuffleNetV2 network model, the SE-ShuffleNetV2 network model in (1) above, and the SEH-ShuffleNetV2s network model in (3) are trained using the same parameter configuration.
[0065] train:
[0066] Experimental Environment Configuration: Network training and testing were performed using the PyTorch framework. Hardware: AMD Ryzen 55600H with Radeon Graphics @ 3.30GHz, NVIDIA GeForce GTX1060 Ti, 16GB of RAM. GPU Software: Windows 10 64-bit, CUDA 11.7, CUDNN 8.6.0, PyTorch 2.3.1, PyCharm 2023.
[0067] We used stochastic gradient descent to accelerate the model, setting the training period to 100. The batch size (Batch_size) was determined by the video memory capacity, and we chose Batch_size = 32. We used the SGD optimizer and set the learning rate (lr) to 0.1, 0.01, and 0.001 for comparative experiments. We found that lr = 0.01 achieved the best results, and used cross-entropy to calculate the loss.
[0068] test:
[0069] Using the above trained original ShuffleNetV2 network model, SE-ShuffleNetV2 network model and SEH-ShuffleNetV2s network model, the recognition results are compared and analyzed through the test set. The accuracy comparison curve is as follows Figure 9 As shown in the figure, the dotted horizontal dashed line is the recognition accuracy curve of the SEH-ShuffleNetV2s network model used in this embodiment. It can be seen that with the increase in the number of training times, the accuracy gradually stabilizes, and compared with the original ShuffleNetV2 network model (solid line) and the SE-ShuffleNetV2 network model with only the attention mechanism (dotted line), the SEH-ShuffleNetV2s network model has a higher accuracy.
[0070] Furthermore, the model applies:
[0071] Before the iron ore image to be detected is input into the iron ore recognition model, the iron ore image to be detected is also normalized and cropped.
[0072] Specifically, the above-trained SEH-ShuffleNetV2s network model, that is, the iron ore recognition model, is used for prediction. The iron ore image to be detected is normalized to 224*224 size, and the CenterCrop operation is performed to crop the image without distortion. The model and weights are loaded. In order to prevent the grayscale image from reporting an error during prediction, the image is converted to an RGB image and the image is detected. The output result is the category of iron ore. The recognition effect is as follows: Figure 5 、 6 , 7, and 8, and the final recognition accuracy can reach up to 96.3%.
[0073] The embodiments described above are merely descriptions of preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by persons skilled in the art should fall within the scope of protection defined by the claims of the present invention.
Claims
1. An iron ore image recognition method based on an improved ShufflenetV2 network, characterized in that: include: Acquire an image of the iron ore to be inspected; Inputting the iron ore image to be detected into a preset iron ore recognition model and outputting an iron ore category recognition result, wherein the iron ore recognition model is obtained by training a training set, the training set including sample images of several hematite, magnetite, siderite, and chlorite, and the iron ore recognition model is constructed using a ShuffleNetV2 network improved based on the attention mechanism; The iron ore recognition model includes n processing modules connected in sequence, which are used to extract information layer by layer from the input image and output the recognition results; The n processing modules include a first processing module, a second processing module, a third processing module, a fourth processing module, and a fifth processing module, wherein the first processing module includes a 3×3 convolutional layer and a 3×3 depthwise separable convolutional layer connected in sequence; the second processing module, the third processing module, and the fourth processing module each include ShuffleNetV2 Unit2 and ShuffleNetV2 Unit1 improved by the attention mechanism connected in sequence; the fifth processing module includes a 1×1 convolutional layer, a global pooling layer, and a fully connected layer connected in sequence; The improvements of ShuffleNetV2 Unit2 and ShuffleNetV2 Unit1 using the attention mechanism include: A hybrid attention layer is added after the Channel Shuffle layer of ShuffleNetV2 Unit2 and ShuffleNetV2 Unit1, wherein the hybrid attention layer adopts the tandem fusion of the SK attention mechanism and the ECA attention mechanism; The 3×3 convolutional layer, the 1×1 convolutional layer, and the convolutional layers in ShuffleNetV2 Unit2 and ShuffleNetV2 Unit1 all use the H-Swish activation function.
2. The iron ore image recognition method based on the improved ShufflenetV2 network according to claim 1 is characterized in that: Before training the iron ore recognition model using the training set, the training set is further expanded, and the expansion includes: Constructing a first training set based on the sample images of hematite, magnetite, siderite and chlorite; Performing a geometric transformation on the first training set, adding the sample images after the geometric transformation to the first training set, and constructing a second training set, wherein the geometric transformation includes flipping and rotating, Performing color transformation on the second training set, adding the sample images after color transformation to the second training set, and constructing a third training set, wherein the color transformation is performed by adding salt and pepper noise.
3. The iron ore image recognition method based on the improved ShufflenetV2 network according to claim 1 is characterized in that: Before inputting the iron ore image to be detected into the iron ore recognition model, the method further includes normalizing and cropping the iron ore image to be detected.