Image processing method and device, electronic equipment and storage medium
By using quantization parameters in image processing to process the output results of the deep learning network, the problem of low image processing efficiency is solved, and the effect of significantly reducing computing time and memory bandwidth is achieved, while maintaining high prediction accuracy and robustness.
Patent Information
- Application Number
- CN202510025752.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-07
- Publication Date
- 2025-05-09
AI Technical Summary
The prior art has problems with low efficiency in image processing, especially in deep learning networks. Although quantization technology can increase speed, it also leads to a decrease in accuracy and the accumulation of errors is difficult to control.
An image processing method is proposed, by obtaining the image sample set, inputting the pre-trained deep learning network, obtaining the output results and calculating quantization parameters based on these results, and then quantizing the image to be processed, significantly reducing the time and memory bandwidth during the calculation process.
By converting the output results of the neural network into fixed-point operations, the time and memory bandwidth required during the calculation process are significantly reduced, the storage space requirements are reduced, and the quantized model can still maintain high prediction accuracy, and the robustness of the model is improved.
Smart Images

Figure CN119963945A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and specifically provides an image processing method, device, electronic equipment and storage medium. Background Art
[0002] Deep learning is widely used in various branches of artificial intelligence technology, providing sufficient support for industrial-grade productization. However, on the road to implementation, performance indicators such as speed have always been a bottleneck limiting the large-scale and widespread application of deep learning technology. To this end, the existing technology has proposed a method called "quantization technology" to represent data types with fewer memory bits, thereby achieving a certain degree of speed improvement.
[0003] However, quantization technology also introduces the disadvantage of reduced precision. The deep learning network is "deep", which means that a set of data needs to go through dozens, hundreds or even thousands of operations and transfers before the final result can be derived. Even if the numerical accuracy requirements are not high, there is no guarantee that the numerical value will still converge after so many operations. Once the accumulation of errors from quantitative change to qualitative change, the calculation results will be completely uncontrollable. Summary of the invention
[0004] In order to overcome the above defects, the present application is proposed to provide a solution or at least partially solve the technical problem of low efficiency of image processing in existing methods. The present application provides an image processing method, device, electronic device and storage medium.
[0005] In a first aspect, the present application provides an image processing method, the method comprising:
[0006] Acquire an image sample set, wherein the image sample set includes a plurality of sample images;
[0007] Inputting the plurality of sample images into a pre-trained deep learning network to obtain a first output result corresponding to each of the sample images;
[0008] Acquire a first quantization parameter based on the first output result;
[0009] Inputting the image to be processed into the pre-trained deep learning network to obtain a second output result;
[0010] A final output result is obtained according to the second output result and the first quantization parameter.
[0011] In one embodiment of the present application, the first output result includes the output result of each sample image at each layer of the deep learning network;
[0012] The obtaining a first quantization parameter based on the first output result includes:
[0013] According to the output result of each sample image at each layer of the deep learning network, obtaining a second quantization parameter corresponding to the output result of each layer;
[0014] The first quantization parameter is determined according to the second quantization parameter corresponding to the output results of all sample images at each layer.
[0015] In one embodiment of the present application, obtaining the second quantization parameter corresponding to the output result of each layer includes: according to the output result of each layer, obtaining the magnitude and number of effective digits with the minimum error with the output result as the second quantization parameter.
[0016] In one embodiment of the present application, determining the first quantization parameter according to the second quantization parameter corresponding to the output results of all sample images at each layer includes:
[0017] Calculate the average of all second quantization parameters of all samples at each layer;
[0018] An average value of all the second quantization parameters of each layer is used as the first quantization parameter.
[0019] In one embodiment of the present application, determining the first quantization parameter according to the second quantization parameter corresponding to the output results of all sample images at each layer includes:
[0020] Calculate the preset percentiles of all second quantization parameters of all samples at each layer;
[0021] The preset percentile of all the second quantization parameters of each layer is used as the first quantization parameter.
[0022] In one embodiment of the present application, the first quantization parameter includes the magnitude and number of significant digits of the output result of each layer; the second output result is the output result of the image to be processed at each layer of the deep learning network;
[0023] The obtaining a final output result according to the second output result and the first quantization parameter includes:
[0024] performing a shift operation on the second output result according to the magnitude;
[0025] The precision of the second output result is restored according to the number of significant digits to obtain the final output result.
[0026] In one embodiment of the present application, the first quantization parameter includes a magnitude; the shifting operation on the second output result according to the magnitude includes: when the magnitude is a positive number, shifting the second output result to the left by the number of bits corresponding to the magnitude; when the magnitude is a negative number, shifting the second output result to the right by the number of bits corresponding to the magnitude.
[0027] In a second aspect, an image processing apparatus is provided, the apparatus comprising:
[0028] A first acquisition module is configured to acquire an image sample set, wherein the image sample set includes a plurality of sample images;
[0029] An input module is configured to input the plurality of sample images into a pre-trained deep learning network to obtain a first output result corresponding to each of the sample images;
[0030] A second acquisition module, configured to acquire a first quantization parameter based on the first output result;
[0031] The third acquisition module is configured to acquire a final output result according to the image to be processed and the first quantization parameter.
[0032] In a third aspect, an electronic device is provided, comprising:
[0033] at least one processor;
[0034] and, a memory communicatively coupled to the at least one processor;
[0035] Wherein, a computer program is stored in the memory, and the computer program is the aforementioned image processing method when executed by the at least one processor.
[0036] In a fourth aspect, a computer-readable storage medium is provided, wherein a plurality of program codes are stored in the computer-readable storage medium, wherein the program codes are suitable for being loaded and run by a processor to execute any of the aforementioned image processing methods.
[0037] The above one or more technical solutions of this application have at least one or more of the following Beneficial effects:
[0038] The image processing method in the present application specifically includes: obtaining an image sample set, the image sample set includes multiple sample images; inputting multiple sample images into a pre-trained deep learning network to obtain a first output result corresponding to each of the sample images; obtaining a first quantization parameter based on the first output result; inputting the image to be processed into a pre-trained deep learning network to obtain a second output result; and obtaining a final output result based on the second output result and the first quantization parameter. By converting the output results of the neural network into fixed-point operations, the time and memory bandwidth required in the calculation process are significantly reduced. When deployed on resource-constrained devices, the requirements for storage space are reduced. By obtaining the first quantization parameter based on the first output result of the sample image and applying these parameters in actual reasoning, it is ensured that the quantized model can still maintain a high prediction accuracy. Selecting the optimal first quantization parameter based on the actual output data of each layer further reduces the quantization error and improves the robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The disclosure of the present application will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present application. In addition, similar numbers in the drawings are used to represent similar components, among which:
[0040] Figure 1 It is a schematic diagram of the main flow of an image processing method in one embodiment of the present application;
[0041] Figure 2 This is a complete flowchart of an image processing method in one embodiment of the present application;
[0042] Figure 3 is a schematic diagram of the main structure of an image processing device in one embodiment of the present application;
[0043] Figure 4 It is a schematic diagram of the structure of an electronic device in one embodiment of the present application. DETAILED DESCRIPTION
[0044] Some embodiments of the present application are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present application and are not intended to limit the protection scope of the present application.
[0045] In the description of the present application, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, memory, and may also include software parts, such as program code, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware or a combination of the two. Non-temporary computer-readable storage media include any suitable medium that can store program code, such as a disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B" and may include only A, only B or A and B. The singular terms "one" and "the" may also include plural forms.
[0046] The current traditional methods for image processing have low accuracy and slow speed. Therefore, the present application proposes an image processing method, device, electronic device and storage medium.
[0047] See attached Figure 1 , Figure 1 It is a flowchart of the main steps of an image processing method according to an embodiment of the present application.
[0048] like Figure 1 As shown, the image processing method in the embodiment of the present application mainly includes the following steps S10 to S40.
[0049] Step S10: Acquire an image sample set, where the image sample set includes a plurality of sample images.
[0050] An image sample set refers to a set of multiple sample images. The sample images can be images of any scene, such as the field of autonomous driving, face detection, etc., without specific limitation.
[0051] Step S20: Input multiple sample images into a pre-trained deep learning network to obtain a first output result corresponding to each of the sample images.
[0052] A deep learning network is a complex mathematical model consisting of a hierarchical structure of multiple processing units (i.e., neurons or nodes), which typically include an input layer, a hidden layer, and an output layer. The neurons in each layer are connected to the neurons in the next layer through weights, and the weights determine the intensity of information transfer. The network adjusts these weights through a back-propagation algorithm to minimize the prediction error. In this embodiment, the deep learning network can include multiple layers, and the specific number of layers can be determined according to the actual scenario, and is not specifically limited to this.
[0053] Exemplarily, convolutional neural network (CNN), recurrent neural network (RNN), long short-term memory network (LSTM), etc. can be used as examples of the deep neural network.
[0054] The deep learning network can be trained according to the conventional deep learning training process, including but not limited to defining the loss function, selecting the optimizer, setting the hyperparameters, etc., and updating the model weights through the back propagation algorithm. Since the training method of the deep learning network adopts the conventional training method, it will not be described here.
[0055] Specifically, by inputting each sample image into a pre-trained deep learning network, the output result of each sample image at each layer of the deep learning network can be obtained.
[0056] Step S30: Obtain a first quantization parameter based on the first output result.
[0057] Quantization parameters are parameters used to control numerical precision and range. Quantization parameters include magnitude and number of significant digits.
[0058] The magnitude L is a scaling factor used to adjust the overall size of the value. It is usually expressed as an exponential form, such as 2 L or 10 L , depending on whether the base used is binary or decimal.
[0059] The significant digits specify the position of the decimal point in a fixed-point number, that is, the dividing line between the integer part and the fractional part. It determines the precision of the number and is usually expressed as the number of significant digits or the number of bits occupied by the fractional part.
[0060] The first quantization parameter is the magnitude and number of significant digits corresponding to the output results of the sample image at each layer of the deep learning network.
[0061] Specifically, after obtaining the first quantization parameter, a format conversion operation can be performed on the deep learning network so that the deep learning network converts the storage format of the data into a storage format corresponding to the first quantization parameter. The deep learning network will subsequently store data and operate on data in the storage format corresponding to the quantization parameter, and the obtained result only needs to be converted according to the first quantization parameter to obtain the final output result.
[0062] Step S40: obtaining a final output result according to the image to be processed and the first quantization parameter.
[0063] The image to be processed may be a pre-processed image, and specifically may be an image of the same scene as the aforementioned sample image.
[0064] Based on the above steps S10-S40, an image sample set is obtained, which includes multiple sample images; the multiple sample images are input into a pre-trained deep learning network to obtain a first output result corresponding to each of the sample images; a first quantization parameter is obtained based on the first output result; the image to be processed is input into a pre-trained deep learning network to obtain a second output result; and a final output result is obtained according to the second output result and the first quantization parameter. By converting the output results of the neural network into fixed-point operations, the time and memory bandwidth required in the calculation process are significantly reduced. When deployed on resource-constrained devices, the requirements for storage space are reduced and the data processing speed is improved. By obtaining the first quantization parameter based on the first output result of the sample image and applying these parameters in actual reasoning, it is ensured that the quantized model can still maintain a high prediction accuracy. The optimal first quantization parameter is selected according to the actual output data of each layer, which further reduces the quantization error and improves the robustness of the model.
[0065] The above steps S10 to S40 are further explained below.
[0066] For step S10, some sample images can be selected from the training, testing, and verification sample sets, and some sample images can be generated through an intelligent image generation tool. In addition, some extreme samples (such as all-black and all-white images) can be added to form an image sample set for backup.
[0067] The above is a further description of step S10 , and the following is a further description of step S20 .
[0068] Specifically, each sample image in the image sample set is input into the pre-trained deep learning network, so that the deep learning network calculates the data in each sample one by one, and retains the output results of each layer of the network. The result tensor and the calculation parameters of the operator are counted to determine the distribution of these data. In this way, the first output result corresponding to each sample image can be obtained, that is, the output result of each sample image in each layer of the deep learning network.
[0069] The above is a further description of step S20 , and the following is a further description of step S30 .
[0070] Specifically, the above step S30 can be implemented through the following steps S301 to S302.
[0071] Step S301: According to the output result of each sample image at each layer of the deep learning network, obtain a second quantization parameter corresponding to the output result of each layer.
[0072] In a specific embodiment of the present application, obtaining the second quantization parameter corresponding to the output result of each layer includes: according to the output result of each layer, obtaining the magnitude and number of significant digits with the minimum error with the output result as the second quantization parameter.
[0073] Specifically, for the output result of each layer, the magnitude and number of significant digits with the minimum error with the output result are obtained as the second quantization parameter. In this way, the second quantization parameter corresponding to the output result of each image at each layer can be obtained. It should be noted that each layer can use different precision (that is, different quantization parameters), but the original value of the output result of each layer is not changed, which can save computing resources.
[0074] For example, taking the output of the first layer of the deep neural network as 68, in decimal, it can be expressed as 6.8×10 1 , at this time L = 1, B = 2. It can also be expressed as 0.7×10 2 , at this time L = 2, B = 1. But 0.7×10 2 This representation method has a large error, so the magnitude and number of significant digits with the smallest error can be used, that is, 6.8×10 1 Indicates that the error is 0. That is to say, the magnitude can be evaluated according to the data distribution range of each layer, and the effective digit can be evaluated according to the degree of data oscillation (i.e., difference) of the layer.
[0075] Illustratively, the following examples can be used as examples of binary representation.
[0076] It should also be noted that binary can support multiple integer types with different bit widths, such as int3, int4, int8, int11, and int16.
[0077] Step S302: determining the first quantization parameter according to the second quantization parameter corresponding to the output results of all sample images at each layer.
[0078] In a specific embodiment of the present application, determining the first quantization parameter based on the second quantization parameter corresponding to the output results of all sample images at each layer includes: calculating the average value of all second quantization parameters of all samples at each layer; and taking the average value of all second quantization parameters of each layer as the first quantization parameter.
[0079] Specifically, based on all samples, the second quantization parameters (L and B) of each layer are summarized. For each layer, the average value of the second quantization parameters corresponding to all samples is calculated to obtain L avg and B avg Finally, each layer of L avg and B avg As the first quantization parameter of this layer, it is used in the subsequent quantization process.
[0080] By using the average value as the first quantization parameter, the quantization parameters of each layer are ensured to be consistent and stable across the entire sample set. Selecting quantization parameters based on the statistics of all samples can optimize the performance of the model globally, not just for certain specific samples.
[0081] In a specific embodiment of the present application, determining the first quantization parameter based on the second quantization parameter corresponding to the output results of all sample images at each layer includes: calculating the preset percentiles of all second quantization parameters of all samples at each layer; and taking the preset percentiles of all second quantization parameters of each layer as the first quantization parameter.
[0082] The preset percentile refers to a preset percentile used to determine the first quantization parameter. Exemplarily, 95%, 99%, etc. can be used as examples of the preset percentile.
[0083] Specifically, for each layer, two lists can be initialized to store the values of magnitude L and number of significant digits B respectively. Specifically, the second quantization parameter (L i, B i) of each layer is added to the corresponding list. For each layer, L and B corresponding to all samples are sorted, and the number of significant digits at the corresponding position is selected according to the preset percentile.
[0084] Exemplarily, 95% is used as an example of the preset percentile, wherein the magnitude Lpercent ile in the first quantization parameter = percent ile(L,95); the number of significant digits Bpercent ile in the first quantization parameter = percent ile(B,95). Finally, the magnitude Lpercent ile and the number of significant digits Bpercent ile of each layer can be used as the first quantization parameter of the layer.
[0085] By counting the quantization parameters of all sample images at each layer and selecting the preset percentile of these parameters as the first quantization parameter, the influence of extreme values can be eliminated, making the quantization parameters more robust. Ensure that the selected quantization parameters can cover the vast majority of data points, thereby improving the generalization ability of the model. Not only does it improve the selection accuracy of quantization parameters, it also enhances the generalization ability and stability of the model, which is particularly suitable for deep learning applications in resource-constrained environments.
[0086] The above is a further description of step S30 , and the following is a further description of step S40 .
[0087] Specifically, the above step S40 can be implemented through the following steps S401 to S402.
[0088] Step S401: input the image to be processed into a pre-trained deep learning network to obtain a second output result, wherein the second output result is obtained by performing a shift operation on the output result of the image to be processed at each layer of the deep learning network according to the first quantization parameter.
[0089] Specifically, the image to be processed is input into the pre-trained deep learning network to obtain the output result of each layer. The second output result is obtained by performing a shift operation on the output result of each layer of the deep image network of the image to be processed. In fact, in the field of image processing, the output result of the deep learning network is shifted according to the first quantization parameter, which can improve the operation efficiency while reducing the storage amount. That is to say, when using the deep learning network to perform operations, the shifted data is used to perform operations to improve the operation speed.
[0090] In a specific embodiment of the present application, the first quantization parameter includes a magnitude; the second output result is the output result of the image to be processed at each layer of the deep learning network shifted according to the first quantization parameter, including: when the magnitude is a positive number, the output result of each layer of the deep learning network is shifted left by the number of bits corresponding to the magnitude; when the magnitude is a negative number, the output result of each layer of the deep learning network is shifted right by the number of bits corresponding to the magnitude.
[0091] Specifically, for the output results of each layer of the deep neural network of the image to be processed, the output results of each layer are shifted using the magnitude. When the magnitude is a positive number, the second output result is shifted left by the number of digits corresponding to the magnitude; when the magnitude is a negative number, the second output result is shifted right by the number of digits corresponding to the magnitude.
[0092] For example, taking binary as an example, when the magnitude L=2, the output result of the corresponding layer is shifted left by two bits, which is equivalent to multiplying the value by 2. L; When the magnitude L = -2, the output result of the corresponding layer is shifted right by two bits, which is equivalent to dividing the value by 2 L .
[0093] Step S402: Use the first quantization parameter to restore the output result of the last layer of the deep learning network to obtain the final output result.
[0094] Specifically, the final output result is obtained by restoring the output result of the last layer of the deep learning network for the image to be processed using the quantization parameters of all layers in the first quantization parameter. Specifically, the output result of the last layer is updated using the cumulative magnitude of all layers in the first quantization parameter.
[0095] For example, taking binary as an example, the initial level L is set total =0 and the initial number of significant digits S total = 1. Assume that the magnitude of the first layer is L1, the number of significant digits is B1; the magnitude of the second layer is L2, the number of significant digits is B2; the magnitude of the third layer is L3, the number of significant digits is B3, and the deep learning network contains three layers.
[0096] For the first layer, the updated cumulative magnitude is L total =L total +L1.
[0097] For the second layer, the updated cumulative magnitude is L total =L total +L2.
[0098] For the third layer, the updated cumulative magnitude is L total =L total +L3.
[0099] The final result can be expressed as y = x3 × 2 Ltotal , where x3 is the output value of the last layer.
[0100] For example, suppose the quantization parameters of a three-layer network are as follows:
[0101] Layer 1: L1=1, B1=2, and the output is quantized to x1=68.
[0102] Layer 2: L2=2, B2=3, the output after quantization is x2=13.
[0103] Layer 3: L3=1, B3=2, and the output after quantization is x3=7.
[0104] Initialization: L total =0.
[0105] After layer-by-layer processing:
[0106] Layer 1: L total =0+1=1.
[0107] Layer 2: L total =1+2=3.
[0108] Layer 3: L total =3+1=4.
[0109] The final result after recovery is: y = 7 × 2 4 =112.
[0110] Figure 2 This is a complete flowchart of the image processing method of this application. Figure 2 As shown, the image processing method of the present application can be specifically implemented through the following steps S1-S8.
[0111] Step S1: System initialization.
[0112] Step S2: Obtain a deep learning network, such as a convolutional neural network (CNN), a recurrent neural network (RNN), a long short-term memory network (LSTM), etc., and train the deep learning network using a conventional model training method to obtain a pre-trained deep neural network.
[0113] Step S3: construct a sample set, wherein the sample set may include multiple image samples, so as to construct a group of data samples with broad representation, and the number is usually 200 to 500 depending on the complexity of the model.
[0114] Step S4: Input the sample image into the deep learning network to count the data distribution of each intermediate operation (i.e., "tensor") of the network, that is, to count the output results of each layer of the network.
[0115] Step S5: Obtain a second quantization parameter for the output result of each layer, including a magnitude and a number of significant digits, and average all second quantization parameters of each layer to obtain the second quantization parameter of each layer.
[0116] Step S6: Input the image to be processed into the pre-trained deep learning network to obtain the output result of each layer for the image to be processed.
[0117] Step S7: Use the first quantization parameter to perform a shift operation on the output result of each layer for the image to be processed, and then return it to the deep learning network for operation to obtain the second output result of each layer. For example, for the output result of the first layer of the deep learning network for the image to be processed, use the magnitude corresponding to the first layer in the first quantization parameter to shift it, and then input the result obtained after the shift into the second layer parameter operation of the deep learning network.
[0118] Step S8: Perform magnitude restoration on the final output result to obtain the final output result.
[0119] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effect of the present application, different steps do not have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present application.
[0120] Furthermore, the present application also provides an image processing device.
[0121] See attached Figure 3 , Figure 3 It is a main structural block diagram of an image processing device according to an embodiment of the present application.
[0122] like Figure 3 As shown, the image processing device in the embodiment of the present application mainly includes a first acquisition module 11, a first input module 12, a second acquisition module 13, a second input module 14 and a third acquisition module 15. In some embodiments, one or more of the first acquisition module 11, the first input module 12, the second acquisition module 13, the second input module 14 and the third acquisition module 15 can be combined into one module.
[0123] In some embodiments, the first acquisition module 11 may be configured to acquire an image sample set, where the image sample set includes a plurality of sample images.
[0124] The input module 12 can be configured to input the multiple sample images into a pre-trained deep learning network to obtain a first output result corresponding to each of the sample images.
[0125] The second acquisition module 13 may be configured to acquire a first quantization parameter based on the first output result.
[0126] The third acquisition module 14 may be configured to acquire a final output result according to the image to be processed and the first quantization parameter.
[0127] In one implementation, the description of the specific implementation functions can refer to steps S10-S40.
[0128] The image processing device is used to perform Figure 1 The image processing method embodiments shown in the figure have similar technical principles, technical problems solved and technical effects produced. Technicians in this technical field can clearly understand that for the convenience and conciseness of description, the specific working process and related instructions of the image processing device can refer to the contents described in the embodiment of the image processing method, which will not be repeated here.
[0129] Further, it should be understood that since the setting of each module is only for illustrating the functional units of the device of the present application, the physical devices corresponding to these modules may be the processor itself, or a part of the software in the processor, a part of the hardware, or a part of the combination of software and hardware. Therefore, the number of each module in the figure is only schematic.
[0130] It is understood by those skilled in the art that each module in the device can be adaptively split or merged. Such splitting or merging of specific modules will not cause the technical solution to deviate from the principle of the present application, and therefore, the technical solutions after splitting or merging will fall within the protection scope of the present application.
[0131] It is understood by those skilled in the art that all or part of the processes in the method for implementing the above-mentioned embodiment of the present application can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal and software distribution medium, etc. that can carry the computer program code.
[0132] Furthermore, the present application also provides an electronic device, which may include at least one processor; and a memory connected to the at least one processor; wherein a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the image processing method described in any of the above embodiments is implemented. Figure 4 As shown, Figure 4 exemplarily shows the structure of an electronic device, which includes a processor 100 and a memory 200.
[0133] Furthermore, the present application also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present application, the computer-readable storage medium can be configured to store a program for executing the image processing method of the above-mentioned method embodiment, and the program can be loaded and run by the processor to implement the above-mentioned image processing method. For ease of explanation, only the parts related to the embodiment of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application. The computer-readable storage medium can be a memory device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present application is a non-temporary computer-readable storage medium.
[0134] The relevant user personal information that may be involved in the various embodiments of this application is strictly in accordance with the requirements of laws and regulations, following the principles of legality, legitimacy and necessity, based on the reasonable purposes of business scenarios, to process the personal information that users actively provide during the use of products / services or generated due to the use of products / services, as well as the personal information obtained with the user's authorization.
[0135] The user personal information processed by this application will vary depending on the specific product / service scenario, and will be based on the specific scenario in which the user uses the product / service. It may involve the user's account information, device information, driving information, vehicle information or other related information. The applicant will treat the user's personal information and its processing with a high degree of diligence.
[0136] This application attaches great importance to the security of user personal information and has taken reasonable and feasible security protection measures that meet industry standards to protect user information and prevent personal information from being accessed, disclosed, used, modified, damaged or lost without authorization.
[0137] So far, the technical solutions of the present application have been described in conjunction with the specific implementations shown in the accompanying drawings, but it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific implementations. Without departing from the principles of the present application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present application.
Claims
1. An image processing method, characterized in that: The method comprises: Acquire an image sample set, wherein the image sample set includes a plurality of sample images; Inputting the plurality of sample images into a pre-trained deep learning network to obtain a first output result corresponding to each of the sample images; Acquire a first quantization parameter based on the first output result; A final output result is obtained according to the image to be processed and the first quantization parameter.
2. The image processing method according to claim 1, characterized in that: The first output result includes the output result of each sample image at each layer of the deep learning network; The obtaining a first quantization parameter based on the first output result includes: According to the output result of each sample image at each layer of the deep learning network, obtaining a second quantization parameter corresponding to the output result of each layer; The first quantization parameter is determined according to the second quantization parameter corresponding to the output results of all sample images at each layer.
3. The image processing method according to claim 2, characterized in that: The obtaining of the second quantization parameter corresponding to the output result of each layer includes: according to the output result of each layer, obtaining the magnitude and number of effective digits with the minimum error with the output result as the second quantization parameter.
4. The image processing method according to claim 2, characterized in that: The determining the first quantization parameter according to the second quantization parameter corresponding to the output results of all sample images at each layer includes: Calculate the average of all second quantization parameters of all samples at each layer; An average value of all the second quantization parameters of each layer is used as the first quantization parameter.
5. The image processing method according to claim 2, characterized in that: The determining the first quantization parameter according to the second quantization parameter corresponding to the output results of all sample images at each layer includes: Calculate the preset percentiles of all second quantization parameters of all samples at each layer; The preset percentile of all the second quantization parameters of each layer is used as the first quantization parameter.
6. The image processing method according to claim 1, characterized in that: The obtaining a final output result according to the image to be processed and the first quantization parameter includes: Inputting the image to be processed into the pre-trained deep learning network to obtain a second output result, wherein the second output result is obtained by performing a shift operation on the output result of the image to be processed at each layer of the deep learning network according to the first quantization parameter; The output result of the last layer of the deep learning network is restored using the first quantization parameter to obtain a final output result.
7. The image processing method according to claim 6, characterized in that: The first quantization parameter includes a magnitude; the second output result is obtained by performing a shift operation on the output result of each layer of the deep learning network of the image to be processed according to the first quantization parameter, including: when the magnitude is a positive number, shifting the output result of each layer of the deep learning network to the left by the number of bits corresponding to the magnitude; when the magnitude is a negative number, shifting the output result of each layer of the deep learning network to the right by the number of bits corresponding to the magnitude.
8. An image processing device, characterized in that: The device comprises: A first acquisition module is configured to acquire an image sample set, wherein the image sample set includes a plurality of sample images; An input module is configured to input the plurality of sample images into a pre-trained deep learning network to obtain a first output result corresponding to each of the sample images; A second acquisition module, configured to acquire a first quantization parameter based on the first output result; The third acquisition module is configured to acquire a final output result according to the image to be processed and the first quantization parameter.
9. An electronic device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores a computer program, and when the computer program is executed by the at least one processor, the image processing method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by a processor to execute the image processing method according to any one of claims 1 to 7.