Image processing method, system, device, medium and program product
By introducing a sparse module in the image processing model and using matrix multiplication and activation function processing, the problem of poor noise removal in the existing technology is solved, and the signal-to-noise ratio and accuracy of image processing are improved.
Patent Information
- Application Number
- CN202410588642.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-13
- Publication Date
- 2024-09-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing technology, the model based on the encoder-decoder mode does not perform special sparse processing during the signal encoding and decoding process, resulting in poor noise removal effect and low signal-to-noise ratio.
A sparsification module is introduced into the target model, and the signal-to-noise ratio of the image signal is improved through multiplication and activation function processing of the target matrix and its transposed matrix.
Through sparse processing, the noise in the image is significantly reduced, improving the signal-to-noise ratio and the accuracy of image processing.
Smart Images

Figure CN118657678A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to an image processing method, system, device, medium and program product. Background Art
[0002] The current popular model (such as the Transformer model, a neural network model based on the attention mechanism) is the mainstream encoder-decoder mode (encoder is the encoder; decoder is the decoder), which is not only used in the fields of vision, language, and speech, but also has achieved remarkable results in the field of multimodal fusion. The core structure of the encoder-decoder paradigm includes a multi-head attention mechanism network (a processing unit) and a forward neural network (a processing unit). However, when encoding and decoding the signal, no special sparse processing is performed on the signal, so it is not possible to remove noise well and improve the signal-to-noise ratio. Summary of the invention
[0003] The technical problem to be solved by the present disclosure is to overcome the defects of the prior art that noise cannot be removed well and the signal-to-noise ratio is low, and to provide an image processing method, system, device, medium and program product.
[0004] The present invention solves the above technical problems through the following technical solutions:
[0005] As a first aspect of the present invention, there is provided an image processing method, comprising:
[0006] Get the image to be processed;
[0007] Inputting the image to be processed into the trained target model to obtain a processing result of the image to be processed;
[0008] The target model includes at least one layer of processing units, and the data output by each layer of processing units is respectively input into a corresponding sparse module, and the sparse module is used to perform sparse processing on the data and output it.
[0009] Preferably, the sparsification module comprises a target matrix;
[0010] The sparse processing specifically includes:
[0011] Multiplying the data input into the sparsification module by the target matrix to obtain first sparsified data;
[0012] Multiplying the first sparse data by a transposed matrix corresponding to the target matrix to obtain second sparse data;
[0013] The sum of the first sparse data and the second sparse data is input into an activation function, and the output data of the activation function is determined as the output data of the sparse module.
[0014] Preferably, the target model comprises an encoder and a decoder, each of the encoders and each of the decoders comprises the processing unit;
[0015] The data output by each of the processing units is respectively input into the sparseness module corresponding to the processing unit;
[0016] And / or, the target model is used for at least one of classifying the image to be processed, identifying objects in the image to be processed, and cutting the image to be processed.
[0017] Preferably, the step of inputting the image to be processed into a trained target model specifically includes:
[0018] Dividing the image to be processed into a plurality of sub-images, and extracting pixel information corresponding to each pixel in each sub-image;
[0019] According to the sub-images, the pixel information corresponding to each sub-image is input into the trained target model in turn to obtain the pixel information matrix corresponding to each sub-image.
[0020] Preferably, the image processing method further includes:
[0021] Obtain historical image datasets;
[0022] Acquire a training set from the historical image dataset;
[0023] The neural network model is trained according to the training set to obtain the trained target model.
[0024] Preferably, the image processing method further includes:
[0025] Acquire a test set from the historical image dataset;
[0026] Using the test set to test the processing result of the trained target model, to obtain the predicted processing result of the image to be processed corresponding to the test set;
[0027] Obtaining the actual processing result of the image to be processed corresponding to the test set;
[0028] Obtaining a loss value of a trained target model according to the predicted processing result and the actual processing result;
[0029] The trained target model is optimized according to the loss value until a convergence condition is met.
[0030] As a second aspect of the present invention, there is provided an image processing system, comprising:
[0031] An image acquisition module, used for acquiring an image to be processed;
[0032] and a processing module, used for inputting the image to be processed into the trained target model to obtain a processing result of the image to be processed;
[0033] The target model includes at least one layer of processing units, and the data output by each layer of processing units is respectively input into a corresponding sparse module, and the sparse module is used to perform sparse processing on the data and output it.
[0034] As a third aspect of the present invention, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and used to run on the processor, wherein the processor implements the image processing method in the first aspect when executing the computer program.
[0035] As a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the image processing method in the first aspect is implemented.
[0036] As a fifth aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the image processing method as in the first aspect is implemented.
[0037] On the basis of being in accordance with the common sense in the art, the above-mentioned preferred conditions can be arbitrarily combined to obtain the preferred embodiments of the present disclosure.
[0038] The positive and progressive effects of this disclosure are:
[0039] The image to be processed is input into a trained target model including a sparse module, so that the input image to be processed is sparsely processed during the processing using the sparse module, thereby reducing the noise in the image to be processed, improving the signal-to-noise ratio, and improving the accuracy of image processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A flowchart of an image processing method provided by an exemplary embodiment of the present disclosure;
[0041] Figure 2 A schematic diagram of an image processing method provided by an exemplary embodiment of the present disclosure;
[0042] Figure 3 A structural schematic diagram of an image processing system provided by an exemplary embodiment of the present disclosure;
[0043] Figure 4 A schematic diagram of the structure of a device provided by an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0044] The present disclosure is further described below by way of examples, but the present disclosure is not limited to the scope of the examples.
[0045] Prefixes such as "first" and "second" are used in the embodiments of the present disclosure only to distinguish different description objects, and have no limiting effect on the position, order, priority, quantity or content of the described objects. The use of prefixes such as ordinal numbers to distinguish description objects in the embodiments of the present disclosure does not constitute a limitation on the described objects. For the statement of the described objects, please refer to the description in the context of the claims or embodiments, and no unnecessary limitation should be constituted due to the use of such prefixes. In addition, in the description of the present embodiment, unless otherwise specified, the meaning of "plurality" is two or more.
[0046] Example 1
[0047] Figure 1 A flowchart of an image processing method provided by an exemplary embodiment of the present disclosure, the image processing method comprising:
[0048] S1, obtaining the image to be processed;
[0049] S2, input the image to be processed into the trained target model to obtain the processing result of the image to be processed;
[0050] The target model includes at least one layer of processing units, and the data output by each layer of processing units is respectively input into a corresponding sparse module, and the sparse module is used to perform sparse processing on the data and output it.
[0051] In this embodiment, the image to be processed is input into a trained target model including a sparse module, so that the input image to be processed is sparsely processed during the processing using the sparse module, thereby reducing the noise in the image to be processed, improving the signal-to-noise ratio, and improving the accuracy of image processing.
[0052] In one embodiment, the image includes 224×224 pixels, and each pixel includes information of three colors: R, G, and B. The image is converted into a 224×224×3 matrix. The matrix can be input into the target model. Then, when the processing unit processes the information of the pixels in the image, the information of the three colors R, G, and B is output as three-dimensional data.
[0053] See also Figure 2 ,In an optional embodiment, the sparsification module includes a target matrix;
[0054] The sparse processing specifically includes:
[0055] The input to the sparsification module (i.e. Figure 2 The data x in the ISTA sparse matrix f l With the target matrix D l Multiply to get the first sparse data x f l ×D l ;
[0056] The first sparse data x f l ×D l The transposed matrix D corresponding to the target matrix * l Multiply them together to get the second sparse data x f l ×D l ×D * l ;
[0057] The sum x of the first sparse data and the second sparse data is calculated. f l ×D l +x f l ×D l ×D * l Input the activation function and convert the output data x of the activation function into l+1 The output data of the sparse module is determined.
[0058] In the above embodiment, the target matrix may be a positive matrix.
[0059] In an optional embodiment, the target model includes an encoder and a decoder, each of the encoders and each of the decoders includes the processing unit;
[0060] The data output by each of the processing units is respectively input into the sparseness module corresponding to the processing unit.
[0061] In this embodiment, if both the encoder and the decoder include a multi-head attention mechanism network (i.e. Figure 2 The multi-attention mechanism in Figure 2 The feed-forward neural network in .
[0062] In the processing unit, the data x output by the multi-head attention mechanism network m l Input into the forward neural network, the data x output by the forward neural networkf l Input to the sparsification module.
[0063] In the above embodiment, each processing unit corresponds to a sparse module, and the processing unit inputs the output data into the corresponding sparse module.
[0064] In the above embodiment, in the encoder and the decoder, the multi-head attention layer and the position fully connected feedforward network can be connected through a residual layer.
[0065] In the encoder and the decoder, both the encoder and the decoder may include multiple layers of processing unit modules, and each processing unit module may include a multi-head attention layer and a position fully connected feed-forward network.
[0066] In the above embodiment, the intermediate data of the target model can be first input into the multi-head attention layer, then input into the position fully connected feedforward network, and then input into the sparse module. In one embodiment, the output data x of the activation function l +1 It can be used as the input of the multi-head attention layer in the next processing module.
[0067] In an optional embodiment, the target model is used for at least one of classifying the image to be processed, identifying objects in the image to be processed, and cutting the image to be processed.
[0068] In an optional embodiment, step S2 specifically includes:
[0069] Dividing the image to be processed into a plurality of sub-images, and extracting pixel information corresponding to each pixel in each sub-image;
[0070] According to the sub-images, the pixel information corresponding to each sub-image pair is input into the trained target model in turn to obtain the pixel information matrix corresponding to each sub-image.
[0071] In this embodiment, if the pixel includes 224×224 pixels, each pixel includes information of three colors: R, G, and B. A 224×224×3 matrix is obtained. The image is divided into sub-images of 16×16 pixels each. The matrix corresponding to each sub-image is 16×16×3, for a total of 196 sub-images. The 16×16×3 matrix corresponding to the 196 sub-images is input into the target model, and the target model can convert the 196 16×16×3 matrices into a 196×768 (16×16×3=768) matrix.
[0072] In the above embodiment, by dividing the picture into several sub-images, the amount of calculation can be greatly reduced while ensuring the accuracy of the calculation.
[0073] In an optional embodiment, the image processing method further includes:
[0074] Obtain historical image datasets;
[0075] Acquire a training set from the historical image dataset;
[0076] The neural network model is trained according to the training set to obtain the trained target model.
[0077] In an optional embodiment, the image processing method further includes:
[0078] Acquire a test set from the historical image dataset;
[0079] Using the test set to test the processing result of the trained target model, to obtain the predicted processing result of the image to be processed corresponding to the test set;
[0080] Obtaining the actual processing result of the image to be processed corresponding to the test set;
[0081] Obtaining a loss value of a trained target model according to the predicted processing result and the actual processing result;
[0082] The trained target model is optimized according to the loss value until a convergence condition is met.
[0083] Example 2
[0084] Corresponding to the aforementioned image processing method embodiment, the present disclosure also provides an embodiment of an image processing system.
[0085] Figure 3 A schematic diagram of a module of an image processing system provided by an exemplary embodiment of the present disclosure, the system comprising:
[0086] An image acquisition module 201 is used to acquire an image to be processed;
[0087] and a processing module 202, for inputting the image to be processed into the trained target model to obtain a processing result of the image to be processed;
[0088] The target model includes at least one layer of processing units, and the data output by each layer of processing units is respectively input into a corresponding sparse module, and the sparse module is used to perform sparse processing on the data and output it.
[0089] In an optional embodiment, the sparsification module includes a target matrix;
[0090] The sparse processing specifically includes:
[0091] Multiplying the data input into the sparsification module by the target matrix to obtain first sparsified data;
[0092] Multiplying the first sparse data by a transposed matrix corresponding to the target matrix to obtain second sparse data;
[0093] The sum of the first sparse data and the second sparse data is input into an activation function, and the output data of the activation function is determined as the output data of the sparse module.
[0094] In an optional embodiment, the target model includes an encoder and a decoder, and each of the encoders and each of the decoders includes the processing unit;
[0095] The data output by each of the processing units is respectively input into the sparseness module corresponding to the processing unit;
[0096] In an optional embodiment, the target model is used for at least one of classifying the image to be processed, identifying objects in the image to be processed, and cutting the image to be processed.
[0097] In an optional embodiment, the processing module 202 includes a sub-image segmentation unit, which is used to divide the image to be processed into a plurality of sub-images, and extract pixel information corresponding to each pixel in each sub-image;
[0098] According to the sub-images, the pixel information corresponding to each sub-image pair is input into the trained target model in turn to obtain the pixel information matrix corresponding to each sub-image.
[0099] In an optional embodiment, the image processing system further includes a historical data acquisition module and a training module;
[0100] The historical data acquisition module includes a training set acquisition unit;
[0101] The data acquisition module is used to acquire a historical image data set;
[0102] The training set acquisition unit is used to acquire a training set from the historical image data set;
[0103] The training module is used to train the neural network model according to the training set to obtain the trained target model.
[0104] In an optional embodiment, the historical data acquisition module includes a test set acquisition unit and a real processing result acquisition unit, and the training module includes a loss value acquisition unit and a model optimization unit;
[0105] The test set acquisition unit is used to acquire a test set from the historical image data set;
[0106] The result acquisition unit is used to obtain the real processing result of the image to be processed corresponding to the test set;
[0107] The loss value acquisition unit is used to test the processing result of the trained target model using the test set, obtain the predicted processing result of the image to be processed corresponding to the test set, and obtain the loss value of the trained target model according to the predicted processing result and the actual processing result;
[0108] The model optimization unit is used to optimize the trained target model according to the loss value until a convergence condition is met.
[0109] As for the system embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The system embodiment described above is only illustrative, wherein the units described as separate components may or may not be physically separated, and the components as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the disclosed solution.
[0110] Example 3
[0111] Figure 4 This is a schematic diagram of the structure of an electronic device shown in an example embodiment of the present disclosure, the electronic device includes a memory, a processor, and a computer program stored in the memory and used to run on the processor, and the processor implements the image processing method described in any of the above embodiments when executing the computer program. Figure 4 The electronic device 90 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0112] like Figure 4 As shown, the electronic device 90 may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 90 may include, but are not limited to: at least one processor 91, at least one memory 92, and a bus 93 connecting different system components (including the memory 92 and the processor 91).
[0113] The bus 93 includes a data bus, an address bus, and a control bus.
[0114] The memory 92 may include a volatile memory, such as a random access memory (RAM) 921 and / or a cache memory 922 , and may further include a read-only memory (ROM) 923 .
[0115] The memory 92 may also include a program tool 925 (or utility) having a set (at least one) of program modules 924, such program modules 924 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include an implementation of a network environment.
[0116] The processor 91 executes various functional applications and data processing by running the computer programs stored in the memory 92, such as the image processing method provided in any of the above embodiments.
[0117] The electronic device 90 may also communicate with one or more external devices 94 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 95. Furthermore, the electronic device 90 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 96. As shown, the network adapter 96 communicates with other modules of the electronic device 90 via a bus 93. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 90, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.
[0118] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.
[0119] Example 4
[0120] The embodiments of the present disclosure further provide a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the image processing method provided by any of the above embodiments is implemented.
[0121] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.
[0122] Example 5
[0123] The embodiment of the present disclosure further provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the image processing method described in any one of the above items is implemented.
[0124] Among them, the program code for executing the computer program product of the present disclosure can be written in any combination of one or more programming languages, and the program code can be executed completely on the user device, partially on the user device, as an independent software package, partially on the user device and partially on a remote device, or completely on the remote device.
[0125] Although the specific embodiments of the present disclosure are described above, those skilled in the art should understand that this is only an example, and the protection scope of the present disclosure is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present disclosure, but these changes and modifications all fall within the protection scope of the present disclosure.
Claims
1. An image processing method, characterized in that: The image processing method comprises: Get the image to be processed; Inputting the image to be processed into the trained target model to obtain a processing result of the image to be processed; The target model includes at least one layer of processing units, and the data output by each layer of processing units is respectively input into a corresponding sparse module, and the sparse module is used to perform sparse processing on the data and output it.
2. The image processing method according to claim 1, characterized in that: The sparsification module includes a target matrix; The sparse processing specifically includes: Multiplying the data input into the sparsification module by the target matrix to obtain first sparsified data; Multiplying the first sparse data by a transposed matrix corresponding to the target matrix to obtain second sparse data; The sum of the first sparse data and the second sparse data is input into an activation function, and the output data of the activation function is determined as the output data of the sparse module.
3. The image processing method according to claim 1, characterized in that: The target model comprises an encoder and a decoder, each of the encoders and each of the decoders comprises the processing unit; The data output by each of the processing units is respectively input into the sparseness module corresponding to the processing unit; And / or, the target model is used for at least one of classifying the image to be processed, identifying objects in the image to be processed, and cutting the image to be processed.
4. The image processing method according to claim 1, wherein: The step of inputting the image to be processed into the trained target model specifically includes: Dividing the image to be processed into a plurality of sub-images, and extracting pixel information corresponding to each pixel in each sub-image; According to the sub-images, the pixel information corresponding to each sub-image pair is input into the trained target model in turn to obtain the pixel information matrix corresponding to each sub-image.
5. The image processing method according to claim 1, wherein: The image processing method further comprises: Obtain historical image datasets; Acquire a training set from the historical image dataset; The neural network model is trained according to the training set to obtain the trained target model.
6. The image processing method according to claim 5, characterized in that: The image processing method further comprises: Acquire a test set from the historical image dataset; Using the test set to test the processing result of the trained target model, to obtain the predicted processing result of the image to be processed corresponding to the test set; Obtaining the actual processing result of the image to be processed corresponding to the test set; Obtaining a loss value of a trained target model according to the predicted processing result and the actual processing result; The trained target model is optimized according to the loss value until a convergence condition is met.
7. An image processing system, characterized in that: The image processing system comprises: An image acquisition module, used for acquiring an image to be processed; and a processing module, used for inputting the image to be processed into the trained target model to obtain a processing result of the image to be processed; The target model includes at least one layer of processing units, and the data output by each layer of processing units is respectively input into a corresponding sparse module, and the sparse module is used to perform sparse processing on the data and output it.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and used to run on the processor, characterized in that: When the processor executes the computer program, the image processing method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Data processing method and device, computer equipment and readable storage medium
CN111210010A
Systems and methods for sparse matrix multiplication
US20230385374A1
