Image processing method, device, electronic device and storage medium
By learning compression encoding in the image processing model, using NPU for image processing and transmitting it to the CPU to decode, the problem of high communication load between NPU and CPU in image segmentation processing is solved, and real-time image segmentation processing is realized.
Patent Information
- Application Number
- CN202011112254.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-16
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2040-10-16
AI Technical Summary
Under the CPU-NPU architecture, image segmentation processing leads to excessive communication load between the NPU and the CPU, and existing model pruning and knowledge distillation methods cannot alleviate this problem.
By performing preset image processing model trained by inputting the image to be processed, the neural network processing unit NPU is used for compression processing, and the compressed preset image processing results are obtained, and transmitted to the CPU for decoding, reducing the NPU and Communication load between CPUs.
Through the image processing model learning compression coding during training, the preset image processing results are smaller in size and smaller in amount of data, which reduces the communication load between the NPU and the CPU and realizes real-time image segmentation.
Smart Images

Figure CN114387357B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image processing method, device, electronic equipment and storage medium. Background Art
[0002] Image segmentation is one of the typical application tasks of computer vision. The size of its output is related to the input image size and the number of segmentation categories, which is generally a linear relationship. Under the CPU-NPU (Neural-network Processing Units) architecture, the communication load between the NPU and the CPU increases due to the large output, making real-time image segmentation challenging.
[0003] Currently, neural network operation can be accelerated through model pruning and knowledge distillation. However, knowledge distillation and model pruning are methods that aim to overcome the problem of overly large models or slow model inference speeds and are proposed to compress storage and computing resources. They cannot change the size of the model output feature map and cannot alleviate the problem of excessive communication load between the NPU and the CPU. Summary of the invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide an image processing method, device, electronic device and storage medium that overcome the above problems or at least partially solve the above problems.
[0005] According to a first aspect of an embodiment 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 a trained image processing model, and performing preset image processing on the image to be processed by a neural network processing unit NPU using the image processing model to obtain a preset image processing result after compression processing;
[0008] The preset image processing result is transmitted from the NPU to the CPU, and the preset image processing result is decoded by the CPU to obtain a decoded preset image processing result.
[0009] According to a second aspect of an embodiment of the present invention, there is provided an image processing apparatus, comprising:
[0010] An image acquisition module, used for acquiring an image to be processed;
[0011] An image processing module, used for inputting the image to be processed into a trained image processing model, performing preset image processing on the image to be processed by using the image processing model through a neural network processing unit NPU, and obtaining a preset image processing result after compression processing;
[0012] The processing result decoding module is used to transmit the preset image processing result from the NPU to the CPU, and decode the preset image processing result through the CPU to obtain the decoded preset image processing result.
[0013] According to a third aspect of an embodiment of the present invention, an electronic device is provided, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the image processing method described in the first aspect is implemented.
[0014] According to a fourth aspect of an embodiment 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 as described in the first aspect is implemented.
[0015] The image processing method, device, electronic device and storage medium provided by the embodiments of the present invention input the acquired image to be processed into a trained image processing model, use the image processing model to perform preset image processing on the image to be processed by the NPU to obtain the preset image processing result after compression, transmit the preset image processing result from the NPU to the CPU, and decode the preset image processing result by the CPU to obtain the decoded preset image processing result. Since the image processing model is compressed during the process of performing the preset image processing on the image to be processed, the preset image processing result after compression is smaller in size and smaller in data volume than the image to be processed, so that the amount of data transmitted when the preset image processing result is transmitted from the NPU to the CPU is smaller, thereby reducing the communication load between the NPU and the CPU.
[0016] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the following detailed description of the preferred embodiment.The drawings are only for the purpose of illustrating the preferred embodiments and are not to be construed as limiting the invention.
[0018] Figure 1 is a flowchart of the steps of an image processing method provided by an embodiment of the present invention;
[0019] Figure 2 is a flowchart of the steps of an image processing method provided by an embodiment of the present invention;
[0020] Figure 3 It is a structural block diagram of an image processing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0022] Figure 1 is a flowchart of the steps of an image processing method provided by an embodiment of the present invention. The image processing method is applicable to a scene where the output result of the image processing model is an image, such as Figure 1 As shown, the method may include:
[0023] Step 101: Obtain an image to be processed.
[0024] The image to be processed is an image to be subjected to preset image processing.
[0025] The image to be processed may be obtained through a camera, or according to a storage location of the image to be processed, or an image uploaded by a user may be used as the image to be processed. Of course, the image to be processed may also be obtained through other methods.
[0026] Step 102: input the image to be processed into a trained image processing model, and use the image processing model to perform preset image processing on the image to be processed through the NPU to obtain a preset image processing result after compression processing.
[0027] The image processing model is a convolutional neural network model based on deep learning. When training the image processing model, the sample annotated images in the training samples are compressed and encoded, and the image processing model is trained based on the sample images in the training samples and the compressed and encoded sample annotated images, so that the image processing model can automatically learn the compression encoding process during the training process and can perform preset image processing. The preset image processing may include image segmentation processing, image super-resolution processing or image denoising processing. Accordingly, for each preset image processing, the image processing model may be an image segmentation model, an image super-resolution model or an image denoising model.
[0028] The image to be processed is input into the trained image processing model. Since the image processing model has learned compression coding and preset image processing during the training process, the image processing model can be used by the NPU to perform preset image processing on the image to be processed, and obtain the preset image processing result after compression processing. The compression coding can be binary coding, Huffman coding or run-length coding, or other compression coding methods.
[0029] Step 103: transmitting the preset image processing result from the NPU to the CPU, and decoding the preset image processing result by the CPU to obtain a decoded preset image processing result.
[0030] After the NPU uses the image processing model to perform preset image processing on the image to be processed, the preset image processing result obtained after compression is transmitted from the NPU to the CPU, and the preset image processing result is decoded by the CPU to obtain the decoded preset image processing result. Since the image processing model is compressed at the same time during the process of performing preset image processing on the image to be processed, the preset image processing result obtained is smaller in size and has less data than the image to be processed, so the amount of data transmitted when the preset image processing result is transmitted from the NPU to the CPU is less, reducing the communication load between the NPU and the CPU. After the preset image processing result is transmitted to the CPU, the CPU decodes the preset image processing result to obtain the decoded preset image processing result, and the decoded preset image processing result is the same size as the image to be processed.
[0031] The image processing method provided in this embodiment inputs the acquired image to be processed into a trained image processing model, performs preset image processing on the image to be processed by the NPU using the image processing model to obtain a preset image processing result after compression, transmits the preset image processing result from the NPU to the CPU, and decodes the preset image processing result by the CPU to obtain the decoded preset image processing result. Since the image processing model compresses the image to be processed during the preset image processing, the preset image processing result obtained is smaller in size and has less data volume than the image to be processed, so that the amount of data transmitted when the preset image processing result is transmitted from the NPU to the CPU is less, thereby reducing the communication load between the NPU and the CPU.
[0032] Figure 2 is a flowchart of the steps of an image processing method provided by an embodiment of the present invention. The image processing method is applicable to a scene where the output result of the image processing model is an image, such as Figure 2 As shown, the method may include:
[0033] Step 201: Acquire a training sample set, where the training sample set includes a plurality of sample images and sample annotated images corresponding to the sample images.
[0034] The training sample set can be obtained according to the storage location of the training sample set. The training sample set includes multiple sample images and sample annotated images corresponding to the sample images. The pixel value of each pixel in the sample annotated image annotates the category to which the pixel in the sample image belongs.
[0035] Step 202: compress and encode the sample annotated image to obtain a compressed sample annotated image corresponding to the sample image.
[0036] The sample annotated image is compressed and encoded with a preset kernel size to obtain a compressed sample annotated image corresponding to the sample image, and the size of the compressed sample annotated image is smaller than the size of the sample annotated image. For example, if the size of the sample image and the sample annotated image is W×H, and the preset kernel size is n×n, the size of the compressed sample annotated image is (W / n)×(H / n).
[0037] In one embodiment of the present invention, compressing and encoding the sample annotated image to obtain a compressed sample annotated image corresponding to the sample image includes:
[0038] The sample annotated images are respectively compressed and encoded using a preset encoding method to obtain compressed sample annotated images corresponding to the sample images.
[0039] The preset encoding method may include: binary encoding, Huffman encoding or run-length encoding. Of course, the preset encoding method may also be other encoding methods.
[0040] Different preset encoding methods can be determined according to different requirements, and the sample annotated image can be compressed and encoded using the determined preset encoding method. Since the pixel value of each pixel in the sample annotated image is a label of the category to which the corresponding pixel in the sample image belongs, when the sample annotated image is compressed and encoded, the size and number of categories of the sample annotated image are actually compressed and encoded with a preset kernel size to obtain a compressed sample annotated image. When the image processing model is trained with the compressed sample annotated image, the output result of the image processing model can be compressed and encoded with the corresponding preset encoding method. By using the preset encoding method to compress and encode the sample annotated image, the image processing model can learn the compression encoding method, thereby reducing the size of the image processing result.
[0041] Step 203: training the image processing model according to the multiple sample images and the compressed sample annotated images corresponding to the sample images until the network parameters of the image processing model converge, thereby obtaining a trained image processing model.
[0042] Multiple sample images are respectively input into the image processing model, and the image processing model is trained. The network parameters of the image processing model are adjusted according to the compressed sample processing results obtained during the training process and the corresponding compressed sample annotated images. After the network parameters are adjusted, the next or next batch of sample images are respectively input into the image processing model to perform the above-mentioned training until the network parameters of the image processing model converge and the image processing model training is completed.
[0043] In one embodiment of the present invention, the image processing model is trained according to the multiple sample images and the compressed sample annotated images corresponding to the sample images until the network parameters of the image processing model converge to obtain the trained image processing model, including:
[0044] Selecting at least one sample image from the multiple sample images, and acquiring a compressed sample annotated image corresponding to the at least one sample image;
[0045] Inputting the at least one sample image into the image processing model respectively, and performing compression encoding and preset image processing on the at least one sample image respectively through the image processing model to obtain at least one compressed sample processing result;
[0046] Calculating a loss value corresponding to the loss function according to the at least one compressed sample processing result and a compressed sample annotated image corresponding to the at least one sample image;
[0047] The network parameters of the image processing model are adjusted according to the loss value, and the above operation of training the image processing model through training samples is cyclically performed until the network parameters of the image processing model converge, thereby obtaining a trained image processing model.
[0048] The loss function is a loss function suitable for compressing sample annotated images.
[0049] When training the image processing model, at least one sample image is selected from multiple sample images in the training sample set, and a compressed sample annotated image corresponding to the at least one sample image is obtained, and at least one sample image is input into the image processing model respectively, and at least one sample image is compressed and encoded and preset image processing is performed by the image processing model respectively, and compressed sample processing results corresponding to at least one sample image are obtained, and the compressed sample processing results and compressed sample annotated images corresponding to at least one sample image are substituted into the formula of the loss function, and the loss value corresponding to the loss function is calculated, and the network parameters of the image processing model are adjusted according to the loss value, and then the above operation of training the image processing model through the training samples is cyclically executed until the network parameters of the image processing model converge, and the trained image processing model is obtained. By training the image processing model according to the sample image of the original size and the compressed sample annotated image smaller than the sample image size obtained after compression encoding, the image processing model can learn the compression encoding process during the training process, so that the compressed image processing result output by the image processing model is the processing result of compression encoding, which reduces the data volume of the compressed image processing result output by the image processing model, thereby reducing the communication load between the NPU and the CPU.
[0050] Step 204: Acquire the image to be processed.
[0051] Step 205: input the image to be processed into the trained image processing model, and use the image processing model to perform preset image processing on the image to be processed through the NPU to obtain a preset image processing result after compression processing.
[0052] Step 206: transmitting the preset image processing result from the NPU to the CPU, and decoding the preset image processing result by the CPU to obtain a decoded preset image processing result.
[0053] The image processing method is illustrated below by a specific example. The preset image processing is image segmentation processing as an example. In the pedestrian segmentation task, the training sample set is a pedestrian image data set. The training sample set includes multiple sample images and sample annotated images corresponding to the sample images. The sizes of the sample images and the sample annotated images are W×H respectively, and the size of the image processing result of the image segmentation processing required should also be W×H. The pixel value of the pixel point of the sample annotated image represents the category to which the pixel point belongs in the corresponding sample image. The category to which the pixel point belongs may include pedestrians and non-pedestrians. In the sample annotated image, the value 0 represents non-pedestrians and the value 1 represents pedestrians. During the training process, the sample annotated image is binary compressed and encoded with a preset kernel size of 2×2, that is, a 2×2 area on the sample annotated image is taken for encoding. For example, [1,0; 1,0] is binary encoded. Then 6 is obtained, and the encoded compressed sample annotated image is obtained. The size of the compressed sample annotated image is (W / 2)x(H / 2), and the value range is 0-15. The image processing model is trained according to the sample image and the compressed sample annotated image, so that the image processing model learns the compression coding process. When the trained image processing model is used for image processing, the size of the image to be processed is W×H. The NPU uses the image processing model to segment the image to be processed to obtain a segmented image processing result after compression processing. The size of the segmented image processing result is (W / 2)×(H / 2). Then, the segmented image processing result is transmitted from the NPU to the CPU, and the CPU decodes the segmented image processing result. For example, after decoding 6, [1,0; 1,0] is obtained. After decoding, the final segmented image processing result is obtained, and the size of the segmented image processing result is W×H.
[0054] The image processing method provided in this embodiment obtains a training sample combination, where the training sample set includes multiple sample images and sample annotated images corresponding to the sample images, compresses and encodes the sample annotated images to obtain compressed sample annotated images corresponding to the sample images, and trains an image processing model based on the multiple sample images and the compressed sample annotated images corresponding to the sample images to obtain a trained image processing model. Since the sample annotated images are compressed and encoded, the image processing model can learn the compression encoding process when training the image processing model, so that the output result of the image processing model is compressed and encoded, which reduces the data volume of the output result and can reduce the communication load between the NPU and the CPU.
[0055] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0056] Figure 3 is a structural block diagram of an image processing device provided by an embodiment of the present invention. The image processing device is suitable for use in a scenario where the output result of an image processing model is an image, such as Figure 3 As shown, the image processing device may include:
[0057] An image acquisition module 301 is used to acquire an image to be processed;
[0058] An image processing module 302 is used to input the image to be processed into a trained image processing model, and use the image processing model to perform preset image processing on the image to be processed through a neural network processing unit NPU to obtain a preset image processing result after compression processing;
[0059] The processing result decoding module 303 is used to transmit the preset image processing result from the NPU to the CPU, and decode the preset image processing result through the CPU to obtain a decoded image processing result.
[0060] Optionally, the device further comprises:
[0061] A sample set acquisition module, used to acquire a training sample set, wherein the training sample set includes a plurality of sample images and sample annotated images corresponding to the sample images;
[0062] A compression coding module, used for compressing and coding the sample annotated image to obtain a compressed sample annotated image corresponding to the sample image;
[0063] The model training module is used to train the image processing model according to the multiple sample images and the compressed sample annotated images corresponding to the sample images until the network parameters of the image processing model converge to obtain a trained image processing model.
[0064] Optionally, the compression encoding module is specifically used for:
[0065] The sample annotated images are respectively compressed and encoded using a preset encoding method to obtain compressed sample annotated images corresponding to the sample images.
[0066] Optionally, the preset encoding method includes: binary encoding, Huffman encoding or run-length encoding.
[0067] Optionally, the model training module includes:
[0068] A sample selection unit, configured to select at least one sample image from the plurality of sample images, and obtain a compressed sample annotated image corresponding to the at least one sample image;
[0069] An image processing unit, used to input the at least one sample image into an image processing model, and perform compression encoding and preset image processing on the at least one sample image through the image processing model to obtain at least one compressed sample processing result;
[0070] a loss value calculation unit, configured to calculate a loss value corresponding to a loss function according to the at least one compressed sample processing result and a compressed sample annotated image corresponding to the at least one sample image;
[0071] A model training control unit is used to adjust the network parameters of the image processing model according to the loss value, and cyclically execute the above-mentioned operation of training the image processing model through training samples until the network parameters of the image processing model converge, thereby obtaining a trained image processing model.
[0072] Optionally, the preset image processing includes image segmentation processing, image super-resolution processing or image denoising processing.
[0073] The image processing device provided by the present embodiment inputs the acquired image to be processed into a trained image processing model, performs preset image processing on the image to be processed by the NPU using the image processing model to obtain a preset image processing result after compression, transmits the preset image processing result from the NPU to the CPU, and decodes the preset image processing result by the CPU to obtain the decoded preset image processing result. Since the image processing model simultaneously compresses the image to be processed during the preset image processing, the obtained preset image processing result is smaller in size and has less data volume than the image to be processed, so that the amount of data transmitted when the preset image processing result is transmitted from the NPU to the CPU is less, thereby reducing the communication load between the NPU and the CPU.
[0074] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0075] Furthermore, according to an embodiment of the present invention, an electronic device is provided, which may be a computer or a mobile terminal, etc. The electronic device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, the processor includes an NPU and a CPU, and the computer program implements the image processing method of the aforementioned embodiment when executed by the processor.
[0076] According to one embodiment of the present invention, a computer-readable storage medium is also provided, and the computer-readable storage medium includes but is not limited to a disk storage, a CD-ROM, an optical storage, etc., and a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the image processing method of the aforementioned embodiment is implemented.
[0077] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0078] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0079] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0080] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0081] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0082] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0083] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0084] The above is a detailed introduction to an image processing method, device, electronic device and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. An image processing method, characterized in that: include: Get the image to be processed; Acquire a training sample set, wherein the training sample set includes a plurality of sample images and sample annotated images corresponding to the sample images; Compressing and encoding the sample annotated image to obtain a compressed sample annotated image corresponding to the sample image; Based on the multiple sample images and the compressed sample annotated images corresponding to the sample images, the operation of training the image processing model through the training samples is cyclically performed until the network parameters of the image processing model converge, thereby obtaining a trained image processing model, wherein the operation of training the image processing model through the training samples includes step a, step b, step c and step d: Step a: selecting at least one sample image from the plurality of sample images, and obtaining a compressed sample annotated image corresponding to the at least one sample image; Step b: inputting the at least one sample image into the image processing model respectively, and performing compression encoding and preset image processing on the at least one sample image respectively through the image processing model to obtain at least one compressed sample processing result; Step c: calculating a loss value corresponding to the loss function according to the at least one compressed sample processing result and the compressed sample annotated image corresponding to the at least one sample image; Step d: adjusting the network parameters of the image processing model according to the loss value; Inputting the image to be processed into the trained image processing model, and performing preset image processing on the image to be processed by the neural network processing unit NPU using the image processing model to obtain a preset image processing result after compression processing; The preset image processing result is transmitted from the NPU to the CPU, and the preset image processing result is decoded by the CPU to obtain a decoded preset image processing result.
2. The method according to claim 1, characterized in that The compressing and encoding the sample annotated image to obtain a compressed sample annotated image corresponding to the sample image includes: The sample annotated images are respectively compressed and encoded using a preset encoding method to obtain compressed sample annotated images corresponding to the sample images.
3. The method according to claim 2, characterized in that The preset encoding method includes: binary encoding, Huffman encoding or run-length encoding.
4. The method according to any one of claims 1 to 3, characterized in that: The preset image processing includes image segmentation processing, image super-resolution processing or image denoising processing.
5. An image processing device, characterized in that: include: An image acquisition module, used for acquiring an image to be processed; A sample set acquisition module, used to acquire a training sample set, wherein the training sample set includes a plurality of sample images and sample annotated images corresponding to the sample images; A compression coding module, used for compressing and coding the sample annotated image to obtain a compressed sample annotated image corresponding to the sample image; The model training module is used to cyclically perform the operation of training the image processing model through the training samples based on the multiple sample images and the compressed sample annotated images corresponding to the sample images, until the network parameters of the image processing model converge, thereby obtaining a trained image processing model, wherein the operation of training the image processing model through the training samples includes step a, step b, step c and step d: Step a: selecting at least one sample image from the plurality of sample images, and obtaining a compressed sample annotated image corresponding to the at least one sample image; Step b: inputting the at least one sample image into the image processing model respectively, and performing compression encoding and preset image processing on the at least one sample image respectively through the image processing model to obtain at least one compressed sample processing result; Step c: calculating a loss value corresponding to the loss function according to the at least one compressed sample processing result and the compressed sample annotated image corresponding to the at least one sample image; Step d: adjusting the network parameters of the image processing model according to the loss value; An image processing module, used for inputting the image to be processed into the trained image processing model, performing preset image processing on the image to be processed by using the image processing model through a neural network processing unit NPU, and obtaining a preset image processing result after compression processing; The processing result decoding module is used to transmit the preset image processing result from the NPU to the CPU, and decode the preset image processing result through the CPU to obtain the decoded preset image processing result.
6. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the image processing method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the image processing method according to any one of claims 1 to 4 is implemented.
