A hyperspectral reconstruction method based on attention mechanism and dense network and a storage medium
Through a method based on attention mechanism and dense network, the problems of expensive hyperspectral image acquisition equipment and insufficient reconstruction algorithm performance are solved, efficient mapping and reconstruction of RGB images to hyperspectral images are achieved, and the reconstruction performance and accuracy are improved.
Patent Information
- Application Number
- CN202310137833.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-20
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2043-02-20
AI Technical Summary
Existing hyperspectral image acquisition equipment is expensive and difficult to quickly acquire images with both high spatial resolution and high spectral resolution. Traditional and CNN-based spectral reconstruction methods ignore the differences in feature information and channel dimensions, limiting reconstruction performance.
A method based on attention mechanism and dense network is adopted. The dense attention module focuses on the spatial information and channel information of the features, and the dense blocks are combined for feature extraction and reconstruction. The loss function is used to optimize the network weights to achieve end-to-end mapping from RGB images to hyperspectral images.
The accuracy and performance of hyperspectral image reconstruction are improved, the expression ability of CNN is enhanced, the shortcomings of the reconstruction algorithm in the existing methods are overcome, and efficient spectral reconstruction is achieved.
Smart Images

Figure CN116363028B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of hyperspectral image acquisition, and particularly relates to a hyperspectral reconstruction method based on an attention mechanism and a dense network and a storage medium. BACKGROUND
[0002] Hyperspectral images contain image information of hundreds of bands, and have wide applications in remote sensing, medical diagnosis, material detection, food inspection and agricultural production. However, traditional hyperspectral image acquisition devices are expensive and complex in design, and it is difficult to quickly acquire hyperspectral images with high spatial resolution and high spectral resolution, which greatly limits the application and development of hyperspectral images. In recent years, it has become a research hotspot to use RGB images to reconstruct hyperspectral images with high spatial resolution and high spectral resolution, because RGB images are easy to obtain and have high spatial resolution.
[0003] Existing spectral reconstruction methods can be roughly divided into two categories: traditional methods and deep learning-based methods. Traditional methods learn the three-to-many mapping relationship from RGB images to hyperspectral images through sparse recovery, low-rank tensor recovery and some shallow mapping models. However, these methods often need to rely on various prior information of hyperspectral data, and their generalization ability is poor. With the continuous development of deep learning theory and technology, the technology of reconstructing hyperspectral images from RGB images based on deep learning has made great progress. Spectral reconstruction methods based on convolutional neural networks (CNN) have been widely used. Although the CNN-based method to some extent makes up for the shortcomings of traditional methods and significantly improves the accuracy of spectral reconstruction, there are still some defects: on the one hand, most existing CNN-based hyperspectral reconstruction models ignore the fact that different feature information has different contributions, thus limiting the expression ability of CNN; on the other hand, CNN-based hyperspectral reconstruction models mainly focus on the scale information of features, and pay little attention to the channel dimension, thus limiting the reconstruction performance of the spectral reconstruction algorithm to some extent. SUMMARY
[0004] The purpose of the present application is to provide a hyperspectral reconstruction method based on an attention mechanism and a dense network, which is based on a dense attention module, can focus on the spatial information and channel information of features, effectively extract features, improve the gradient problem, can simultaneously focus on the channel information and spectral information, and different features are reconstructed by different fusion.
[0005] To achieve the above purpose, the present application provides the following technical solutions:
[0006] A hyperspectral reconstruction method based on an attention mechanism and a dense network is provided, comprising the following steps,
[0007] S1, inputting an original RGB image into a shallow feature extraction module, the original RGB image having a size of 3xWxH, wherein W represents a width of the image and H represents a height of the image, performing shallow feature extraction on the original RGB image, and outputting a feature image T1 having a size of 128xWxH;
[0008] S2, inputting the feature image T1 into a deep feature extraction module, fusing spatial information, channel information and spectrum of the feature image T1, and outputting a feature image T2 having a size of 896xWxH, wherein the deep feature extraction module is composed of a plurality of dense attention module connections, and each dense attention module is composed of an attention module and a dense module;
[0009] S3, inputting the feature image T2 into a spectral feature reconstruction module, reconstructing the feature image T2, and outputting a hyperspectral image T3 having a size of 31xWxH;
[0010] S4, according to a loss function definition, obtaining real hyperspectral image data G through a training data set, calculating an error between the real hyperspectral image data G and the reconstructed hyperspectral image T3, and optimizing weights of a hyperspectral reconstruction network based on gradient descent and back propagation.
[0011] In some embodiments, in step S1, the step of performing shallow feature extraction on the original RGB image is: passing the input original RGB image through a Conv convolution and a ReLU activation, the Conv convolution having a kernel size of 1x1, a convolution step of 1, a padding of 0, and a feature mapping number of 128, to obtain a feature image T1 of shallow feature extraction.
[0012] In some embodiments, in step S2, the deep feature extraction module is composed of 10 dense attention module connections.
[0013] The input of the first dense attention module is a feature T1 having a size of C n xWxH, C n represents a channel number of an input of the nth dense attention module, C n = 128 + 64x(n-1).
[0014] The input of the attention module and the dense module in each dense attention module is C n xWxH, and the output of the attention module and the dense module is 32xWxH.
[0015] In some embodiments, the structure of the nth dense attention module is: taking a feature image having a size of C n xWxH as an input I n, the attention module outputs a 32×W×H feature A n , the dense module outputs 32×W×H feature D n , will I n 、A n and D n The connection is of size C n ×W×H characteristic M n After Conv convolution and ReLU activation, the size is C n+1 ×W×H output features O n , the convolution kernel size of this Conv is 1×1, the stride is 1, and the padding is 0.
[0016] In some embodiments, each attention module is composed of a spatial attention module and a channel attention module;
[0017] The input I of the attention module of the nth dense attention module n Size C n ×W×H, after Conv convolution and ReLU activation, the intermediate feature E is obtained n , size C n ×W×H, as the input of the channel attention module;
[0018] Output CA of the channel attention module n and E n Multiply to get the intermediate feature F n , of size 32×W×H, as the input of the spatial attention module;
[0019] The output SA of the spatial attention module n and F n After multiplication and ReLU activation, we get the output A of the attention module n , size is 32×W×H.
[0020] In some embodiments, each channel attention module consists of an AVG module, a MAX module, and an MLP module.
[0021] The AVG module outputs an intermediate result AVG of size 32×1×1 res , the MAX module outputs the intermediate result MAX of size 32×1×1 res ,
[0022] The MLP module is composed of a Conv, a ReLU and a Conv. The convolution kernel size of the Conv is 1×1, the step size is 1, and the padding is 0. The MLP converts AVG res and MAX resAs input, and add the output results, after Sigmoid activation, get the output CA of channel attention module n ;
[0023] Each spatial attention module also contains an AVG module and a MAX module,
[0024] AVG module output size is 1 × W × H intermediate results AVG res , MAX module output size is 1 × W × H intermediate results MAX res ,
[0025] AVG res and MAX res After the connection operation, Cat res , size is 2 × W × H, Cat res After Conv convolution and Sigmoid activation, the output SA of spatial attention module is obtained n , size is 2 × W × H, wherein the convolution kernel size of Conv is 1 × 1, the step is 1, and the padding is 0.
[0026] In some embodiments, each dense module contains two identical parallel convolution sequences, each of which is first subjected to Conv convolution and ReLU activation to obtain intermediate feature E n , the convolution kernel size of Conv is 3 × 3, the step is 1, the padding is 1, and the feature mapping number is 32;
[0027] Intermediate feature E n After Conv convolution and ReLU activation, intermediate feature F n is obtained, the convolution kernel size of Conv is 1 × 1, the step is 1, the padding is 0, and the feature mapping number is 16;
[0028] The two identical convolution sequences generate four intermediate features, which are connected to obtain intermediate feature Cat res , size is 96 × W × H;
[0029] Cat res After Conv convolution and ReLU activation, the output D of dense block is obtained n , size is 96 × W × H, the convolution kernel size of Conv is 1 × 1, the step is 1, the padding is 0, and the feature mapping number is 32.
[0030] In some embodiments, in step S3, the spectral feature reorganization module is composed of a Conv convolution layer, the convolution kernel size of Conv is 1 × 1, the step is 1, the padding is 0, and the feature mapping number is 31.
[0031] In some embodiments, 9. The hyperspectral reconstruction method based on attention mechanism and dense network according to claim 1, wherein in step S4, the training data set is obtained by downloading a public data set from a website or establishing a data set, including collecting hyperspectral data using a hyperspectral imaging device and synthesizing an RGB image according to a response function, wherein each group of data in the data set contains an RGB image and a hyperspectral data, and the data set is divided into the training data set, a validation data set and a test data set.
[0032] A real hyperspectral image is obtained through the training data set, an RGB image is used as input, and a reconstructed hyperspectral image data is generated by using the hyperspectral reconstruction network.
[0033] An error between the real hyperspectral image data and the generated hyperspectral image data is calculated according to a loss function, and an optimization algorithm is used to continuously optimize the hyperspectral reconstruction network.
[0034] The hyperspectral reconstruction method based on attention mechanism and dense network has the following advantages:
[0035] The hyperspectral reconstruction method based on attention mechanism and dense network accurately realizes end-to-end mapping of an RGB image to a hyperspectral image, is based on an attention mechanism and a dense block, simultaneously pays attention to spatial information and channel information of features, adaptively learns spatial and channel features, and thus increases feature expression capability of the network. The features are effectively extracted by using the dense block, a gradient problem is improved, and thus reconstruction effect is improved, the problem that the prior art cannot simultaneously pay attention to channel information and spectral information is overcome, the problem that fusion of different features has the same effect on reconstruction is overcome, expression capability of the CNN is effectively improved, and reconstruction performance of the CNN spectral reconstruction algorithm is improved.
[0036] A storage medium is also provided, and program code is stored on the storage medium, and the program code is executed by a processor to implement the hyperspectral reconstruction method based on the attention mechanism and the dense network. BRIEF DESCRIPTION OF DRAWINGS
[0037] Figure 1 is a flowchart of the embodiment method.
[0038] Figure 2 is a structural flowchart of a shallow feature extraction module constructed by the embodiment method.
[0039] Figure 3 is a structural flowchart of a dense attention module of a deep feature extraction module constructed by the embodiment method.
[0040] Figure 4is a structural flowchart of an attention module of a dense attention module of a deep feature extraction module constructed by the embodiment method.
[0041] Figure 5 is a structural flowchart of a channel attention module of an attention module of a dense attention module of a deep feature extraction module constructed by the embodiment method.
[0042] Figure 6 is a structural flowchart of a spatial attention module of an attention module of a dense attention module of a deep feature extraction module constructed by the embodiment method.
[0043] Figure 7 is a structural flowchart of a dense block of a dense attention module of a deep feature extraction module constructed by the embodiment method.
[0044] Figure 8 is a structural flowchart of a spectral feature reorganization module constructed by the embodiment method. DETAILED DESCRIPTION
[0045] Preferred embodiments of the present application will be described herein below with reference to the accompanying drawings. While the preferred embodiments of the present application are shown in the drawings, it is understood that the present application can be embodied in various forms without being limited by the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the application to those skilled in the art.
[0046] The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0047] It is to be understood that the singular forms "a", "an", and "the" include plural referents unless the context clearly dictates otherwise. It is to be understood that the term "and / or" as used herein encompasses all possible combinations of one or more of the associated listed items and can be abbreviated as "or".
[0048] Example 1
[0049] Reference Figure 1The method disclosed in the embodiment is a hyperspectral reconstruction network based on an attention mechanism and a dense network (hereinafter referred to as a spectral reconstruction network), which is composed of a shallow feature extraction module, a deep feature extraction module and a spectral feature reconstruction module. The shallow feature is directly inputted with an original RGB image, and a Conv convolution and a ReLU activation are used to extract the shallow feature and realize up-sampling operation on the RGB image in the channel dimension. The deep feature extraction module is exemplarily connected by 10 dense attention modules, which realize dense connection of spatial features and channel features by fusing a spatial attention module, a channel attention module and a dense module, and obtain deep hyperspectral related features. The spectral reconstruction module is used to down-sample the hyperspectral features to 31-dimensional hyperspectral image data.
[0050] The hyperspectral reconstruction method based on the attention mechanism and the dense network in the embodiment utilizes the spectral reconstruction network framework, and is specifically implemented in the following steps:
[0051] S1, constructing a shallow feature extraction module: inputting an original RGB image into the shallow feature extraction module, wherein the size of the original RGB image is 3xWxH, W represents the width of the image, H represents the height of the image, shallow feature extraction is performed on the original RGB image, and a feature image T1 is outputted, wherein the size of the feature image T1 is 128xWxH.
[0052] Referring to Figure 2 The structure of the shallow feature extraction module is that the original RGB image is inputted as an input image, a Conv convolution and a ReLU activation are used to output a feature image T1, the Conv convolution is used to extract shallow feature information and realize up-sampling operation on the channel, the Conv convolution kernel size is 1x1, the convolution step is 1, the padding is 0, and the feature mapping number is 128.
[0053] S2, constructing a deep feature extraction module: inputting the feature image T1 into the deep feature extraction module, fusing spatial information, channel information and spectrum of the feature image T1, and outputting a feature image T2, wherein the size of the feature image T2 is 896xWxH, the deep feature extraction module is composed of a plurality of dense attention modules connected, and each dense attention module is composed of an attention module and a dense module.
[0054] Referring to Figure 1 The deep feature extraction module is connected by 10 dense attention modules.
[0055] Referring to Figure 3Each dense attention module is composed of an attention module and a dense module. The attention module and the dense module of each dense attention module are processed in parallel, the attention module extracts spatial and channel features, the dense module extracts scale features, and the output features are obtained after connection operation by Cat, Conv convolution and ReLU activation. The input of the first dense attention module is the feature T1, and the size is C n ×W×H(C n represents the number of channels of the input of the nth dense attention module, C n =128+64×(n-1)). The input of the (n+1)th dense attention module is the output of the nth dense attention module.
[0056] Referring to Figure 4 , each attention module is composed of a spatial attention module and a channel attention module. The input I n of the attention module of the nth dense attention module has a size of C n ×W×H, and after Conv convolution and ReLU activation, an intermediate feature E n with a size of C n ×W×H is obtained as the input of the channel attention module. The output CA n of the channel attention module is multiplied by E n to obtain an intermediate feature F n with a size of 32×W×H as the input of the spatial attention module. The output SA n of the spatial attention module is multiplied by F n after ReLU activation to obtain the output A n of the attention module with a size of 32×W×H.
[0057] Referring to Figure 5 , each channel attention module is composed of an AVG module, a MAX module and an MLP module. The AVG module outputs an intermediate result AVG res with a size of 32×1×1, and the MAX module outputs an intermediate result MAX res with a size of 32×1×1. The MLP module is connected by a Conv, a ReLU and a Conv, the convolution kernel size of the Conv is 1×1, the step is 1, and the padding is 0. The MLP takes AVG res and MAX res as inputs, respectively, adds the output results, and obtains the output CA n of the channel attention module after Sigmoid activation.
[0058] Referring to Figure 6Each spatial attention module also contains an AVG module and a MAX module. The AVG module outputs an intermediate result AVG of size 1xWxH res The MAX module outputs an intermediate result MAX of size 1xWxH res After the AVG res and the MAX res perform a connection operation, Cat res of size 2xWxH is obtained, and after Cat res undergoes Conv convolution and Sigmoid activation, the output SA n of the spatial attention module of size 2xWxH is obtained, wherein the convolution kernel size of Conv is 1x1, the step is 1, and the padding is 0.
[0059] Referring to Figure 7 Each dense block mainly contains two identical parallel convolution sequences. After each convolution sequence undergoes Conv convolution and ReLU activation, an intermediate feature E n of size 32x3x3x1 is obtained, wherein the convolution kernel size of Conv is 3x3, the step is 1, the padding is 1, and the feature mapping number is 32. After the intermediate feature E n undergoes Conv convolution and ReLU activation, an intermediate feature F n of size 16x1x1x1 is obtained, wherein the convolution kernel size of Conv is 1x1, the step is 1, the padding is 0, and the feature mapping number is 16. The two identical convolution sequences generate four intermediate features in total, and after connection, an intermediate feature Cat res of size 96xWxH is obtained. After Cat res undergoes Conv convolution and ReLU activation, a dense block output D n of size 96xWxH is obtained, wherein the convolution kernel size of Conv is 1x1, the step is 1, the padding is 0, and the feature mapping number is 32.
[0060] S3, constructing a spectral reconstruction module: inputting the feature image T2 into a spectral feature recombination module, reconstructing the feature image T2, and outputting a hyperspectral image T3 of size 31xWxH, to realize channel down-sampling of hyperspectral features.
[0061] Referring to Figure 8 The spectral feature recombination module is composed of a Conv convolution layer, wherein the convolution kernel size of Conv is 1x1, the step is 1, the padding is 0, and the feature mapping number is 31.
[0062] S4, optimizing the spectral reconstruction network: obtaining the real hyperspectral image data G through the training data set according to the loss function definition, calculating the error of the real hyperspectral image data G and the reconstructed hyperspectral image T3, optimizing the weight of the hyperspectral reconstruction network based on gradient descent and back propagation, 9. The hyperspectral reconstruction method based on attention mechanism and dense network according to claim 1, characterized in that: in step S4, the training data set is obtained in the following ways: downloading public data set through website, or establishing data set, including using hyperspectral imaging equipment to collect hyperspectral data, synthesizing RGB image according to response function, wherein each group of data in the data set contains an RGB image and a hyperspectral data, wherein the data set is divided into the training data set, the validation data set and the test data set, so as to obtain the training data set by obtaining the data set; obtaining the real hyperspectral image through the training data set, taking the RGB image as the input, and generating the reconstructed hyperspectral image data by using the hyperspectral reconstruction network; calculating the error of the real hyperspectral image data and the generated hyperspectral image data according to the loss function, and continuously optimizing the hyperspectral reconstruction network by using the optimization algorithm.
[0063] Embodiment 2
[0064] The embodiment discloses a storage medium, and a program code is stored on the storage medium. The program code is executed by a processor to implement the hyperspectral reconstruction method based on the attention mechanism and the dense network.
[0065] The relative arrangement of the components and steps, numerical expressions, and numerical values set forth in these embodiments do not limit the scope of the application unless otherwise specified. It should also be understood that the dimensions of the various parts shown in the drawings are not necessarily to scale, for the sake of convenience in description. Techniques, methods, and devices known to those of ordinary skill in the relevant art can not be discussed in detail, but should be considered part of the authorized description where appropriate. In all examples shown and discussed herein, any specific value should be interpreted as merely exemplary, and not as a limitation. Therefore, other examples of exemplary embodiments can have different values. It should be noted that similar reference numbers and letters represent similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further discussed in subsequent drawings.
[0066] In the description of the present application, it should be understood that the orientation words such as "front, back, upper, lower, left, right", "transverse, vertical, perpendicular, horizontal" and "top, bottom" and the like indicated orientation or position relationship are generally based on the orientation or position relationship shown in the drawings, only for the convenience of describing the present application and simplifying the description, without making the opposite statement, these orientation words do not indicate and imply that the device or element referred to must have a particular orientation or be constructed and operated in a particular orientation, therefore, it cannot be understood as a limitation on the scope of protection of the present application; the orientation words "inner, outer" refer to the inner and outer of the contour of each component itself.
[0067] For the convenience of description, spatial relative terms such as "over", "above", "upper surface", "upper" and the like can be used herein to describe the spatial position relationship of one device or feature with other devices or features as shown in the drawings. It should be understood that the spatial relative terms are intended to include different orientations in use or operation in addition to the orientation of the device described in the drawings. For example, if the device in the drawing is inverted, the device described as "above" or "over" other devices or structures will be positioned "below" or "under" other devices or structures. Thus, the exemplary term "above" can include both "above" and "below" orientations. The device can also be positioned in other different ways (rotated 90 degrees or in other orientations), and the spatial relative descriptions used herein are interpreted accordingly.
[0068] In addition, it should be noted that the use of "first", "second" and the like words to define parts only facilitates the differentiation of corresponding parts, and the above words have no special meaning unless otherwise stated, therefore, it cannot be understood as a limitation on the scope of protection of the present application.
[0069] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A hyperspectral reconstruction method based on attention mechanism and dense network, characterized by: The method comprises the following steps: S1, inputting an original RGB image into a shallow feature extraction module, the original RGB image having a size of 3xWxH, wherein W represents the width of the image and H represents the height of the image, performing shallow feature extraction on the original RGB image, and outputting a feature image T1 having a size of 128xWxH; S2, inputting the feature image T1 into a deep feature extraction module, fusing the spatial information, channel information and spectrum of the feature image T1, and outputting a feature image T2 having a size of 896xWxH, wherein the deep feature extraction module is composed of a plurality of dense attention module connections, each dense attention module being composed of an attention module and a dense module; S3, inputting the feature image T2 into a spectral feature reorganization module, reconstructing the feature image T2, and outputting a hyperspectral image T3 having a size of 31xWxH; S4, obtaining real hyperspectral image data G through a training data set according to a loss function definition, calculating the error of the real hyperspectral image data G and the reconstructed hyperspectral image T3, and optimizing the weight of the hyperspectral reconstruction network based on gradient descent and back propagation; In step S1, the step of performing shallow feature extraction on the original RGB image is: inputting the original RGB image through a Conv convolution and a ReLU activation, the Conv convolution kernel having a size of 1x1, a convolution step of 1, a padding of 0 and a feature mapping number of 128, to obtain a shallow feature extraction feature image T1; In the step S2, the deep feature extraction module is composed of 10 dense attention module connections; The input of the first dense attention module is a feature image T1 with a size of C n ×W×H, C n representing the number of channels input by the n-th dense attention module, C n = 128 + 64 × (n - 1); The input of the attention module and the dense module in each dense attention module is C n × W × H, and the output of the attention module and the dense module is 32 × W × H; The structure of the nth dense attention module is: n ×W×H feature image as input I n , the attention module outputs a 32×W×H feature A n , the dense module outputs 32×W×H feature D n , will I n 、A n and D n The connection is of size C n ×W×H characteristic M n After Conv convolution and ReLU activation, the size is C n+1 ×W×H output features O n , the convolution kernel size of this Conv is 1×1, the stride is 1, and the padding is 0.
2. The attention mechanism and dense network based hyperspectral reconstruction method according to claim 1, characterized in that: Each attention module is composed of a spatial attention module and a channel attention module; Input I of the attention module of the nth dense attention module n Size C n ×W×H, after Conv convolution and ReLU activation, intermediate feature E n Size C n ×W×H, as the input of the channel attention module; The output CA of the channel attention module n and E n The intermediate feature F is obtained by multiplication n , with a size of 32×W×H, as the input of the spatial attention module The output SA of the spatial attention module n and F n After multiplication and ReLU activation, the output A of the attention module is obtained n , with a size of 32 x W x H.
3. The method of claim 2, wherein the method is characterized by: Each channel attention module is composed of an AVG module, a MAX module and an MLP module; The AVG module outputs an intermediate result AVG with a size of 32x1x1 res The MAX module outputs an intermediate result MAX with a size of 32x1x1 res ; The MLP module is connected by one Conv, one ReLU and one Conv, the convolution kernel size of the Conv is 1x1, the step is 1, and the padding is 0. The MLP respectively takes AVG res and MAX res as inputs, adds the output results, and obtains the output CA n of the channel attention module after Sigmoid activation. Each spatial attention module also includes an AVG module and a MAX module; The AVG module outputs an intermediate result AVG with a size of 1xWxH res The MAX module outputs an intermediate result MAX with a size of 1xWxH res ; AVG res and MAX res Cat res , with a size of 2xWxH, Cat res After Conv convolution and Sigmoid activation, the output SA n of the spatial attention module is obtained, with a size of 2xWxH, wherein the convolution kernel size of Conv is 1x1, the step is 1, and the padding is 0.
4. The method of claim 3, wherein the method is characterized by: Each dense block contains two identical parallel convolution sequences, each of which is followed by a Conv convolution and a ReLU activation to obtain intermediate features E n , the convolution kernel size of Conv is 3x3, the step is 1, the padding is 1, and the feature map number is 32; Intermediate feature E n After Conv convolution and ReLU activation, the intermediate feature F is obtained n The convolution kernel size of Conv is 1x1, the step is 1, the padding is 0, and the feature mapping number is 16. Two identical convolution sequences generate four intermediate features in total, and the intermediate features Cat res with a size of 96×W×H are obtained after connection. Cat res After Conv convolution and ReLU activation, the dense block output D is obtained n , the size is 96xWxH, the convolution kernel size of Conv is 1x1, the step is 1, the padding is 0, and the feature mapping number is 32.
5. The attention mechanism and dense network-based hyperspectral reconstruction method according to claim 1, characterized in that: In the step S3, the spectral feature reorganization module is composed of a Conv convolution layer, the Conv having a convolution kernel size of 1x1, a step of 1, a padding of 0 and a feature mapping number of 31.
6. The attention mechanism and dense network-based hyperspectral reconstruction method according to claim 1, characterized in that: In the step S4, the training data set can be obtained by downloading a public data set from a website or by establishing a data set, including using a hyperspectral imaging device to collect hyperspectral data and synthesizing an RGB image according to a response function, wherein each group of data in the data set contains an RGB image and a hyperspectral data, and the data set is divided into the training data set, a validation data set and a test data set; The real hyperspectral image is obtained through the training data set, the RGB image is taken as input, and the hyperspectral reconstruction network is used to generate a reconstructed hyperspectral image data; The error of the real hyperspectral image data and the generated hyperspectral image data is calculated according to a loss function, and the hyperspectral reconstruction network is continuously optimized by using an optimization algorithm.
7. A storage medium characterized by: The storage medium stores program code, which is executed by the processor to implement the hyperspectral reconstruction method based on the attention mechanism and the dense network according to any one of claims 1-6.
Citation Information
Patent Citations
Medical image super-resolution reconstruction method based on dense mixed attention network
CN110322402A
Hyperspectral remote sensing image classification method and device
CN112580480A