Coal moisture content and spatial distribution analysis method and system based on image spectrum

Through the analysis method based on image spectrum, combined with the Transformer model and the least squares SVM model, the existing coal moisture content measurement methods have solved the problem of low accuracy and inability to determine the spatial distribution of moisture, and achieved rapid and accurate detection of moisture content and spatial distribution .

CN119147482BActive Publication Date: 2025-02-07SHANDONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411648455.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-02-07
Estimated Expiration
2044-11-19

AI Technical Summary

Technical Problem

The existing coal moisture content measurement methods have problems with low detection accuracy and poor robustness, and cannot effectively determine the specific spatial distribution of moisture in coal.

Method used

Using an analysis method based on image spectrum, by obtaining visible light images and hyperspectral images of coal, semantic segmentation is performed using a pre-trained image segmentation model, and the spectral and spatial features of each pixel point in the water-containing area are extracted, combining the Transformer model and the minimum two. Multiply the SVM model to analyze the dependencies between features and output moisture content and moisture spatial distribution.

Benefits of technology

It realizes rapid and accurate detection of the moisture content and spatial distribution in coal, improves the accuracy of moisture content detection, and can serve as a reference standard for coal quality evaluation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119147482B_ABST
    Figure CN119147482B_ABST
Patent Text Reader

Abstract

The invention discloses a method and system for analyzing the moisture content and spatial distribution of coal based on image spectrum, belonging to the technical field of coal moisture content analysis, comprising: obtaining a visible light image and a hyperspectral image of the coal to be tested; performing semantic segmentation on the visible light image to divide it into a dry area and a water-containing area; extracting hyperspectral data of each pixel point in the hyperspectral image of the water-containing area, extracting spectral features of multiple bands by using a sliding window, and extracting spectral features related to moisture by dynamically adjusting through an attention mechanism; using the spectral features and spatial features of each pixel point in the water-containing area as samples, constructing a sample sequence, inputting the sample sequence into a Transformer model, and outputting a feature matrix; pooling the feature matrix and then inputting it into a least squares SVM model, and outputting the moisture content corresponding to each pixel point in the water-containing area; performing graded color development processing according to the moisture content of different pixel points, and obtaining accurate coal moisture and its spatial distribution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of coal moisture content analysis, and in particular relates to a method and system for analyzing coal moisture content and spatial distribution based on image spectrum. Background Art

[0002] As the application scope of coal becomes wider and wider, higher requirements are also put forward for coal quality. The determination of total moisture content of coal is one of the important items of coal quality detection and analysis. The moisture content of coal is related to factors such as its formation environment and mining conditions, and is also affected by the degree and type of coalification. The amount of water content in coal has a certain impact on its economic value, combustion performance, processing and utilization, and environmental protection: from the perspective of cost-effectiveness, the greater the water content of coal, the higher its transportation and processing costs will be; the water content in coal will absorb a large amount of heat during the combustion process and convert into water vapor and evaporate, which not only reduces the combustion temperature of coal, but also reduces the effective calorific value output of coal, thereby reducing the combustion efficiency. At the same time, high moisture content combustion will also cause damage to equipment; in the process of coal processing, high moisture content of coal will make the processing process more complicated and time-consuming; water vapor in the combustion process will increase the amount of flue gas, thereby increasing the emission of pollutants.

[0003] At present, the measurement methods of coal moisture content are mainly divided into direct and indirect measurement methods. The direct measurement method is also called the standard weight method, which can be divided into the nitrogen drying method and the air drying method. As a laboratory measurement method, it can obtain higher measurement accuracy, but it is time-consuming and will destroy the original properties of the sample; the indirect measurement methods mainly include neutron method, conductivity method, capacitance method, infrared reflection method, microwave method, etc., but they have the problems of low detection accuracy and poor robustness. In addition, the above existing methods can only detect the moisture content of coal, and cannot effectively determine the specific spatial distribution of moisture in coal. Summary of the invention

[0004] To address the deficiencies of the above-mentioned prior art, the present invention provides a method and system for analyzing the moisture content and spatial distribution of coal based on image spectroscopy. Image spectroscopy technology is used to process the spectral data and visible light images of coal, extract the spectral characteristics and spatial characteristics of each pixel in the image, and capture the dependency between the characteristics at different points. The characteristics are optimized according to the dependency, and based on the optimized characteristics, the moisture content and spatial distribution in the coal are quickly and accurately detected to facilitate the subsequent evaluation of the coal quality.

[0005] In a first aspect, the present invention provides a method for analyzing the moisture content and spatial distribution of coal based on image spectrum.

[0006] A method for analyzing coal moisture content and spatial distribution based on image spectrum, comprising:

[0007] Obtaining visible light images and hyperspectral images of the coal to be tested;

[0008] Use the pre-trained image segmentation model to perform semantic segmentation on the visible light image and divide it into dry areas and water-containing areas;

[0009] Extract the hyperspectral data of each pixel in the hyperspectral image of the water-bearing area, use the sliding window to extract the spectral features of multiple bands in the hyperspectral data, and dynamically adjust the focus on the water-related spectral features through the attention mechanism to extract the spectral features of each pixel;

[0010] The spectral characteristics and spatial characteristics of each pixel in the water-bearing area are used as samples to construct a sample sequence of all pixels in the water-bearing area. The sample sequence is input into the Transformer model to extract the contextual features of each sample and output the feature matrix. The feature matrix is ​​pooled and then input into the least squares SVM model to output the water content corresponding to each pixel in the water-bearing area.

[0011] Graded color development is performed according to the moisture content of different pixel points to obtain the spatial distribution of coal moisture.

[0012] In a second aspect, the present invention provides a coal moisture content and spatial distribution analysis system based on image spectrum.

[0013] A coal moisture content and spatial distribution analysis system based on image spectrum, comprising:

[0014] A data acquisition module, used to obtain visible light images and hyperspectral images of the coal to be tested;

[0015] A region segmentation module is used to perform semantic segmentation on visible light images using a pre-trained image segmentation model, dividing them into dry areas and water-containing areas;

[0016] The spectral feature dynamic extraction module is used to extract the hyperspectral data of each pixel in the water-bearing area hyperspectral image, extract the spectral features of multiple bands in the hyperspectral data using a sliding window, and dynamically adjust the focus on the water-related spectral features through the attention mechanism to extract the spectral features of each pixel;

[0017] The moisture content analysis module is used to construct a sample sequence of all pixels in the water-containing area using the spectral characteristics and spatial characteristics of each pixel in the water-containing area as samples, input the sample sequence into the Transformer model, extract the contextual features of each sample, and output the feature matrix; after pooling the feature matrix, it is input into the least squares SVM model to output the moisture content corresponding to each pixel in the water-containing area;

[0018] The moisture spatial distribution acquisition module is used to perform graded color processing according to the moisture content of different pixel points to obtain the spatial distribution of coal moisture.

[0019] In a third aspect, the present invention further provides an electronic device comprising a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the steps of the method described in the first aspect are completed.

[0020] In a fourth aspect, the present invention further provides a computer-readable storage medium for storing computer instructions, which, when executed by a processor, complete the steps of the method described in the first aspect.

[0021] One or more of the above technical solutions have the following beneficial effects:

[0022] 1. The present invention provides a method and system for analyzing the moisture content and spatial distribution of coal based on image spectrum. The method uses image spectrum technology to process the spectral data and visible light image of coal, extracts the spectral characteristics and spatial characteristics of each pixel in the image, and captures the dependency between the characteristics at different points. The characteristics are optimized according to the dependency relationship. Based on the optimized characteristics, the moisture content and spatial distribution in the coal are quickly and accurately detected, which can be used as a reference standard for coal washing, classification, and trading, facilitating the subsequent evaluation of coal quality.

[0023] 2. In the present invention, semantic segmentation technology is first used to divide dry areas and water-containing areas according to visible light images. Then, for the pixel points containing water in the water-containing area, an attention mechanism is used to dynamically extract spectral features related to water. Then, a Transformer model based on a multi-head self-attention mechanism and a least squares support vector machine (SVM) model are used to analyze the dependency between spatial features and spectral features at different point positions, extract context features of each point, and output the corresponding water content based on the extracted features. Finally, different pixel points in the image are color-processed according to their different water contents, and a map is filled according to the comprehensive recognition results to obtain the spatial distribution of water in the coal. In this way, the accuracy of water content detection is improved, and the acquisition of the spatial distribution of water in the coal is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0025] Picture 1The present invention is a flowchart of a method for analyzing the moisture content and spatial distribution of coal based on image spectrum according to an embodiment of the present invention. DETAILED DESCRIPTION

[0026] It should be noted that the following detailed descriptions are exemplary only, are intended to describe specific embodiments, are intended to provide further explanation of the present invention, and are not intended to limit exemplary embodiments according to the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those of ordinary skill in the art to which the present invention belongs. In addition, it should also be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0027] Embodiment 1

[0028] This embodiment provides a method for analyzing the moisture content and spatial distribution of coal based on image spectrum. Picture 1 As shown, the specific steps include:

[0029] Step S1, obtaining a visible light image and a hyperspectral image of the coal to be tested;

[0030] Step S2: using a pre-trained image segmentation model to perform semantic segmentation on the visible light image and divide it into dry areas and water-containing areas;

[0031] Step S3, extracting the hyperspectral data of each pixel in the hyperspectral image of the water-bearing area, extracting the spectral features of multiple bands in the hyperspectral data using a sliding window, dynamically adjusting the focus on the water-related spectral features through an attention mechanism, and extracting the spectral features of each pixel;

[0032] Step S4: Taking the spectral characteristics and spatial characteristics of each pixel point in the water-bearing area as samples, constructing a sample sequence of all pixels in the water-bearing area, inputting the sample sequence into the Transformer model, extracting the context features of each sample, and outputting a feature matrix; after pooling, inputting the feature matrix into the least squares SVM model, and outputting the water content corresponding to each pixel point in the water-bearing area;

[0033] Step S5: Perform graded color development processing according to the moisture content of different pixel points to obtain the spatial distribution of coal moisture.

[0034] The following content introduces the coal moisture content and spatial distribution analysis method based on image spectrum proposed in this embodiment in more detail.

[0035] In step S1, the coal to be tested is placed on a coal scanning platform to obtain a hyperspectral image and a visible light image of the coal to be tested.

[0036] In step S2, a pre-trained image segmentation model is used to perform semantic segmentation on the visible light image and divide it into a dry area and a water-containing area.

[0037] In this embodiment, a U-Net-based image segmentation model is built and pre-trained, and the model is used to perform pixel-level semantic segmentation on the visible light image of the coal to be tested, and the dry area and water-containing area of ​​the coal to be tested are preliminarily identified. The training process of the U-Net-based image segmentation model includes:

[0038] Step S2.1, data preparation stage. First, collect visible light images of coal with different moisture contents, build a data set, and ensure that the data set contains enough sample images to represent and distinguish the two areas; second, use image annotation tools to annotate the collected visible light images, create a label map (mask), and mark each pixel in the image as a dry area or a water-containing area. The moisture content of each pixel in the dry area is 0.

[0039] Step S2.2, preprocessing stage. First, perform data enhancement preprocessing on the images in the data set, and enhance the data set by rotating, flipping, cropping, adjusting brightness, etc. to improve the generalization ability of the model; secondly, perform standardization on the enhanced image data, and normalize the pixel values ​​of the image to the range of [0,1] to facilitate model training. Preferably, the data set is divided into a training set and a validation set, and the model is trained using the training set, and the trained model is validated using the validation set.

[0040] Step S2.3: Build an image segmentation model based on U-Net, which includes an encoder and a decoder. The encoder consists of multiple convolutional layers and pooling layers connected in sequence. It extracts the features of the input image through downsampling convolution and gradually reduces the spatial dimension. The formula is:

[0041] ;

[0042] Among them, X represents the input image, W represents the weight, b Indicates the deviation value, is the ReLU activation function, and Y represents the extracted image features.

[0043] Afterwards, the decoder gradually restores the spatial dimensions of the image through multiple upsampling convolutional layers, and outputs a prediction map of the same size as the input image, where each pixel corresponds to a prediction result or prediction category.

[0044] Step S2.4: Use the training set to train the model, construct a cross entropy loss function, use the loss function to evaluate the difference between the predicted category and the true label, and use the Adam optimizer to optimize the training process. The above loss function formula is:

[0045] ;

[0046] in, N Indicates the number of samples, that is, the number of pixels, c Indicates the number of categories. In this embodiment, the categories are dry area ( c =1) and water-bearing area ( c =2), represents the true label, Represents the prediction result.

[0047] Step S2.5: Use the validation set to evaluate the model performance, visually compare the model output with the true label, and check the segmentation effect of the model.

[0048] Based on the trained image segmentation model mentioned above, the model is applied to the visible light image of the coal to be tested to generate segmentation results to assist in analyzing areas with different moisture contents.

[0049] By using the U-Net semantic segmentation model to divide the moisture content area, each pixel in the image can be classified, thereby achieving high-precision area division. Moreover, the U-Net model can process images of different types and complexities, has strong adaptability, and can provide intuitive visualization effects. After semantic segmentation processing, the feature information is retained, which is convenient for subsequent processing.

[0050] Furthermore, considering that coal with different moisture contents has different characteristics, the dry areas and water-containing areas of the coal will show relatively obvious different texture features, which can be preliminarily identified through visible light images. For the water-containing area, although the area can be preliminarily identified, the further division and calculation of the moisture content of the area is difficult to achieve a good division effect only through image recognition or image segmentation technology due to the small differences between the areas. For this reason, this embodiment introduces hyperspectral data on the basis of preliminary identification of water-containing areas by image segmentation, and uses the hyperspectral data to perform a more detailed and accurate calculation of the moisture content of the coal water-containing area.

[0051] In step S3, the hyperspectral data of each pixel in the hyperspectral image of the water-bearing area is extracted, and the spectral features of multiple bands are extracted from the hyperspectral data using a sliding window. The attention mechanism dynamically adjusts the focus on the water-related spectral features to extract the spectral features of each pixel.

[0052] Furthermore, considering that the attention mechanism can automatically adjust the weights of different features so that the model pays more attention to important features, in this embodiment, an attention module is constructed, and multiple spectral features of each pixel point extracted are input into the attention module. The attention mechanism is used to analyze the correlation between each feature and the moisture content. The higher the correlation, the higher the importance. In this way, the degree of attention to the spectral features related to moisture is dynamically adjusted, that is, the weights of these features are adjusted to make the extracted spectral features more relevant to the moisture content. This can reduce the complexity and cost of data processing while ensuring the accuracy of the final moisture content calculation.

[0053] Step S3.1, extract the hyperspectral data of each pixel in the water-bearing area hyperspectral image, and use the sliding window to extract the spectral features of multiple bands in the hyperspectral data, that is, use the sliding window method, select a rectangular sliding window of set size and side length, and move smoothly on the hyperspectral data of the pixel with a set step length, extract the spectral features from the spectral data of each window, and then extract multiple spectral features. Preferably, the spectral feature can be an average value or peak value of the spectral intensity.

[0054] Through the above method, multiple spectral features of each pixel are extracted from the hyperspectral image to form a spectral feature matrix X ,in , N Indicates the number of pixels, M It represents the number of spectral bands extracted by the sliding window, which is the number of spectral features.

[0055] Step S3.2: preliminarily select a band range index related to moisture. In this embodiment, it is preliminarily determined that the spectral features related to moisture are mainly around the 1400nm and 1900nm band ranges.

[0056] Step S3.3: Input the spectral feature matrix into the attention module, use the attention mechanism, and calculate the attention weight through a feedforward neural network or convolution layer. A , the formula is:

[0057] ;

[0058] in, represents the weight matrix, Indicates bias.

[0059] In the above process, the initial weight matrix is ​​first constructed according to the band preliminarily selected in step S3.2. Then, during the training process of the attention module, the weight matrix is ​​continuously and dynamically adjusted to give greater weights to the spectral features related to moisture, so as to determine a more accurate band range and obtain the spectral features most relevant to moisture, thereby ensuring the accuracy of the final moisture calculation.

[0060] Step S3.4: Use the attention weight to weight the spectral feature matrix to obtain the weighted feature is a feature related to moisture. The moisture-related spectral features are weighted, and the formula is:

[0061] ;

[0062] in, Represents element-wise multiplication.

[0063] In step S4, the spectral characteristics and spatial characteristics of each pixel in the water-containing area are used as samples to construct a sample sequence of all pixels in the water-containing area. The sample sequence is input into the Transformer model, the context features of each sample are extracted, and the feature matrix is ​​output. The feature matrix is ​​pooled and then input into the least squares SVM model to output the water content corresponding to each pixel in the water-containing area.

[0064] Specifically, firstly, for all the pixels containing water in the image (i.e., the points in the water-containing area), the acquired spectral data is formatted into a format suitable for the input of the Transformer model, and the spatial features (i.e., the location information of the current point) are combined as the input samples of the Transformer, so as to construct a sample sequence of all the pixels in the water-containing area as the input sample sequence of the Transformer; secondly, the sample sequence based on spatial features and spectral features is input into the Transformer model to extract global semantic information. The Transformer model includes a multi-head self-attention module MHSA and a feedforward network. The attention module is obtained by splicing multiple self-attention modules. The sample sequence passes through the multi-head self-attention module in the Transformer model, and takes the feature vector of all samples in the sample sequence after dimension transformation as input. The sample features at different positions in the input sample sequence are captured, and the self-attention weights between the sample features at each position and the sample features at other positions are calculated. The weighted features of the sample features at each position, that is, the context features, are extracted, and the context feature matrix of the sample sequence is output. After that, it passes through the feedforward network (FF network) to further enhance the expression ability and adaptability of the model through nonlinear transformation. The feature matrix is ​​then input into the subsequent fully connected layer for subsequent tasks.

[0065] In this embodiment, the self-attention module in the Transformer model can calculate the self-attention representation of each position based on the information between different positions in the input sequence, thereby capturing the dependency between different positions in the sequence, specifically including:

[0066] For a sequence containing multiple samples, the self-attention weight consists of three parts: the query matrix, the key matrix, and the value matrix, each of which contains the weights of each sample in the sequence. The corresponding query vector , key vector and a numeric vector The self-attention module in the MHSA module connects the current position sample of the input sequence with the context-related samples. Specifically, for each position in the input sequence i Samples on , according to its dimensionally transformed feature vector Calculate a query vector , a key vector and a numeric vector , calculated as:

[0067] ;

[0068] in, Indicates i samples, are weight matrices consisting of learnable parameters.

[0069] based on The self-attention weight between the sample at this position and the samples at other positions can be calculated, and then the weighted feature vector can be calculated. The feature vector is the self-attention representation of the position, and the calculation formula is:

[0070] ;

[0071] The calculation process of the above formula is: first calculate and To prevent the calculation result from overflowing, divide by To scale, Representation vector The dimension is then normalized using the Softmax function to obtain the position i With location j (i.e. i and j samples), and then the vector By performing weighted summation, we can get the feature vector after applying the self-attention mechanism , and thus obtain the eigenvector matrix , which is the self-attention weight matrix. The calculation formula of the Softmax(·) operation is: .

[0072] As another embodiment, in fact, usually directly processing The matrix Q, K, V composed of the above matrix, calculates the eigenvector matrix, which is: .

[0073] In actual calculation, firstly, the samples in the input sequence are Merge into a matrix , and The randomly initialized weight matrices are the same as the three dimensions , , Multiply them to get matrices Q, K, and V, and then use the above formula to calculate the final self-attention weight matrix And output.

[0074] Furthermore, on this basis, a multi-head self-attention module can be constructed, which is composed of multiple self-attention modules. Each self-attention module has a corresponding weight matrix Q, K, V to achieve different linear transformations, thereby expanding the model's ability to pay attention to information at different positions in the sequence. The attention weights are calculated by inputting the linear layer matrix to form a complete feature matrix.

[0075] After the feature matrix is ​​output through the Transformer model, the feature matrix is ​​converted into a feature vector through pooling operation, and then the feature vector is used as the input feature and input into the constructed least squares support vector machine (SVM) model to simplify the data structure and complete the water content test.

[0076] Furthermore, the training process of the above-mentioned attention module, Transformer model and least squares SVM model is as follows: using the coal hyperspectral image with the moisture content of each pixel point in the water-containing area marked as the training sample, obtaining multiple training samples and extracting the spectral characteristics and spatial characteristics of each pixel point in each training sample to construct a training data set; using the training data set to train the attention module, Transformer model and least squares SVM model.

[0077] In the process of training the least squares SVM model, the mapping relationship between water content and features is learned, a mapping function is constructed, and the unknown parameters in the mapping function are optimized and determined through continuous iterative training to complete the training of the least squares SVM model. The above mapping function is the water content prediction function. In the process of constructing the mapping function, the mapping relationship is described as a regression problem, and the regression problem is converted into a constrained optimization problem. The constrained optimization problem is solved by introducing the Lagrange equation and the kernel function.

[0078] Specifically, a least squares support vector machine model is established using the sample water content and the feature matrix output in the previous step to obtain a mapping relationship between the water content and the feature matrix.

[0079] Given a data sample , As the sample i Input quantity (the That is, the characteristic values ​​of the spectrum and image), yes The corresponding output is the sample water content, and the regression expression of the model is:

[0080] ;

[0081] In the formula, is a nonlinear mapping function, b is the deviation value, is the weight vector value.

[0082] To determine the model parameters , b , selection error As the loss function, the regression problem is transformed into a constrained optimization problem:

[0083] ;

[0084] The constraints are: , i=1,2,...,N .

[0085] In the above formula, C is the regularization parameter, C>0, e is the prediction error variable on the sample data set, y To consider the constraints of the deviation value and loss function.

[0086] In order to find the optimal solution, the Lagrange equation is introduced to transform the above function into:

[0087] ;

[0088] In the formula, a is the Lagrange multiplier.

[0089] Based on the above function L For variables , b, e, a Taking the derivative, we get the following system of equations:

[0090] ;

[0091] Solving the above linear equation, we get:

[0092] ;

[0093] ;

[0094] Where P is the kernel function, b is the deviation value.

[0095] The least squares support vector machine moisture content prediction function can finally be expressed as:

[0096] .

[0097] In this embodiment, radial basis function is selected As the kernel function of the prediction model, the kernel parameters need to be determined The two unknown parameters in the mapping function are optimized and determined through continuous iterative training, and the inverse form of the root mean square error is used as the evaluation function to complete the training of the least squares SVM model. The least squares SVM model completed through this training can directly output the water content.

[0098] In step S5, graded color development is performed according to the moisture content of different pixel points to obtain the spatial distribution of coal moisture.

[0099] Specifically, for different pixel points of coal, color development is performed according to different moisture contents: the moisture content of coal is divided into an interval from low to high every set value (10% is used in this embodiment) from 0% to 60%, and the moisture content of coal is divided into 6 intervals, and a legend is set, and different intervals are represented by different colors. After that, the map is filled according to the comprehensive identification of the moisture content of the coal, that is, the corresponding color development and mapping are performed according to the interval where the moisture content of different pixel points is located, and the spatial distribution of the moisture content of the coal is obtained.

[0100] Embodiment 2

[0101] This embodiment provides a coal moisture content and spatial distribution analysis system based on image spectrum, including:

[0102] A data acquisition module, used to obtain visible light images and hyperspectral images of the coal to be tested;

[0103] A region segmentation module is used to perform semantic segmentation on visible light images using a pre-trained image segmentation model, dividing them into dry areas and water-containing areas;

[0104] The spectral feature dynamic extraction module is used to extract the hyperspectral data of each pixel in the water-bearing area hyperspectral image, extract the spectral features of multiple bands in the hyperspectral data using a sliding window, and dynamically adjust the focus on the water-related spectral features through the attention mechanism to extract the spectral features of each pixel;

[0105] The moisture content analysis module is used to construct a sample sequence of all pixels in the water-containing area using the spectral characteristics and spatial characteristics of each pixel in the water-containing area as samples, input the sample sequence into the Transformer model, extract the contextual features of each sample, and output the feature matrix; after pooling the feature matrix, it is input into the least squares SVM model to output the moisture content corresponding to each pixel in the water-containing area;

[0106] The moisture spatial distribution acquisition module is used to perform graded color processing according to the moisture content of different pixel points to obtain the spatial distribution of coal moisture.

[0107] Embodiment 3

[0108] This embodiment provides an electronic device, including a memory and a processor, and computer instructions stored in the memory and running on the processor. When the computer instructions are run by the processor, the steps in the coal moisture content and spatial distribution analysis method based on image spectrum as described above are completed.

[0109] Embodiment 4

[0110] This embodiment also provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the steps in the coal moisture content and spatial distribution analysis method based on image spectrum as described above are completed.

[0111] The steps involved in the above embodiments 2 to 4 correspond to the method embodiment 1, and the specific implementation methods can refer to the relevant description part of embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood to include any medium that can store, encode or carry an instruction set for execution by a processor and enable the processor to execute any method in the present invention.

[0112] Those skilled in the art should understand that the modules or steps of the present invention described above can be implemented by a general-purpose computer device, or alternatively, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. The present invention is not limited to any specific combination of hardware and software.

[0113] The above description is only a preferred embodiment of the present invention. Although the specific implementation mode of the present invention is described in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that on the basis of the technical solution of the present invention, various modifications or variations that can be made by those skilled in the art without creative work are still within the scope of protection of the present invention.

Claims

1. A method for analyzing coal moisture content and spatial distribution based on image spectrum, characterized in that: include: Obtaining visible light images and hyperspectral images of the coal to be tested; Use the pre-trained image segmentation model to perform semantic segmentation on the visible light image and divide it into dry areas and water-containing areas; Extract the hyperspectral data of each pixel in the hyperspectral image of the water-bearing area, use the sliding window to extract the spectral features of multiple bands in the hyperspectral data, dynamically adjust the attention to the water-related spectral features through the attention mechanism, and extract the spectral features of each pixel; wherein, dynamically adjust the attention to the water-related spectral features through the attention mechanism, and extract the spectral features of each pixel, including: Preliminarily select the band range related to moisture and construct the initial weight matrix; Extract multiple spectral features of each pixel from the hyperspectral image to form a spectral feature matrix, and input the spectral feature matrix into the attention module. Use the attention mechanism and the initial weight matrix to calculate the attention weight. Use the attention weight to weight the spectral feature matrix to obtain the weighted spectral feature as the spectral feature related to moisture. Through training, the weight matrix is ​​continuously and dynamically adjusted, that is, the weights of the spectral features related to moisture are adjusted to determine a more accurate band range, and finally the spectral features most related to moisture are obtained; The spectral characteristics and spatial characteristics of each pixel in the water-bearing area are used as samples to construct a sample sequence of all pixels in the water-bearing area. The sample sequence is input into the Transformer model to extract the contextual features of each sample and output the feature matrix. The feature matrix is ​​pooled and then input into the least squares SVM model to output the water content corresponding to each pixel in the water-bearing area. Among them, the coal hyperspectral image with the moisture content of each pixel point in the water-bearing area marked is used as the training sample, multiple training samples are obtained and the spectral characteristics and spatial characteristics of each pixel point in each training sample are extracted to construct the training data set; Use the training dataset to train the attention module, Transformer model, and least squares SVM model; The Transformer model includes a multi-head self-attention module and a feedforward network, and the multi-head self-attention module is obtained by splicing multiple self-attention modules; the sample sequence is input into the Transformer model, and firstly, the multi-head self-attention module is used to capture the sample features at different positions in the input sample sequence, and the self-attention weights between the sample features at each position and the sample features at other positions are calculated, and the weighted features of the sample features at each position are extracted, that is, the context features are extracted, and the context feature matrix of the sample sequence is output; then, the feature matrix is ​​output after the feedforward network is passed through a nonlinear transformation; In the process of training the least squares SVM model, the mapping relationship between water content and features is learned, a mapping function is constructed, and the unknown parameters in the mapping function are optimized and determined through continuous iterative training to complete the training of the least squares SVM model; The mapping function is a water content prediction function. In the process of constructing the mapping function, the mapping relationship is described as a regression problem, and the regression problem is converted into a constrained optimization problem. The constrained optimization problem is solved by introducing the Lagrange equation and the kernel function. Graded color development is performed according to the moisture content of different pixel points to obtain the spatial distribution of coal moisture.

2. The method for analyzing the moisture content and spatial distribution of coal based on image spectrum according to claim 1, characterized in that: The spectral features of multiple bands are extracted from the hyperspectral data using a sliding window, including: using a sliding window method, selecting a rectangular sliding window of set size and side length, moving smoothly with a set step length on the hyperspectral data of the current pixel point, extracting spectral features from the spectral data of each window, thereby extracting multiple spectral features; the spectral features use the average value or peak value of the spectral intensity.

3. The method for analyzing the moisture content and spatial distribution of coal based on image spectrum according to claim 1, characterized in that: The graded color processing refers to dividing the moisture content of coal into an interval from low to high at every set value, dividing the moisture content of coal into multiple intervals and each interval corresponds to a color, and performing corresponding color processing according to the interval in which the moisture content of different pixel points is obtained.

4. A coal moisture content and spatial distribution analysis system based on image spectrum, characterized in that: include: A data acquisition module, used to obtain visible light images and hyperspectral images of the coal to be tested; A region segmentation module is used to perform semantic segmentation on visible light images using a pre-trained image segmentation model, dividing them into dry areas and water-containing areas; The spectral feature dynamic extraction module is used to extract the hyperspectral data of each pixel in the water-bearing area hyperspectral image, extract the spectral features of multiple bands in the hyperspectral data using a sliding window, and dynamically adjust the attention to the water-related spectral features through the attention mechanism to extract the spectral features of each pixel; wherein, the attention mechanism dynamically adjusts the attention to the water-related spectral features to extract the spectral features of each pixel, including: Preliminarily select the band range related to moisture and construct the initial weight matrix; Extract multiple spectral features of each pixel from the hyperspectral image to form a spectral feature matrix, and input the spectral feature matrix into the attention module. Use the attention mechanism and the initial weight matrix to calculate the attention weight. Use the attention weight to weight the spectral feature matrix to obtain the weighted spectral feature as the spectral feature related to moisture. Through training, the weight matrix is ​​continuously and dynamically adjusted, that is, the weights of the spectral features related to moisture are adjusted to determine a more accurate band range, and finally the spectral features most related to moisture are obtained; The moisture content analysis module is used to construct a sample sequence of all pixels in the water-containing area using the spectral characteristics and spatial characteristics of each pixel in the water-containing area as samples, input the sample sequence into the Transformer model, extract the contextual features of each sample, and output the feature matrix; after pooling the feature matrix, it is input into the least squares SVM model to output the moisture content corresponding to each pixel in the water-containing area; Among them, the coal hyperspectral image with the moisture content of each pixel point in the water-bearing area marked is used as the training sample, multiple training samples are obtained and the spectral characteristics and spatial characteristics of each pixel point in each training sample are extracted to construct the training data set; Use the training dataset to train the attention module, Transformer model, and least squares SVM model; The Transformer model includes a multi-head self-attention module and a feedforward network, and the multi-head self-attention module is obtained by splicing multiple self-attention modules; the sample sequence is input into the Transformer model, and firstly, the multi-head self-attention module is used to capture the sample features at different positions in the input sample sequence, and the self-attention weights between the sample features at each position and the sample features at other positions are calculated, and the weighted features of the sample features at each position are extracted, that is, the context features are extracted, and the context feature matrix of the sample sequence is output; then, the feature matrix is ​​output after the feedforward network is passed through a nonlinear transformation; In the process of training the least squares SVM model, the mapping relationship between water content and features is learned, a mapping function is constructed, and the unknown parameters in the mapping function are optimized and determined through continuous iterative training to complete the training of the least squares SVM model; The mapping function is a water content prediction function. In the process of constructing the mapping function, the mapping relationship is described as a regression problem, and the regression problem is converted into a constrained optimization problem. The constrained optimization problem is solved by introducing the Lagrange equation and the kernel function. The moisture spatial distribution acquisition module is used to perform graded color processing according to the moisture content of different pixel points to obtain the spatial distribution of coal moisture.

5. The coal moisture content and spatial distribution analysis system based on image spectrum according to claim 4, characterized in that: The spectral features of multiple bands are extracted from the hyperspectral data using a sliding window, including: using a sliding window method, selecting a rectangular sliding window of set size and side length, moving smoothly with a set step length on the hyperspectral data of the current pixel point, extracting spectral features from the spectral data of each window, thereby extracting multiple spectral features; the spectral features use the average value or peak value of the spectral intensity.

6. An electronic device, characterized in that: The method comprises a memory and a processor and computer instructions stored in the memory and executed on the processor. When the computer instructions are executed by the processor, the steps of a method for analyzing the moisture content and spatial distribution of coal based on image spectrum as described in any one of claims 1 to 3 are completed.

7. A computer-readable storage medium, characterized in that: Used to store computer instructions, which, when executed by a processor, complete the steps of a method for analyzing coal moisture content and spatial distribution based on image spectrum as described in any one of claims 1-3.

Citation Information

Patent Citations

  • Single corn seed moisture content detection method based on near infrared hyperspectrum

    CN113049530A

  • Hyperspectral image classification method based on attention mechanism and generative adversarial network

    CN113128471A