A data processing method and apparatus

By introducing an attention module into the neural network model, the correlation information between different channels and within themselves is fused, which solves the problem of insufficient accuracy in spectral information reconstruction of RGB color sensors and multispectral sensors, and improves color reproduction performance.

CN117392491BActive Publication Date: 2025-11-11HUAWEI TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311138944.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-05
Publication Date
2025-11-11
Estimated Expiration
2043-09-05

AI Technical Summary

Technical Problem

Existing RGB color sensors and multispectral sensors suffer from insufficient accuracy in spectral information reconstruction, especially in challenging scenarios where color reproduction performance is limited.

Method used

By employing the attention module in the neural network model, the correlation information between different channels and the correlation information within the channels themselves are fused through the attention matrix, thereby improving the accuracy of spectral information reconstruction.

Benefits of technology

It improves the accuracy of spectral signal reconstruction and enhances color reproduction capabilities in challenging scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117392491B_ABST
    Figure CN117392491B_ABST
Patent Text Reader

Abstract

A data processing method applied to image processing, the method comprising: acquiring first data collected by an image sensor; obtaining spectral information through a neural network model according to the first data; wherein the neural network model comprises an attention module, the attention module is used for determining an attention matrix according to input data and performing attention operation according to the attention matrix; the attention matrix is obtained by performing a first fusion operation on the correlation information between different channels of the input data and the correlation information of the channels themselves. The application can fuse the correlation degree between different channels and the correlation degree of the channels themselves, so that the attention matrix can model the correlation and specificity between different channels at the same time, and the spectral signal reconstruction accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and more particularly to a data processing method and apparatus thereof. Background Technology

[0002] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.

[0003] Image sensors are widely used in cameras and smartphones. Common image sensors use a color filter array (CFA), also known as a Bayer filter, arranged above the photosensitive area. A common arrangement of CFAs is a 2×2 four-pixel circular unit. This unit contains the three primary colors: red (R), green (G), and blue (B), therefore color image sensors are often referred to as RGB image sensors.

[0004] RGB sensors aim to directly simulate the response of the three types of cone cells (L / M / S) in the human eye to the spectrum. This response is a sampling of the complete spectral information, which cannot fully capture spectral details and is prone to metamerism. This results in limited color reproduction performance of existing RGB cameras in challenging scenarios, such as those containing large areas of pure color. Compared to RGB color sensors, multispectral sensors aim to capture the original spectral signal more completely. A multispectral sensor consists of a 4×4 loop of sixteen pixels above the grayscale photosensitive area, with each pixel corresponding to a color filter (or color filter coating). This design increases the sensor's spectral resolution from 3D to 16D, enabling more complete capture of the spectral signal.

[0005] However, due to constraints in filter materials, manufacturing processes, and cost, the raw signals (RAW signals) acquired by image sensors exhibit spectral band aliasing. Therefore, RAW signals need to be analyzed and reconstructed to obtain spectral information. Current implementations suffer from poor accuracy in reconstructing spectral information. Summary of the Invention

[0006] This application provides a data processing method that can improve the accuracy of spectral signal reconstruction.

[0007] In a first aspect, this application provides an image processing method, the method comprising: acquiring first data collected by an image sensor; obtaining spectral information based on the first data through a neural network model; wherein the neural network model includes an attention module, the attention module being used to determine an attention matrix based on input data, and to perform attention operations based on the attention matrix; the attention matrix being obtained by performing a first fusion operation on the correlation information between different channels of the input data and the correlation information of the channels themselves.

[0008] In some implementations, when the sizes of the elements in the attention matrix are similar (e.g., all are small or all are large), there is no obvious distinction between different channels, which leads to poor performance of attention operations. This is especially true in the reconstruction of spectral information, where each channel can be considered to have a specific physical meaning. Therefore, the attention matrix needs to represent the distinction between different channels as much as possible to improve the accuracy of spectral information reconstruction.

[0009] In this embodiment, when the attention module calculates the attention matrix, it can fuse the correlation between different channels and the correlation between channels themselves, so that the attention matrix can simultaneously model the correlation and specificity between different channels, thereby improving the accuracy of spectral signal reconstruction.

[0010] Among them, the correlation information of the channel itself can be understood as the information that is different from other channels in each channel, that is, the information with specificity. This information can be obtained not through interaction with other channels, but through interactive operations on the data inside the channel (such as dimensionality reduction, convolution, etc.). This information can reflect the distinguishability between channels.

[0011] The neural network model can include a feature extraction network (e.g., encoder and decoder) and a downstream task network (e.g., mapping network). The attention module can be a module in the feature extraction network used for attention operations (e.g., the module is the attention head). The feature extraction network can also include other modules, such as summation and normalization layers and feedforward layers. Based on the input data (e.g., data collected by an image sensor), the feature representation obtained by the feature extraction network can be input into the downstream task network to obtain the output (e.g., spectral information).

[0012] In one possible implementation, the attention module is specifically used to perform a linear transformation on the input data to obtain a K matrix, a Q matrix, and a V matrix, and to determine an attention matrix based on the K matrix, the Q matrix, and the V matrix; the correlation information with the channel itself is determined based on the V matrix, and the correlation information between different channels is determined based on the K matrix and the Q matrix.

[0013] In one possible implementation, the correlation information of the channel itself is determined by: performing a second fusion operation on the data within each channel of the V matrix to obtain dimensionality-reduced data; performing convolution on the dimensionality-reduced data and converting the convolution result into a diagonal matrix; the diagonal matrix is ​​used as the correlation information of the channel itself.

[0014] In one possible implementation, the first fusion operation is matrix addition.

[0015] In one possible implementation, the first fusion operation is a weighted summation; the weights corresponding to the correlation information between different channels and the weights corresponding to the correlation information of the channels themselves are learnable parameters.

[0016] In one possible implementation, the second fusion operation is a global average pooling or convolution operation.

[0017] In one possible implementation, the attention module belongs to at least one attention head in the neural network model.

[0018] In one possible implementation, the linear transformation of the input data to obtain the K matrix, Q matrix, and V matrix includes: performing a convolution operation on the data of the first channel included in the input data according to a first convolution kernel to obtain a first convolution result; performing a convolution operation on the data of the first channel included in the input data according to a second convolution kernel to obtain a second convolution result; the first convolution result and the second convolution result are used to concatenate to obtain one of the K matrix, Q matrix, and V matrix.

[0019] In one possible implementation, a convolution kernel can be applied to one channel of the input data to obtain the values ​​of the K, Q, or V matrices for the corresponding channel. That is, when calculating the K, Q, or V matrices, at least one element of the matrix is ​​calculated using a convolution kernel within one channel of the input data, rather than through interactions between channels. This projection method operates independently on each channel of the spectral features, maintaining the specificity of the spectral information token.

[0020] In one possible implementation, the first convolutional kernel and the second convolutional kernel are the same.

[0021] In one possible implementation, the spectral information includes multiple response values ​​in a narrowband spectral response space.

[0022] Secondly, this application provides a data processing apparatus, the apparatus comprising:

[0023] The acquisition module is used to acquire the first data collected by the image sensor;

[0024] The processing module is used to obtain spectral information based on the first data through a neural network model; wherein the neural network model includes an attention module, which is used to determine an attention matrix based on the input data and perform attention operations based on the attention matrix; the attention matrix is ​​obtained by performing a first fusion operation on the correlation information between different channels of the input data and the correlation information of the channels themselves.

[0025] In one possible implementation, the attention module is specifically used to perform a linear transformation on the input data to obtain a K matrix, a Q matrix, and a V matrix, and to determine an attention matrix based on the K matrix, the Q matrix, and the V matrix; the correlation information with the channel itself is determined based on the V matrix, and the correlation information between different channels is determined based on the K matrix and the Q matrix.

[0026] In one possible implementation, the correlation information of the channel itself is determined in the following way:

[0027] The data within each channel of the V matrix is ​​subjected to a second fusion operation to obtain the dimensionality-reduced data.

[0028] The dimensionality-reduced data is convolved, and the convolution result is converted into a diagonal matrix; the diagonal matrix is ​​used as the correlation information of the channel itself.

[0029] In one possible implementation, the first fusion operation is matrix addition.

[0030] In one possible implementation, the first fusion operation is a weighted summation; the weights corresponding to the correlation information between different channels and the weights corresponding to the correlation information of the channels themselves are learnable parameters.

[0031] In one possible implementation, the second fusion operation is a global average pooling or convolution operation.

[0032] In one possible implementation, the attention module belongs to at least one attention head in the neural network model.

[0033] In one possible implementation, the processing module is specifically used for:

[0034] Based on the first convolution kernel, a convolution operation is performed on the first channel data included in the input data to obtain the first convolution result;

[0035] Based on the second convolution kernel, a convolution operation is performed on the first channel data included in the input data to obtain the second convolution result;

[0036] The first convolution result and the second convolution result are used to concatenate to obtain one of the K matrix, Q matrix and V matrix.

[0037] In one possible implementation, the first convolutional kernel and the second convolutional kernel are the same.

[0038] In one possible implementation, the spectral information includes multiple response values ​​in a narrowband spectral response space.

[0039] Thirdly, embodiments of this application provide a data processing apparatus, which may include a memory, a processor, and a bus system, wherein the memory is used to store a program, and the processor is used to execute the program in the memory to perform the methods described in the first aspect above and any of its optional methods.

[0040] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the methods described in the first aspect and any of its optional methods.

[0041] Fifthly, embodiments of this application provide a computer program that, when run on a computer, causes the computer to perform the methods described in the first aspect and any of its optional methods.

[0042] Sixthly, this application provides a chip system including a processor for supporting a data processing device in performing the functions involved in the foregoing aspects, such as transmitting or processing data involved in the foregoing methods; or, information. In one possible design, the chip system further includes a memory for storing program instructions and data necessary for the data processing device. The chip system may be composed of chips or may include chips and other discrete devices. Attached Figure Description

[0043] Figure 1 A structural diagram illustrating the main framework of artificial intelligence;

[0044] Figure 2 This is a schematic diagram of the application system framework of this application;

[0045] Figures 3 to 5 This is a schematic diagram of a network structure;

[0046] Figure 6 A flowchart illustrating a data processing method provided in an embodiment of this application;

[0047] Figure 7 This is a diagram illustrating the data collected by the image sensor.

[0048] Figure 8This is a diagram illustrating the data collected by the image sensor.

[0049] Figure 9 and Figure 10 This is a schematic diagram of a network structure;

[0050] Figures 11A to 11C A flowchart illustrating a data processing method provided in an embodiment of this application;

[0051] Figure 11D This is a schematic diagram illustrating one effect of this application;

[0052] Figure 12 A schematic diagram of the structure of a data processing apparatus provided in an embodiment of this application;

[0053] Figure 13 A schematic diagram of the structure of the execution device provided in the embodiments of this application;

[0054] Figure 14 A schematic diagram of the structure of the training device provided in the embodiments of this application;

[0055] Figure 15 This is a schematic diagram of a chip structure provided in an embodiment of this application. Detailed Implementation

[0056] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.

[0057] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.

[0058] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.

[0059] The terms “substantially,” “about,” and similar terms used herein are used as approximations, not as terms of degree, and are intended to take into account the inherent biases of measurements or calculations known to those skilled in the art. Furthermore, the term “may” used in describing embodiments of this application means “one or more possible embodiments.” The terms “use,” “using,” and “used” used herein are to be considered synonymous with the terms “utilize,” “utilizing,” and “utilized,” respectively. Additionally, the term “exemplary” is intended to refer to an instance or illustration.

[0060] First, the overall workflow of the artificial intelligence system is described; please refer to [link / reference]. Figure 1 , Figure 1 The diagram illustrates a structural framework for artificial intelligence (AI). The framework is further elaborated below along two dimensions: the "Intelligent Information Chain" (horizontal axis) and the "IT Value Chain" (vertical axis). The "Intelligent Information Chain" reflects a series of processes from data acquisition to processing. For example, it could be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. In this process, data undergoes a condensation process of "data—information—knowledge—wisdom." The "IT Value Chain" reflects the value that AI brings to the information technology industry, from the underlying infrastructure of human intelligence and information (provided and processed through technological means) to the industrial ecosystem of the system.

[0061] (1) Infrastructure

[0062] Infrastructure provides computing power to support artificial intelligence systems, enabling communication with the external world and providing support through a basic platform. This communication occurs through sensors; computing power is provided by intelligent chips (hardware acceleration chips such as CPUs, NPUs, GPUs, ASICs, and FPGAs); and the basic platform includes distributed computing frameworks and related platform guarantees and support, which may include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to acquire data, and this data is provided to intelligent chips in the distributed computing system provided by the basic platform for computation.

[0063] (2) Data

[0064] The data at the next layer of infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, text, and IoT data from traditional devices, including business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.

[0065] (3) Data processing

[0066] Data processing typically includes methods such as data training, machine learning, deep learning, search, reasoning, and decision-making.

[0067] Among them, machine learning and deep learning can perform intelligent information modeling, extraction, preprocessing, and training on data, including symbolization and formalization.

[0068] Reasoning refers to the process in which, in a computer or intelligent system, the machine thinks and solves problems by simulating human intelligent reasoning, based on reasoning control strategies and using formalized information. Typical functions include search and matching.

[0069] Decision-making refers to the process of making decisions based on intelligent information after reasoning, and it typically provides functions such as classification, sorting, and prediction.

[0070] (4) General ability

[0071] After the data processing mentioned above, the results of the data processing can be used to form some general capabilities, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.

[0072] (5) Smart Products and Industry Applications

[0073] Intelligent products and industry applications refer to products and applications of artificial intelligence systems in various fields. They are the encapsulation of overall artificial intelligence solutions, productizing intelligent information decision-making and realizing practical applications. Their application areas mainly include: intelligent terminals, intelligent transportation, intelligent healthcare, autonomous driving, smart cities, etc.

[0074] It should be understood that the steps related to the model inference process in the embodiments of this application involve AI-related operations. When performing AI operations, the instruction execution architecture of the terminal device and server is not limited to the processor-memory architecture described above. The following section will further explain... Figure 2 The system architecture provided in the embodiments of this application will be described in detail.

[0075] Figure 2 This is a schematic diagram of the system architecture provided for an embodiment of this application. Figure 2 As shown, the system architecture 500 includes an execution device 510, a training device 520, a database 530, a client device 540, a data storage system 550, and a data acquisition system 560.

[0076] The execution device 510 includes a calculation module 511, an I / O interface 512, a preprocessing module 513, and a preprocessing module 514. The calculation module 511 may include a target model / rule 501, while the preprocessing modules 513 and 514 are optional.

[0077] The execution device 510 can be a terminal device or a server that runs the aforementioned image processing applications.

[0078] The data acquisition device 560 is used to acquire training samples. Training samples can be data acquired by the image sensor (or the image sensor's response values) and corresponding spectral information (or multiple response values ​​in the narrowband spectral response space). After acquiring the training samples, the data acquisition device 560 stores them in the database 530.

[0079] The training device 520 can maintain training samples in the database 530 and obtain the target model / rule 501 from the neural network to be trained (e.g., the neural network model in the embodiments of this application (e.g., including encoder, decoder, etc.)).

[0080] It should be understood that the training device 520 can perform a pre-training process on the neural network to be trained based on the training samples maintained in the database 530, or fine-tune the model based on the pre-training.

[0081] It should be noted that in practical applications, the training samples maintained in database 530 may not all come from the data acquisition device 560; they may also be received from other devices. Furthermore, it should be noted that training device 520 may not necessarily train the target model / rule 501 entirely based on the training samples maintained in database 530; it may also obtain training samples from the cloud or other sources for model training. The above description should not be construed as limiting the embodiments of this application.

[0082] The target model / rule 501 trained using training device 520 can be applied to different systems or devices, such as... Figure 2 The execution device 510 shown can be a terminal, such as a mobile phone terminal, tablet computer, laptop computer, augmented reality (AR) / virtual reality (VR) device, vehicle terminal, etc., or it can be a server, etc.

[0083] Specifically, the training device 520 can transfer the trained model to the execution device 510.

[0084] exist Figure 2In the execution device 510, an input / output (I / O) interface 512 is configured for data interaction with external devices. Users can input data to the I / O interface 512 through the client device 540.

[0085] Preprocessing modules 513 and 514 are used to preprocess the input data received from the I / O interface 512. It should be understood that preprocessing modules 513 and 514 may be absent, or only one preprocessing module may be used. When preprocessing modules 513 and 514 are absent, the calculation module 511 can be used directly to process the input data.

[0086] During the preprocessing of input data by the execution device 510, or during the calculation module 511 of the execution device 510 performing calculations and other related processes, the execution device 510 can call data, code, etc. in the data storage system 550 for corresponding processing, or store the data, instructions, etc. obtained from the corresponding processing into the data storage system 550.

[0087] Finally, the I / O interface 512 provides the processing result to the client device 540, thereby providing it to the user.

[0088] exist Figure 2 In the illustrated scenario, the user can manually provide input data, which can be done through the interface provided by I / O interface 512. Alternatively, the client device 540 can automatically send input data to I / O interface 512. If user authorization is required for the client device 540 to automatically send input data, the user can set the corresponding permissions in the client device 540. The user can view the output results of the execution device 510 on the client device 540, which can be presented in various forms such as display, sound, or animation. The client device 540 can also act as a data acquisition terminal, collecting the input data and output results of the input I / O interface 512 as shown in the figure, and storing them as new sample data in database 530. Alternatively, data can be collected directly from the I / O interface 512 without going through the client device 540, using the input data and output results of the input I / O interface 512 as shown in the figure, and storing them as new sample data in database 530.

[0089] It is worth noting that, Figure 2 This is merely a schematic diagram of a system architecture provided in an embodiment of this application. The positional relationships between the devices, components, modules, etc., shown in the diagram do not constitute any limitation. For example, in Figure 2In this context, the data storage system 550 is an external storage device relative to the execution device 510. However, in other cases, the data storage system 550 may also be placed within the execution device 510. It should be understood that the aforementioned execution device 510 may be deployed within the client device 540.

[0090] From the inference side of the model:

[0091] In this embodiment, the computing module 511 of the execution device 510 can obtain the code stored in the data storage system 550 to implement the steps related to the model reasoning process in this embodiment.

[0092] In this embodiment of the application, the computing module 511 of the execution device 510 may include hardware circuits (such as application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), general-purpose processors, digital signal processors (DSPs), microprocessors or microcontrollers, etc.) or combinations of these hardware circuits. For example, the training device 520 may be a hardware system with instruction execution capabilities, such as a CPU or DSP, or a hardware system without instruction execution capabilities, such as an ASIC or FPGA, or a combination of the aforementioned hardware systems without instruction execution capabilities and hardware systems with instruction execution capabilities.

[0093] Specifically, the computing module 511 of the execution device 510 can be a hardware system with the function of executing instructions. The steps related to the model inference process provided in this application embodiment can be software code stored in the memory. The computing module 511 of the execution device 510 can obtain the software code from the memory and execute the obtained software code to implement the steps related to the model inference process provided in this application embodiment.

[0094] It should be understood that the computing module 511 of the execution device 510 can be a combination of a hardware system without the function of executing instructions and a hardware system with the function of executing instructions. Some steps related to the model reasoning process provided in the embodiments of this application can also be implemented by the hardware system in the computing module 511 of the execution device 510 without the function of executing instructions, which is not limited here.

[0095] From the training side of the model:

[0096] In this embodiment of the application, the training device 520 can access the memory ( Figure 2(Not shown in the diagram, but can be integrated into the training device 520 or deployed separately from the training device 520) The code stored in the diagram can be used to implement the steps related to model training in the embodiments of this application.

[0097] In this embodiment of the application, the training device 520 may include hardware circuits (such as application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), general-purpose processors, digital signal processors (DSPs), microprocessors or microcontrollers, etc.) or combinations of these hardware circuits. For example, the training device 520 may be a hardware system with instruction execution capabilities, such as a CPU or DSP, or a hardware system without instruction execution capabilities, such as an ASIC or FPGA, or a combination of the aforementioned hardware systems without instruction execution capabilities and hardware systems with instruction execution capabilities.

[0098] It should be understood that the training device 520 can be a combination of a hardware system without the function of executing instructions and a hardware system with the function of executing instructions. Some steps related to the training of the neutralization model provided in the embodiments of this application can also be implemented by the hardware system in the training device 520 without the function of executing instructions, which is not limited here.

[0099] Since the embodiments of this application involve a large number of neural network applications, for ease of understanding, the relevant terms and concepts such as neural networks involved in the embodiments of this application will be introduced below.

[0100] (1) Neural Network

[0101] A neural network can be composed of neural units, which can be defined as a computational unit that takes xs (i.e., input data) and an intercept of 1 as input. The output of this computational unit can be:

[0102]

[0103] Where s = 1, 2, ..., n, where n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into an output signal. The output signal of this activation function can be used as the input of the next convolutional layer, and the activation function can be the sigmoid function. A neural network is a network formed by connecting multiple of the above-mentioned individual neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field, which can be a region composed of several neural units.

[0104] (2) A convolutional neural network (CNN) is a deep neural network with a convolutional structure. A CNN contains a feature extractor consisting of convolutional layers and subsampling layers, which can be viewed as a filter. A convolutional layer refers to the layer of neurons in a CNN that performs convolutional processing on the input signal. In a convolutional layer of a CNN, a neuron can be connected to only some of the neurons in its neighboring layers. A convolutional layer typically contains several feature planes, each composed of rectangularly arranged neural units. Neural units on the same feature plane share weights, which are the convolutional kernel. Shared weights can be understood as the way features are extracted being independent of their location. The convolutional kernel can be formalized as a matrix of random size, and during the training process of the CNN, the kernel can learn reasonable weights. Furthermore, the direct benefit of shared weights is reducing the connections between layers in the CNN, while also reducing the risk of overfitting.

[0105] CNN is a very common type of neural network. Below, we will combine... Figure 3 This section focuses on a detailed explanation of the structure of CNNs. As mentioned in the basic concept introduction above, a Convolutional Neural Network (CNN) is a deep neural network with a convolutional structure. It is a deep learning architecture, which refers to learning at multiple levels of abstraction through machine learning algorithms. As a deep learning architecture, CNN is a feed-forward artificial neural network, in which each neuron can respond to the input image.

[0106] As shown in Figure 2, the convolutional neural network (CNN) 200 may include an input layer 210, a convolutional / pooling layer 220 (where the pooling layer is optional), and a fully connected layer 230.

[0107] Convolutional / pooling layers 220:

[0108] Convolutional layers:

[0109] like Figure 3 The convolutional / pooling layer 220 shown may include layers as in Examples 221-226. For instance, in one implementation, layer 221 is a convolutional layer, layer 222 is a pooling layer, layer 223 is a convolutional layer, layer 224 is a pooling layer, layer 225 is a convolutional layer, and layer 226 is a pooling layer; in another implementation, layers 221 and 222 are convolutional layers, layer 223 is a pooling layer, layers 224 and 225 are convolutional layers, and layer 226 is a pooling layer. That is, the output of the convolutional layer can be used as the input to a subsequent pooling layer, or as the input to another convolutional layer to continue the convolution operation.

[0110] The following section will use convolutional layer 221 as an example to introduce the internal working principle of a convolutional layer.

[0111] Convolutional layer 221 can include multiple convolution operators, also known as kernels. In image processing, a convolution operator acts as a filter to extract specific information from the input image matrix. Essentially, a convolution operator can be a weight matrix, which is usually predefined. During the convolution operation, the weight matrix typically processes the input image pixel by pixel (or two pixels by two pixels, depending on the stride) along the horizontal direction, thus extracting specific features from the image. The size of the weight matrix should be related to the image size. It's important to note that the depth dimension of the weight matrix is ​​the same as the depth dimension of the input image; during convolution, the weight matrix extends to the entire depth of the input image. Therefore, convolution with a single weight matrix produces a single-depth convolutional output. However, in most cases, a single weight matrix is ​​not used; instead, multiple weight matrices of the same size (rows × columns) are applied—multiple identical matrices. The outputs of each weight matrix are stacked to form the depth dimension of the convolutional image; this dimension can be understood as being determined by the "multiple" mentioned above. Different weight matrices can be used to extract different features from an image. For example, one weight matrix can be used to extract image edge information, another weight matrix can be used to extract specific colors of the image, and yet another weight matrix can be used to blur unwanted noise in the image. These multiple weight matrices have the same size (rows × columns), and the feature maps extracted by these multiple weight matrices of the same size also have the same size. The extracted feature maps of the same size are then merged to form the output of the convolution operation.

[0112] The weight values ​​in these weight matrices need to be obtained through extensive training in practical applications. The weight matrices formed by the weight values ​​obtained through training can be used to extract information from the input image, thereby enabling the convolutional neural network 200 to make correct predictions.

[0113] When a convolutional neural network 200 has multiple convolutional layers, the initial convolutional layers (e.g., 221) tend to extract more general features, which can also be called low-level features. As the depth of the convolutional neural network 200 increases, the features extracted by later convolutional layers (e.g., 226) become more and more complex, such as high-level semantic features. Features with higher semantic levels are more suitable for the problem to be solved.

[0114] Pooling layer:

[0115] Because it is often necessary to reduce the number of training parameters, pooling layers are often introduced periodically after convolutional layers, such as... Figure 3 Layers 221-226 in example 220 can be a convolutional layer followed by a pooling layer, or multiple convolutional layers followed by one or more pooling layers. In image processing, the sole purpose of pooling layers is to reduce the spatial size of the image. Pooling layers can include average pooling and / or max pooling operators to sample the input image to obtain a smaller image size. The average pooling operator calculates the average value of pixel values ​​within a specific range as the result of average pooling. The max pooling operator takes the pixel with the largest value within a specific range as the result of max pooling. Furthermore, just as the size of the weight matrix in a convolutional layer should be related to the image size, the operators in a pooling layer should also be related to the image size. The size of the output image after processing by the pooling layer can be smaller than the size of the input image of the pooling layer. Each pixel in the output image of the pooling layer represents the average or maximum value of the corresponding sub-region of the input image of the pooling layer.

[0116] Fully connected layer 230:

[0117] After processing by the convolutional / pooling layers 220, the convolutional neural network 200 is still insufficient to output the required information. As mentioned earlier, the convolutional / pooling layers 220 only extract features and reduce the parameters introduced by the input image. However, to generate the final output information (the required class information or other relevant information), the convolutional neural network 200 needs to utilize fully connected layers 230 to generate one or a set of outputs representing the required number of classes. Therefore, the fully connected layers 230 can include multiple hidden layers (such as...). Figure 3As shown in 231, 232 to 23n), the parameters contained in these multi-layer hidden layers can be pre-trained based on relevant training data for specific task types. For example, the task type may include image recognition, image classification, image super-resolution reconstruction, etc.

[0118] After the multiple hidden layers in the fully connected layer 230, the final layer of the entire convolutional neural network 200 is the output layer 240. This output layer 240 has a loss function similar to the classification cross-entropy, specifically used to calculate the prediction error. Once the entire convolutional neural network 200 has propagated forward (e.g., ... Figure 3 Propagation from 210 to 240 degrees is considered forward propagation, while backward propagation (e.g.) is completed. Figure 3 The propagation from 240 to 210 (backpropagation) will begin to update the weight values ​​and biases of the layers mentioned above, in order to reduce the loss of the convolutional neural network 200 and the error between the output of the convolutional neural network 200 through the output layer and the ideal result.

[0119] It should be noted that, as Figure 3 The convolutional neural network 200 shown is merely an example of a convolutional neural network. In specific applications, convolutional neural networks can also exist in the form of other network models, for example, including only... Figure 3 As shown in the network structure, for example, the convolutional neural network used in the embodiments of this application may only include an input layer 210, a convolutional / pooling layer 220, and an output layer 240.

[0120] It should be noted that, as Figure 3 The convolutional neural network 100 shown is merely an example of a convolutional neural network. In specific applications, convolutional neural networks can also exist in the form of other network models, such as... Figure 4 The multiple convolutional / pooling layers shown are implemented in parallel, and the extracted features are all input into the fully connected layer 230 for processing.

[0121] (3) Deep Neural Networks

[0122] Deep Neural Networks (DNNs), also known as multilayer neural networks, can be understood as neural networks with many hidden layers, though there's no specific metric for "many." DNNs can be categorized into three layers based on their position: input layers, hidden layers, and output layers. Generally, the first layer is the input layer, the last layer is the output layer, and the layers in between are hidden layers. All layers are fully connected, meaning that any neuron in the i-th layer is connected to any neuron in the (i+1)-th layer. Although DNNs appear complex, the operation of each layer is actually quite simple, resembling a linear relationship as follows: in, It is the input vector. It is the output vector. α is the offset vector, W is the weight matrix (also called coefficients), and α() is the activation function. Each layer is simply an adjustment of the input vector. The output vector is obtained through such a simple operation. Because DNNs have many layers, the coefficients W and the offset vector... The number of these parameters is therefore quite large. The definitions of these parameters in a DNN are as follows: Taking the coefficient W as an example: Assuming a three-layer DNN, the linear coefficient from the 4th neuron in the second layer to the 2nd neuron in the third layer is defined as... The superscript 3 represents the layer number where coefficient W is located, while the subscript corresponds to the third layer index 2 of the output and the second layer index 4 of the input.

[0123] In summary: the coefficients from the k-th neuron in layer L-1 to the j-th neuron in layer L are defined as follows:

[0124] It's important to note that the input layer does not have a W parameter. In deep neural networks, more hidden layers allow the network to better represent complex real-world situations. Theoretically, the more parameters a model has, the higher its complexity and "capacity," meaning it can perform more complex learning tasks. Training a deep neural network is essentially the process of learning the weight matrix, with the ultimate goal of obtaining the weight matrix of all layers in the trained deep neural network (a weight matrix formed by the vectors W from many layers).

[0125] (4) Loss Function

[0126] In training a deep neural network, to ensure the output closely approximates the desired predicted value, we compare the network's prediction with the target value. Based on the difference, we update the weight vector of each layer (usually pre-configuring parameters before the initial update). For example, if the prediction is too high, the weight vector is adjusted to predict a lower value. This adjustment continues until the deep neural network predicts the target value or a value very close to it. Therefore, we need to predefine "how to compare the difference between the predicted and target values," which is the loss function or objective function. These are important equations used to measure the difference between the predicted and target values. Taking the loss function as an example, a higher output value (loss) indicates a greater difference, and training the deep neural network becomes a process of minimizing this loss.

[0127] (5) Backpropagation algorithm

[0128] Convolutional neural networks can employ backpropagation (BP) to correct the parameters in the initial super-resolution model during training, thereby reducing the reconstruction error loss. Specifically, forward propagation of the input signal to the output generates an error loss; this error loss information is then propagated back to update the parameters in the initial super-resolution model, leading to convergence of the error loss. The backpropagation algorithm is an error-loss-driven backpropagation process aimed at obtaining the optimal parameters of the super-resolution model, such as the weight matrix.

[0129] (6) Multispectral: refers to a spectral detection technology that can simultaneously acquire multiple optical spectrum bands (usually more than 3) and can extend from visible light to infrared and ultraviolet light.

[0130] (7) Spectral response aliasing: This refers to regions where the wavelength ranges covered by different spectral response channels overlap. This weakens the orthogonality between spectral RAW signals, increasing the difficulty of signal reconstruction.

[0131] (8) Attention mechanism: This is a technique in artificial neural networks that mimics cognitive attention. This mechanism can enhance the weights of certain parts of the input data of the neural network while weakening the weights of other parts, thereby focusing the network's attention on the most important part of the data.

[0132] (9) Feature token: This is a representation in the attention mechanism that refers to a set of independent feature information. For example, the feature embedding of each word in a sentence can be regarded as a token, and the feature information of different channels in a color image can also be regarded as a token.

[0133] (10) Feature similarity and particularity: For a set of feature tags, similarity describes the pairwise distance between features. The closer the distance, the more similar the features. Specificity describes the degree of independence of each token. If there are two very similar tokens, the token is considered to have weak specificity.

[0134] (11) Image Signal Processor (ISP): Used to process image signals output from the image signal sensor. It occupies a core and dominant position in the camera system and is an important component of the camera. Its main functional characteristics include: demosaic, automatic exposure, automatic white balance, lens shading elimination, gamma correction, color space conversion, dynamic range correction, image cropping, etc.

[0135] (12) Spatial / Spectral Resolution: An image is represented by H×W×C, where H×W represents the spatial resolution of the image and C represents the spectral resolution of the image. For example, a common 3-channel color image has a spectral resolution of 3, while for multispectral images, the spectral resolution C>3 is usually the case.

[0136] (13) Transformer layer

[0137] The neural network includes an embedding layer and at least one transformer layer. The at least one transformer layer can be N transformer layers (N being an integer greater than 0). Each transformer layer includes sequentially adjacent attention layers, add and normalize layers, feed-forward layers, and add and normalize layers. In the embedding layer, the current input is embedded to obtain multiple embedding vectors. In the attention layer, P input vectors are obtained from the layer above the first transformer layer. Using any first input vector among the P input vectors as the center, intermediate vectors corresponding to the first input vector are obtained based on the correlation between each input vector within a preset attention window and the first input vector. This process determines P intermediate vectors corresponding to the P input vectors. In the pooling layer, the P intermediate vectors are merged into Q output vectors, where the multiple output vectors obtained from the last transformer layer are used as feature representations of the current input.

[0138] Reference Figure 5 , Figure 5 This is a schematic diagram of a transformer layer structure, wherein the transformer layer may include sequentially adjacent multi-head attention layers (or simply attention layers), addition and normalization (add&norm) layers, feedforward net (FFN) layers, and addition and normalization layers.

[0139] The multi-head attention layer obtains N input vectors Xl from the layer above it. These N input vectors Xl can be represented as a matrix X. The multi-head attention layer employs a self-attention mechanism, transforming each vector based on the correlation between them to obtain N output vectors, which can also be represented as a matrix Y. It can be understood that when this multi-head attention layer is directly connected to the embedding layer, for example... Figure 5 In a transformer layer directly connected to the embedding layer, the input vector it receives is the embedding vector output by the embedding layer; when this multi-head attention layer is a multi-head attention layer included in subsequent transformer layers, for example... Figure 5 A multi-head attention layer, which is directly connected to the previous transformer layer, receives the input vector as the output vector of the previous transformer layer. A multi-head attention layer can contain multiple attention heads.

[0140] (14) Attention mechanism

[0141] Attention mechanisms mimic the internal processes of biological observation—aligning internal experience with external senses to increase the precision of observation in specific areas. They enable the rapid sifting of high-value information from a large volume of data using limited attentional resources. Attention mechanisms can quickly extract important features from sparse data and are therefore widely used in natural language processing tasks, particularly machine translation. Self-attention mechanisms, an improvement on attention mechanisms, reduce reliance on external information and are better at capturing the internal correlations of data or features. The core idea of ​​attention mechanisms can be rewritten as follows:

[0142]

[0143] In this formula, Lx = ||Source|| represents the length of the Source. The meaning is that the elements in the Source are imagined as a series of data pairs. Given a Query element in the Target, the similarity or relevance between the Query and each Key is calculated to obtain the weight coefficient of the Value corresponding to each Key. Then, the Values ​​are weighted and summed to obtain the final Attention value. Therefore, the Attention mechanism essentially performs a weighted sum of the Values ​​of the elements in the Source, while the Query and Key are used to calculate the weight coefficients of their corresponding Values. Conceptually, Attention can be understood as selectively filtering a small amount of important information from a large amount of information and focusing on this important information, ignoring most of the unimportant information. The focusing process is reflected in the calculation of the weight coefficients; the larger the weight, the more focused it is on its corresponding Value. That is, the weight represents the importance of the information, and the Value is the corresponding information. Self-attention can be understood as intra attention. The attention mechanism occurs between the elements of the Target (Query) and all elements of the Source. Self-attention refers to the attention mechanism that occurs between elements within the Source or between elements within the Target. It can also be understood as the attention calculation mechanism in the special case where Target = Source. The specific calculation process is the same, only the calculation object changes.

[0144] Image sensors are widely used in cameras and smartphones. Common image sensors use a color filter array (CFA), also known as a Bayer filter, arranged above the photosensitive area. A common arrangement of CFAs is a 2×2 four-pixel circular unit. This unit contains the three primary colors: red (R), green (G), and blue (B), therefore color image sensors are often referred to as RGB image sensors.

[0145] RGB sensors aim to directly simulate the response of the three types of cone cells (L / M / S) in the human eye to the spectrum. This response is a sampling of the complete spectral information, which cannot fully capture spectral details and is prone to metamerism. This results in limited color reproduction performance of existing RGB cameras in challenging scenarios, such as those containing large areas of pure color. Compared to RGB color sensors, multispectral sensors aim to capture the original spectral signal more completely. A multispectral sensor consists of a 4×4 loop of sixteen pixels above the grayscale photosensitive area, with each pixel corresponding to a color filter (or color filter coating). This design increases the sensor's spectral resolution from 3D to 16D, enabling more complete capture of the spectral signal.

[0146] However, due to constraints in filter materials, manufacturing processes, and cost, the raw signals (RAW signals) acquired by image sensors exhibit spectral band aliasing. Therefore, RAW signals need to be analyzed and reconstructed to obtain spectral information. Current implementations suffer from poor accuracy in reconstructing spectral information.

[0147] To address the aforementioned problems, embodiments of this application provide a data processing method. The data processing method of this application embodiment will be described in detail below with reference to the accompanying drawings.

[0148] Reference Figure 6 , Figure 6 This is a flowchart illustrating a data processing method provided in an embodiment of this application, such as... Figure 6 As shown in the embodiment of this application, a data processing method may include steps 601 to 602, which are described in detail below.

[0149] 601. Obtain the first data collected by the image sensor.

[0150] The first data can be the response value of the image sensor.

[0151] For example, refer to Figure 7 , Figure 7 This is a diagram illustrating the response values ​​acquired by the RGB sensor.

[0152] For example, refer to Figure 8 , Figure 8 This is a schematic diagram of a multispectral sensor and the response values ​​it acquires.

[0153] Due to constraints in filter materials, manufacturing processes, and cost, the raw images acquired by image sensors (such as the first data in this embodiment) often exhibit spectral band aliasing. Therefore, they need to be analyzed and reconstructed to obtain spectral information. This embodiment describes the process of analyzing and reconstructing the first data to obtain spectral information.

[0154] In one possible implementation, the spectral information includes multiple response values ​​in a narrowband spectral response space. For example, the spectral information may include the response of each channel to a narrowband (e.g., with a resolution of 10 nm, 5 nm, etc.).

[0155] 602. Based on the first data, spectral information is obtained through a neural network model; wherein the neural network model includes an attention module, the attention module is used to determine an attention matrix based on the input data, and to perform attention operations based on the attention matrix; the attention matrix is ​​obtained by performing a first fusion operation on the correlation information between different channels of the input data and the correlation information of the channels themselves.

[0156] In one possible implementation, the network used for parsing and reconstructing spectral information can be the neural network model in the embodiments of this application, which may include an embedding layer, an encoder, a decoder (optionally, it may also include residual connections between modules).

[0157] Reference Figure 9 , Figure 9 This is a schematic diagram of a neural network model. The overall network structure is a multi-stage U-shaped structure. Thanks to upsampling and downsampling, this structure can capture multi-scale spatial information while reducing computational burden. Feature embedding and mapping: Input RGB color image (or multispectral image MSI), extract image features through convolution operation, reconstruct spectral information based on residual learning, and finally remap the spectral features to the hyperspectral signal HSI output.

[0158] In one possible implementation, the neural network model may include a module for performing attention operations (i.e., the attention module in the embodiments of this application), which may belong to one or more of at least one attention head included in the neural network model.

[0159] For example, the main components of the encoder and decoder in a neural network model can be... Figure 9The codec consists of a hybrid spectral-wise attention block (HSAB), and residual connections can be used in the middle to reduce information loss.

[0160] For example, refer to Figure 10 HSAB can be composed of Layer Normalization, Plausible Spectral-wise Self-Attention (PSA), and Feed-Forward Network (FFN). The FFN is implemented using 3x3 depthwise separable convolutions, and the PSA includes a Spectral-wise Re-Calibration (SRC) module and a Token Independent Mapping (TIM) module.

[0161] The attention module can belong to the PSA (e.g., a head in the PSA). Figure 10 The PSA shown is a schematic diagram of a head.

[0162] In one possible implementation, the attention module is specifically used to perform a linear transformation (e.g., via...) on the input data (optionally, a fusion of the input data and positional encoding). Figure 10 The TIM module shown performs a linear transformation to obtain the K matrix, Q matrix, and V matrix, and determines the attention matrix based on the K matrix, the Q matrix, and the V matrix.

[0163] In the existing implementation, a first transformation matrix Q, a second transformation matrix K, and a third transformation matrix V are used to transform N input vectors respectively.

[0164] <X1,X2,…,XN>Each input vector Xi is transformed to obtain the first intermediate vector (q vector), second intermediate vector (k vector), and third intermediate vector (v vector) corresponding to each input vector. Operationally, the first transformation matrix Q, the second transformation matrix K, and the third transformation matrix V can be used to perform linear transformations on the input matrix X composed of N input vectors to obtain the Q matrix, K matrix, and V matrix of the input matrix, respectively. Then, the matrices are split to obtain the q vector, k vector, and v vector corresponding to each input vector. For any i-th input vector Xi among the N input vectors, the correlation degree between the i-th input vector Xi and each input vector Xj is determined based on the dot product operation of the first intermediate vector (q vector, qi) corresponding to the i-th input vector and each second intermediate vector (k vector, kj) corresponding to each input vector Xj. Although the dot product result of qi and kj can be directly determined as the correlation degree, a more classic approach is to first divide the dot product result by a constant, then perform a softmax operation, and use the result as the correlation degree between the input vector Xi and Xj. The correlation degrees between each input vector can form an attention matrix, i.e.:

[0165]

[0166] Therefore, the correlation degrees αi,j between the i-th input vector Xi and each input vector Xj can be used as weighting factors to perform a weighted combination on the third intermediate vectors (v vectors, vj) corresponding to each input vector Xj (this weighted combination is equivalent to an attention operation based on the attention matrix), to obtain the i-th combination vector Ci corresponding to the i-th input vector Xi:

[0167]

[0168] Therefore, we can obtain a vector sequence of N combined vectors corresponding to N input vectors.<C1,C2,…,CN> Or matrix C. Based on this combined vector sequence, N output vectors can be obtained. Specifically, in one embodiment, the vector sequence of N combined vectors can be directly used as N output vectors, i.e., Yi = Ci. In this case, the output matrix Y is the combined vector matrix C, which can also be written as:

[0169]

[0170] However, in the above implementation, the calculation of the attention matrix only considers the correlation between different channels. In some implementations, when the sizes of the elements in the attention matrix are similar (e.g., all are small or all are large), there is no obvious distinction between different channels, which leads to poor performance of attention operations. Especially in the reconstruction of spectral information, each channel can be considered to have a specific physical meaning. Therefore, the attention matrix needs to represent the distinction between different channels as much as possible to improve the reconstruction accuracy of spectral information.

[0171] In this embodiment of the application, when the attention module calculates the attention matrix, it can fuse the correlation between different channels and the correlation between channels themselves, so that the attention matrix can model the distinguishability between different channels.

[0172] In one possible implementation, the correlation information between the different channels can be determined based on the K matrix and the Q matrix. For example, referring to the embodiments described above...

[0173] In one possible implementation, the correlation information with the channel itself can be determined based on the V matrix.

[0174] In one possible implementation, the correlation information of the channel itself is determined by: performing a second fusion operation on the data within each channel of the V matrix to obtain dimensionality-reduced data; performing convolution on the dimensionality-reduced data and converting the convolution result into a diagonal matrix; the diagonal matrix is ​​used as the correlation information of the channel itself.

[0175] In one possible implementation, the second fusion operation is a global average pooling or convolution operation.

[0176] For example, you can refer to Figure 11A As shown, global average pooling (GAP) or other alternative operations such as convolution can be used to reduce the dimensionality of H×W×C features to 1×C and extract spectral dimension features. Then, one-dimensional convolution is used to map the 1×C features to a specific attention weight vector 1×C. Optionally, the weights of the one-dimensional convolution can be shared in each head branch.

[0177] like Figure 11B As shown, the obtained specific attention weight vector is diagonally embedded (DE) to obtain a C×C matrix. This diagonal matrix is ​​used to fuse the correlation information of the channel itself and the correlation information between channels obtained based on the Q matrix and K matrix to obtain the attention matrix.

[0178] In one possible implementation, the correlation information of the channel itself and the correlation information between channels obtained based on the Q matrix and the K matrix can be fused through a first fusion operation.

[0179] In one possible implementation, the first fusion operation is matrix addition.

[0180] In one possible implementation, the first fusion operation is a weighted summation; the weights corresponding to the correlation information between different channels and the weights corresponding to the correlation information of the channels themselves are learnable parameters.

[0181] For example, the above process can be represented by the following formula:

[0182]

[0183] Where X represents the input feature, Q / K / V represent the query / key / value in the attention mechanism, respectively, which are obtained by linear transformation of X, and σ1 and σ2 are learnable weighting parameters.

[0184] Furthermore, in order to further improve the distinguishability between different channels, this application allows for interactive fusion of the input data (or the fusion of the input data with other data such as positional features) within the channels during the calculation of the K matrix, Q matrix, and V matrix, to obtain the values ​​of the K matrix, Q matrix, or V matrix in the corresponding channels.

[0185] In one possible implementation, a convolution kernel can be applied to one channel of the input data to obtain the values ​​of the K, Q, or V matrices for the corresponding channel. That is, when calculating the K, Q, or V matrices, at least one element of the matrix is ​​calculated using a convolution kernel within one channel of the input data, rather than through interactions between channels. This projection method operates independently on each channel of the spectral features, maintaining the specificity of the spectral information token.

[0186] For example, a first convolutional operation can be performed on the first channel of the input data using a first convolutional kernel to obtain a first convolutional result; a second convolutional operation can be performed on the first channel of the input data using a second convolutional kernel to obtain a second convolutional result; the first and second convolutional results are then concatenated to obtain one of the K, Q, and V matrices. For example, if the above steps are used when calculating the K matrix, the first and second convolutional results are used to concatenate the K matrix (of course, the concatenated objects can also include other convolutional calculation results); if the above steps are used when calculating the Q matrix, the first and second convolutional results are used to concatenate the Q matrix (of course, the concatenated objects can also include other convolutional calculation results); if the above steps are used when calculating the V matrix, the first and second convolutional results are used to concatenate the V matrix (of course, the concatenated objects can also include other convolutional calculation results).

[0187] In one possible implementation, for the same Q matrix, or the same K matrix, or the same V matrix, the same convolution kernel can be used when calculating the values ​​of at least two different channels. For example, the first convolution kernel can be used to perform a convolution operation on the data of the first channel included in the input data to obtain a first convolution result; the second convolution kernel can be used to perform a convolution operation on the data of the first channel included in the input data to obtain a second convolution result, wherein the first convolution kernel and the second convolution kernel are the same.

[0188] The process of calculating the K matrix, Q matrix, or V matrix described above can be... Figure 10 The TIM module in the shown structure is executed.

[0189] like Figure 11C As shown, for one branch (Head) of the multi-head attention mechanism, a convolutional kernel that implements linear mapping can be learned; then the learned convolutional kernel is copied and broadcast inside the head, that is, the convolutional kernel is shared, and it is applied to each channel of the spectral features.

[0190] The above describes the processing flow of an attention head. In the MHA architecture, the MHA layer maintains m sets of transformation matrices. Each set of transformation matrices includes the aforementioned Q, K, and V matrices, allowing the above operations to be performed in parallel, resulting in m combined vector sequences (i.e., m matrices C). Each vector sequence includes N combined vectors obtained based on a set of transformation matrices. In this case, the MHA layer concatenates the m combined vector sequences to obtain a concatenated matrix. Splitting this output matrix Y corresponds to N output vectors.<Y1,Y2,…,YN> Through the above operations, the MHA layer performs transformation operations based on the correlation between the N input vectors to obtain N output vectors.

[0191] The beneficial effects of the embodiments of this application will be described below with reference to experiments.

[0192] This scheme improves spectral signal reconstruction performance by using global average pooling (GAP) and 1D convolution to model spectral specificity. For example... Figure 11D As shown in the visualization results of the attention feature similarity, compared with the industry-representative algorithm (MST++), the embodiment of this application significantly improves the specificity of the spectral features. As shown in Table 1, when the SRC structure is removed from the network model, both the Mean Relative Absolute Error (MRAE) and the Root Mean Square Error (RMSE) increase significantly, demonstrating the effectiveness of the SRC structure.

[0193] Table 1

[0194]

[0195] As shown in Table 2, when the TIM structure is removed from the network model, the mean relative absolute error (MRAE) and root mean square error (RMSE) both increase significantly, thus demonstrating the effectiveness of the TIM structure.

[0196] Table 2

[0197]

[0198] This scheme has low complexity and allows for end-to-end joint optimization among its modules. Based on the proposed spectral remodulation and label-independent mapping model structure, it simultaneously models the correlation and specificity of spectral features. It achieves leading results in spectral signal reconstruction on public datasets. Compared with a series of existing algorithms and the winning scheme MST++ from the NTIRE 2022 Spectral Reconstruction Challenge, the reconstruction error is significantly reduced, as shown in Table 3.

[0199] Table 3

[0200]

[0201] In addition, refer to Figure 12 , Figure 12 A schematic diagram of the structure of a data processing apparatus 1200 provided in this application embodiment includes:

[0202] The acquisition module 1201 is used to acquire the first data collected by the image sensor;

[0203] For a detailed description of the acquisition module 1201, please refer to the description of step 601 in the above embodiment, which will not be repeated here.

[0204] The processing module 1202 is used to obtain spectral information based on the first data through a neural network model; wherein the neural network model includes an attention module, which is used to determine an attention matrix based on the input data and perform attention operations based on the attention matrix; the attention matrix is ​​obtained by performing a first fusion operation on the correlation information between different channels of the input data and the correlation information of the channels themselves.

[0205] For a detailed description of the processing module 1202, please refer to the description of step 602 in the above embodiment, which will not be repeated here.

[0206] In one possible implementation, the attention module is specifically used to perform a linear transformation on the input data to obtain a K matrix, a Q matrix, and a V matrix, and to determine an attention matrix based on the K matrix, the Q matrix, and the V matrix; the correlation information with the channel itself is determined based on the V matrix, and the correlation information between different channels is determined based on the K matrix and the Q matrix.

[0207] In one possible implementation, the correlation information of the channel itself is determined in the following way:

[0208] The data within each channel of the V matrix is ​​subjected to a second fusion operation to obtain the dimensionality-reduced data.

[0209] The dimensionality-reduced data is convolved, and the convolution result is converted into a diagonal matrix; the diagonal matrix is ​​used as the correlation information of the channel itself.

[0210] In one possible implementation, the first fusion operation is matrix addition.

[0211] In one possible implementation, the first fusion operation is a weighted summation; the weights corresponding to the correlation information between different channels and the weights corresponding to the correlation information of the channels themselves are learnable parameters.

[0212] In one possible implementation, the second fusion operation is a global average pooling or convolution operation.

[0213] In one possible implementation, the attention module belongs to at least one attention head in the neural network model.

[0214] In one possible implementation, the processing module 1202 is specifically used for:

[0215] Based on the first convolution kernel, a convolution operation is performed on the first channel data included in the input data to obtain the first convolution result;

[0216] Based on the second convolution kernel, a convolution operation is performed on the first channel data included in the input data to obtain the second convolution result;

[0217] The first convolution result and the second convolution result are used to concatenate to obtain one of the K matrix, Q matrix and V matrix.

[0218] In one possible implementation, the first convolutional kernel and the second convolutional kernel are the same.

[0219] In one possible implementation, the spectral information includes multiple response values ​​in a narrowband spectral response space.

[0220] The following describes an execution device provided in an embodiment of this application. Please refer to [link / reference]. Figure 13 , Figure 13 This is a schematic diagram of an execution device provided in an embodiment of this application. The execution device 1300 can specifically be a virtual reality (VR) device, a mobile phone, a tablet, a laptop, a smart wearable device, a monitoring data processing device, or a server, etc., and is not limited thereto. Specifically, the execution device 1300 includes: a receiver 1301, a transmitter 1302, a processor 1303, and a memory 1304 (wherein the execution device 1300 may have one or more processors 1303). Figure 13(Taking a processor as an example), processor 1303 may include application processor 13031 and communication processor 13032. In some embodiments of this application, receiver 1301, transmitter 1302, processor 1303 and memory 1304 may be connected via bus or other means.

[0221] Memory 1304 may include read-only memory and random access memory, and provides instructions and data to processor 1303. A portion of memory 1304 may also include non-volatile random access memory (NVRAM). Memory 1304 stores processor and operation instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.

[0222] Processor 1303 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together through a bus system, which may include not only the data bus, but also power buses, control buses, and status signal buses. However, for clarity, all buses are referred to as the bus system in the diagram.

[0223] The methods disclosed in the embodiments of this application can be applied to or implemented by the processor 1303. The processor 1303 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 1303 or by instructions in software form. The processor 1303 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and may further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The processor 1303 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 1304. Processor 1303 reads the information from memory 1304 and, in conjunction with its hardware, completes the steps involved in the model inference process described above.

[0224] Receiver 1301 can be used to receive input digital or character information, and to generate signal inputs related to the settings and function control of the execution device. Transmitter 1302 can be used to output digital or character information through the first interface; transmitter 1302 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; transmitter 1302 may also include a display device such as a display screen.

[0225] This application also provides a training device; please refer to [link / reference]. Figure 14 , Figure 14This is a schematic diagram of a training device provided in an embodiment of this application. Specifically, the training device 1400 is implemented by one or more servers. The training device 1400 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1414 (e.g., one or more processors) and memory 1432, and one or more storage media 1430 (e.g., one or more mass storage devices) for storing application programs 1442 or data 1444. The memory 1432 and storage media 1430 can be temporary or persistent storage. The program stored in the storage media 1430 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the training device. Furthermore, the CPU 1414 may be configured to communicate with the storage media 1430 and execute the series of instruction operations in the storage media 1430 on the training device 1400.

[0226] The training device 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input / output interfaces 1458; or, one or more operating systems 1441, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0227] In this embodiment, the central processing unit 1414 is used to perform actions related to model training in the above embodiments.

[0228] This application also provides a computer program product that, when run on a computer, causes the computer to perform steps as performed by the aforementioned execution device, or causes the computer to perform steps as performed by the aforementioned training device.

[0229] This application also provides a computer-readable storage medium storing a program for signal processing, which, when run on a computer, causes the computer to perform steps as performed by the aforementioned execution device, or causes the computer to perform steps as performed by the aforementioned training device.

[0230] The execution device, training device, or terminal device provided in this application embodiment can specifically be a chip. The chip includes a processing unit and a communication unit. The processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, pins, or circuits. The processing unit can execute computer execution instructions stored in the storage unit to cause the chip within the execution device to execute the data processing method described in the above embodiments, or to cause the chip within the training device to execute the data processing method described in the above embodiments. Optionally, the storage unit can be a storage unit within the chip, such as a register or cache. Alternatively, the storage unit can be a storage unit located outside the chip within the wireless access device, such as a read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, such as random access memory (RAM).

[0231] For details, please refer to Figure 15 , Figure 15 This is a schematic diagram of a chip provided in an embodiment of this application. The chip can be represented as a neural network processor (NPU) 1500. The NPU 1500 is mounted as a coprocessor on the host CPU, and tasks are assigned by the host CPU. The core part of the NPU is the arithmetic circuit 1503, which is controlled by the controller 1504 to extract matrix data from the memory and perform multiplication operations.

[0232] In some implementations, the arithmetic circuit 1503 internally includes multiple processing engines (PEs). In some implementations, the arithmetic circuit 1503 is a two-dimensional pulsating array. The arithmetic circuit 1503 can also be a one-dimensional pulsating array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 1503 is a general-purpose matrix processor.

[0233] For example, suppose we have an input matrix A, a weight matrix B, and an output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from the weight memory 1502 and caches it in each PE of the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from the input memory 1501 and performs matrix operations with matrix B. The partial result or the final result of the obtained matrix is ​​stored in the accumulator 1508.

[0234] Unified memory 1506 is used to store input and output data. Weight data is directly transferred to weight memory 1502 via Direct Memory Access Controller (DMAC) 1505. Input data is also transferred to unified memory 1506 via DMAC.

[0235] BIU stands for Bus Interface Unit, which is used for interaction between the AXI bus and the DMAC and the Instruction Fetch Buffer (IFB) 1509.

[0236] The Bus Interface Unit (BIU) 1510 is used by the instruction fetch memory 1509 to fetch instructions from external memory, and also by the memory access controller 1505 to fetch the original data of the input matrix A or the weight matrix B from external memory.

[0237] The DMAC is mainly used to move input data from external memory DDR to unified memory 1506, or to weight data to weight memory 1502, or to input data to input memory 1501.

[0238] The vector computation unit 1507 includes multiple arithmetic processing units that, when needed, further process the output of the computation circuit 1503, such as vector multiplication, vector addition, exponential operations, logarithmic operations, size comparisons, etc. It is mainly used for computation in non-convolutional / fully connected layers of neural networks, such as batch normalization, pixel-level summation, and upsampling of feature planes.

[0239] In some implementations, the vector computation unit 1507 can store the processed output vector in the unified memory 1506. For example, the vector computation unit 1507 can apply a linear function, or a nonlinear function, to the output of the computation circuit 1503, such as linear interpolation of feature planes extracted by a convolutional layer, or, for example, a vector of accumulated values, to generate activation values. In some implementations, the vector computation unit 1507 generates normalized values, pixel-level summed values, or both. In some implementations, the processed output vector can be used as activation input to the computation circuit 1503, for example, for use in subsequent layers of the neural network.

[0240] The instruction fetch buffer 1509 connected to the controller 1504 is used to store the instructions used by the controller 1504;

[0241] Unified memory 1506, input memory 1501, weighted memory 1502, and instruction fetch memory 1509 are all on-chip memories. External memory is proprietary to this NPU hardware architecture.

[0242] The processor mentioned above can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits used to control the execution of the above program.

[0243] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.

[0244] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0245] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.

[0246] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).

Claims

1. A data processing method, characterized in that, The method includes: Acquire the first data collected by the image sensor; Based on the first data, spectral information is obtained through a neural network model; wherein, The neural network model includes an attention module, which determines an attention matrix based on the input data and performs attention operations based on the attention matrix. The attention matrix is ​​obtained by performing a first fusion operation on the correlation information between different channels of the input data and the correlation information within each channel. The correlation information within each channel is the information that distinguishes each channel from the others. Specifically, the attention module performs a linear transformation on the input data to obtain a K matrix, a Q matrix, and a V matrix, and determines the attention matrix based on the K matrix, the Q matrix, and the V matrix. The correlation information within each channel is determined based on the V matrix, and the correlation information between different channels is determined based on the K matrix and the Q matrix. The correlation information of the channel itself is determined in the following way: The data within each channel of the V matrix is ​​subjected to a second fusion operation to obtain the dimensionality-reduced data. The dimensionality-reduced data is convolved, and the convolution result is converted into a diagonal matrix; the diagonal matrix is ​​used as the correlation information of the channel itself.

2. The method according to claim 1, characterized in that, The first fusion operation is matrix addition.

3. The method according to claim 1 or 2, characterized in that, The first fusion operation is a weighted summation; the weights corresponding to the correlation information between different channels and the weights corresponding to the correlation information of the channels themselves are learnable parameters.

4. The method according to any one of claims 1 to 3, characterized in that, The second fusion operation is either global average pooling or convolution.

5. The method according to any one of claims 1 to 4, characterized in that, The attention module belongs to at least one attention head in the neural network model.

6. The method according to any one of claims 1 to 5, characterized in that, The linear transformation of the input data to obtain the K matrix, Q matrix, and V matrix includes: Based on the first convolution kernel, a convolution operation is performed on the first channel data included in the input data to obtain the first convolution result; Based on the second convolution kernel, a convolution operation is performed on the first channel data included in the input data to obtain the second convolution result; The first convolution result and the second convolution result are used to concatenate to obtain one of the K matrix, Q matrix and V matrix.

7. The method according to claim 6, characterized in that, The first convolution kernel and the second convolution kernel are the same.

8. The method according to any one of claims 1 to 7, characterized in that, The spectral information includes multiple response values ​​in the narrowband spectral response space.

9. A data processing apparatus, characterized in that, The device includes: The acquisition module is used to acquire the first data collected by the image sensor; A processing module is used to obtain spectral information based on the first data using a neural network model. The neural network model includes an attention module, which determines an attention matrix based on the input data and performs attention operations based on the attention matrix. The attention matrix is ​​obtained by performing a first fusion operation on the correlation information between different channels of the input data and the correlation information within each channel. The correlation information within each channel is the information that distinguishes it from other channels. Specifically, the attention module performs a linear transformation on the input data to obtain a K matrix, a Q matrix, and a V matrix, and determines the attention matrix based on the K matrix, the Q matrix, and the V matrix. The correlation information within each channel is determined based on the V matrix, and the correlation information between different channels is determined based on the K matrix and the Q matrix. The correlation information of the channel itself is determined in the following way: The data within each channel of the V matrix is ​​subjected to a second fusion operation to obtain the dimensionality-reduced data. The dimensionality-reduced data is convolved, and the convolution result is converted into a diagonal matrix; the diagonal matrix is ​​used as the correlation information of the channel itself.

10. The apparatus according to claim 9, characterized in that, The first fusion operation is matrix addition.

11. The apparatus according to claim 9 or 10, characterized in that, The first fusion operation is a weighted summation; the weights corresponding to the correlation information between different channels and the weights corresponding to the correlation information of the channels themselves are learnable parameters.

12. The apparatus according to any one of claims 9 to 11, characterized in that, The second fusion operation is either global average pooling or convolution.

13. The apparatus according to any one of claims 9 to 12, characterized in that, The attention module belongs to at least one attention head in the neural network model.

14. The apparatus according to any one of claims 9 to 13, characterized in that, The processing module is specifically used for: Based on the first convolution kernel, a convolution operation is performed on the first channel data included in the input data to obtain the first convolution result; Based on the second convolution kernel, a convolution operation is performed on the first channel data included in the input data to obtain the second convolution result; The first convolution result and the second convolution result are used to concatenate to obtain one of the K matrix, Q matrix and V matrix.

15. The apparatus according to claim 14, characterized in that, The first convolution kernel and the second convolution kernel are the same.

16. The apparatus according to any one of claims 9 to 15, characterized in that, The spectral information includes multiple response values ​​in the narrowband spectral response space.

17. A computer storage medium, characterized in that, The computer storage medium stores one or more instructions, which, when executed by one or more computers, cause the one or more computers to perform the operation of the method according to any one of claims 1 to 8.

18. A computer program product, characterized in that, Includes computer-readable instructions that, when executed on a computer device, cause the computer device to perform the method as described in any one of claims 1 to 8.

19. A system comprising at least one processor and at least one memory; the processor and the memory are connected via a communication bus and communicate with each other. The at least one memory is used to store code; The at least one processor is used to execute the code to perform the method as described in any one of claims 1 to 8.

20. A chip, comprising a processor, characterized in that, The processor is used to support the data processing device in implementing the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • RGB-T image semantic segmentation method based on modal difference reduction

    CN112991350A

  • Hyperspectral image reconstruction method based on Transform fused convolutional neural network

    CN115661635A

  • Multispectral image demosaicing method based on convolutional neural network

    CN116029930A