Image processing method, electronic device and storage medium based on neural network model

By mapping the neural network model into a single linked list structure, scanning the output and input of the nodes, determining the node subset and releasing invalid calculation results, the problems of excessive memory usage and slow CPU processing in complex neural network models are solved, and fast image detection is achieved.

CN115908087BActive Publication Date: 2025-09-26HON HAI PRECISION INDUSTRY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111162515.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2025-09-26
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

In complex neural network models, the input and output data of operators are huge, which leads to excessive memory usage of electronic devices and slow CPU processing, resulting in slow image detection speed.

Method used

By mapping the neural network model into a single linked list structure, scanning the output and input of the nodes, establishing data pair vectors, determining the node subset, releasing the calculation results of invalid operators, and reducing memory usage.

Benefits of technology

It improves the speed and efficiency of image detection, reduces memory usage, and enhances CPU processing power.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115908087B_ABST
    Figure CN115908087B_ABST
Patent Text Reader

Abstract

The present application provides an image processing method, electronic device, and storage medium based on a neural network model. The method comprises: obtaining a neural network model, wherein the neural network model includes n operators; determining all terminal operators among the n operators; and when the neural network model processes a target image using the n operators, determining whether to delete the operation results of the n operators based on the n operators and the terminal operators. This application can improve image processing efficiency, thereby enabling rapid acquisition of image detection results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, electronic device, and storage medium based on a neural network model. Background Art

[0002] In practical applications, when an image is processed by a neural network model installed in an electronic device, the feature data of the image is transferred between operators. Generally, it is necessary to record the input data and output data of each operator, and perform further detection of the image through the input data and output data of each operator. However, some complex neural network models have many operators, and the input data and output data of the operators that need to be counted are huge. This will inevitably cause the electronic device to have excessive memory usage, slow CPU processing, and slow image detection speed. Summary of the Invention

[0003] In view of the above, it is necessary to provide an image processing method, electronic device and storage medium based on a neural network model that can quickly output image detection results.

[0004] The present application provides an image processing method based on a neural network model, the method comprising: obtaining a neural network model, wherein the neural network model includes n operators; determining all tail operators among the n operators; inputting a target image into the neural network model, and when the neural network model uses the n operators to process the target image, determining whether to delete the operation results of the n operators based on the n operators and the tail operators; and outputting the processing result of the target image based on the operation result.

[0005] In one possible implementation, determining all the last operators among the n operators includes: determining an operator subgroup in the neural network model based on the n operators; and determining the last operator in the operator subgroup that performs an operation as the last operator of the operator subgroup.

[0006] In a possible implementation, the determining of the operator subgroup in the neural network model based on the n operators includes: mapping the neural network model into a single linked list structure based on the logical operation relationship between the n operators, wherein the single linked list structure includes n nodes; scanning each node in the single linked list structure, and counting the output and input of each node in the neural network model; establishing a data pair vector corresponding to the single linked list structure based on the output and input of each node, wherein the data pair vector is [[a1, b1], [a2, b2], ..., [a i , b i ],…,[a n , bn ]], a i is the output of each node, and bi is the input of each node; multiple node subsets are determined based on the data pair vector; and operator subgroups in the neural network model are determined based on the multiple node subsets.

[0007] In a possible implementation, determining multiple node subsets according to the data pair vector includes: step 21: traversing the data pairs in the data pair vector starting from [a1, b1]; step 22: judging whether the data pair meets the condition of being pushed into the first stack, if the data pair meets the condition of being pushed into the first stack, executing step 23; if the data pair does not meet the condition of being pushed into the first stack, executing step 24; said step 23: pushing the data pair into the first stack; said step 24: judging whether the data pair meets the condition of being popped out of the first stack, if the data pair meets the condition of being popped out of the first stack, executing step 25; if the data pair does not meet the condition of being popped out of the first stack, executing step 27; said step Step 25: Pop the topmost data pair in the current first stack, and count the number m of remaining data pairs in the first stack; Step 26: Determine the starting node corresponding to the topmost data pair in the first stack, and determine the ending node corresponding to the data pair that meets the condition for popping the first stack, and set the subset consisting of all nodes from the starting node to the ending node as the m+1 level node subset; Step 27: Determine whether there are still untraversed data pairs in the data pair vector. If there are still untraversed data pairs in the data pair vector, return to execute step 21 and continue traversing the next data pair in the data pair vector; if all data pairs in the data pair vector have been traversed, end the traversal.

[0008] In one possible implementation, determining the operator subgroup in the neural network model based on the multiple node subsets includes: traversing the multiple node subsets; if the nodes in any node subset of the multiple node subsets do not overlap with the nodes in other node subsets, determining that any node subset is an operator subgroup in the neural network model.

[0009] In one possible implementation, determining the operator subset in the neural network model based on the multiple node subsets also includes: traversing the multiple node subsets to obtain multiple first node subsets and multiple second node subsets, wherein the second node subset truly contains the first node subset; removing all nodes of the first node subset in the second node subset; setting the set of remaining nodes in the second node subset as the operator subset of the neural network model; and setting the multiple first node subsets as the operator subset of the neural network model.

[0010] In one possible implementation, if the data pair [a i , b i ] in the i Greater than or equal to 2, determine the data pair [a i , b i ] satisfies the pop-up condition of the first stack; if the data pair [a i , b i a in ] i Greater than or equal to 2, determine the data pair [a i , b i ]Satisfies the conditions for pushing into the first stack.

[0011] In a possible implementation, the determining whether to delete the operation results of the n operators based on the n operators and the last operator includes: step 31: traversing the n operators; step 32: judging whether the current operator is the last operator, if the operator is not the last operator, executing step 33; if the current operator is the last operator, executing step 37; step 33: judging whether the current operator is an input operator, wherein the input operator is an operator that transfers data to the last operator, if the current operator is not an input operator, executing step 34; if the current operator is an input operator, executing step 36; controlling the current operator; step 34: controlling the current operator to operate on the data and Obtain the operation result, and pass the operation result to the next operator that has a logical operation relationship with the current operator; Step 35: After the current operator passes the operation result, delete the operation result, and then execute Step 38; Step 36: After the current operator operates on the data, push the operation result into the second stack, and then execute Step 38; Step 37: Pop the operation result of the input operator corresponding to the last operator in the second stack, and after passing the operation result to the last operator, delete the operation result, and then go to Step 33; Step 38: Continue to traverse the next operator among the n operators. If all operators in the n operators have been traversed, end the traversal.

[0012] The present application also provides an electronic device, which includes a processor and a memory, and the processor is used to implement the image processing method based on the neural network model when executing the computer program stored in the memory.

[0013] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the image processing method based on the neural network model is implemented.

[0014] The image processing method, electronic device and storage medium based on the neural network model disclosed in this application can quickly output image detection results. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 It is a structural diagram of an electronic device for implementing an image processing method based on a neural network model provided in an embodiment of the present application.

[0016] Figure 2 This is a flowchart of an image processing method based on a neural network model provided in an embodiment of the present application.

[0017] Figure 3 This is a flowchart of the detailed steps of determining multiple node subsets based on the data pair vector in step S2 of an image processing method based on a neural network model provided in an embodiment of the present application.

[0018] Figure 4 This is a detailed step flow chart of step S3 of an image processing method based on a neural network model provided in an embodiment of the present application.

[0019] Figure 5 It is an exemplary single linked list structure provided in the embodiments of the present application.

[0020] Figure 6 This is an exemplary node data transmission diagram provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] In order to make the objectives, technical solutions and advantages of this application clearer, this application is described in detail below with reference to the accompanying drawings and specific embodiments.

[0022] See also Figure 1 , Figure 1 This is a schematic diagram of an electronic device according to an embodiment of the present application. Figure 1 As shown, the electronic device 1 includes, but is not limited to, a memory 11 and at least one processor 12. The above components can be connected via a bus (for example Figure 1 13) shown, can also be connected directly.

[0023] The electronic device 1 can be a computer, mobile phone, tablet computer, personal digital assistant (PDA) or other device with application installed. Figure 1It is only an example of the electronic device 1 and does not constitute a limitation of the electronic device 1. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 1 may also include input and output devices, network access devices, buses, etc.

[0024] like Figure 2 FIG. 1 is a flowchart of a preferred embodiment of the image processing method based on a neural network model of the present application. The image processing method based on the neural network model is applied in the electronic device 1. The order of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted. In this embodiment, the image processing method based on the neural network model includes:

[0025] Step S1: Obtain a neural network model, wherein the neural network model includes n operators.

[0026] In this embodiment, the neural network model can be a neural network model directly obtained from the network end, or a neural network model obtained from the network end and optimized. Optimizing the neural network model can be understood as performing operations such as operator fusion, network pruning, model quantization, and network cutting on the neural network model. In this embodiment, the neural network model includes n operators, namely op1, op2, ..., opn.

[0027] Step S2: Determine an operator subgroup in the neural network model based on the n operators.

[0028] In this embodiment, determining all the last operators among the n operators includes: determining an operator subgroup in the neural network model based on the n operators; and determining the last operator in the operator subgroup that performs an operation as the last operator of the operator subgroup.

[0029] In this embodiment, the electronic device 1 needs to record the input data and output data of each operator when performing image detection through the neural network model. In addition, the data that the electronic device needs to record also includes some invalid data. In this way, the amount of data that the electronic device needs to record is huge, which may cause the memory of the electronic device to be too large and the CPU processing to be slow. In order to improve the processing power of the electronic device and quickly obtain image detection results, the operator subgroup in the neural network model can be searched by the method provided in this application. In the process of detecting the image, the operation data of the operators that are no longer of use value in the operator subgroup and the data of the operator subgroup that has been completed are released, so as to achieve the purpose of reducing memory usage and quickly outputting image detection results.

[0030] In this embodiment, determining an operator subgroup in the neural network model based on the n operators includes:

[0031] (1) Based on the logical operation relationship between the n operators, the neural network model is mapped into a single linked list structure, wherein the single linked list structure includes n nodes. The n nodes are OP1, OP2, ..., OPn, and the n nodes correspond one to one to each operator in the neural network model. Based on the dependency relationship between the n operators, multiple single linked list structures can be obtained. In this embodiment, one of the single linked list structures OP1—>OP2—>...—>OPn is selected for subsequent description. For example, Figure 3 The singly linked list structure shown;

[0032] (2) Scan each node in the single linked list structure and count the output and input of each node in the neural network model. The output represents the number of operators that receive the data when the operator corresponding to the node transmits the data outward in the neural network model; the input represents the number of operators that transmit the data when the operator corresponding to the node receives the data transmitted by other operators in the neural network model. For example, Figure 4 The input of node OP4 is 1 and the output is 4;

[0033] (3) Based on the output and input of each node, a data pair vector corresponding to the single linked list structure is established, wherein the data pair vector is [[a1, b1], [a2, b2], ..., [a i , b i ],…,[a n , b n ]], a i is the output of each node, b i is the input amount for each node;

[0034] (4) Determining multiple node subsets based on the data pair vector. Determining multiple node subsets based on the data pair vector includes:

[0035] See Figure 3 FIG. 1 is a flowchart of the detailed steps of determining multiple node subsets based on the data pair vector in step S2 of an image processing method based on a neural network model disclosed in this application. The order of the steps in the flowchart can be changed and some steps can be omitted according to different requirements.

[0036] S21, traversing the data pairs in the data pair vector starting from [a1, b1];

[0037] S22, judging whether the data pair meets the condition of being pushed into the first stack, wherein the condition of being pushed into the first stack is that the data pair [a i , b i a in ] i ≥2, if the data pair meets the condition of being pushed into the first stack, execute S23; if the data pair does not meet the condition of being pushed into the first stack, execute S24;

[0038] S23, pushing the data pair into the first stack;

[0039] S24, judging whether the data pair meets the pop-up first stack condition, wherein the data pair meets the pop-up first stack condition. i , b i ] in the i ≥2, if the data pair meets the pop-out condition of the first stack, execute S25; if the data pair does not meet the pop-out condition of the first stack, execute S27;

[0040] S25, popping out the topmost data pair in the current first stack, and counting the number m of remaining data pairs in the first stack;

[0041] S26, determining a starting node corresponding to the topmost data pair in the first stack, and determining an ending node corresponding to the data pair that satisfies the condition for popping out of the first stack, and setting a subset consisting of all nodes from the starting node to the ending node as an m+1 level node subset;

[0042] S27, continue traversing the data pairs in the data pair vector, and repeat S22 to S27 until all the data pairs in the data pair vector are traversed;

[0043] S28. End the traversal.

[0044] (5) Determine the operator subgroup in the neural network model based on the multiple node subsets. After the above steps S21 to S28, the multiple node subsets obtained may have two situations. One situation is that there are no duplicate nodes between any two node subsets in the multiple node subsets; the other situation is that one of the multiple node subsets is truly included in the other subsets. For different situations, the method of determining the operator subgroup in the neural network model is also different.

[0045] In one embodiment, determining the operator subgroup in the neural network model based on the multiple node subsets includes: traversing the multiple node subsets; if the nodes in any node subset of the multiple node subsets are not repeated with the nodes in other node subsets, determining each node subset as an operator subgroup in the neural network model.

[0046] In another embodiment, determining the operator subset in the neural network model based on the multiple node subsets includes: traversing the multiple node subsets to obtain multiple first node subsets and multiple second node subsets, wherein the first node subset is truly contained in the second node subset; removing all nodes of the first node subset in the second node subset, and using the remaining node set in the second node subset as the operator subset of the neural network model.

[0047] It should be noted that there are no duplicate nodes in the first node subset and the remaining node sets in the second node subset. Therefore, it is necessary to set the multiple first node subsets as operator subsets of the neural network model.

[0048] (6) Determine the last operator of each operator subgroup. Through step S2, it can be known that the last operator of the operator subgroup may have the input of the operation results of multiple operators. Therefore, during the image processing process, the operation results that are not needed by the last operator can be released, and only the operation results that need to be input to the last operator can be retained, thereby achieving the purpose of reducing memory usage. In this embodiment, the last operator of each operator subgroup obtained in step S2 is determined as the last operator.

[0049] Step S3: input the target image into the neural network model. When the neural network model uses the n operators to process the target image, determine whether to delete the operation results of the n operators based on the n operators and the end operator.

[0050] In this embodiment, when the neural network model performs image detection, the operators will sequentially calculate the image feature data according to priority. After each operator completes the calculation, the calculation result is passed to the next operator. The detection ends when the last operator completes the calculation.

[0051] When the neural network model detects an image, once the result of an operator is passed to the next operator, it becomes useless data. Therefore, the result can be released, thereby reducing memory usage. Furthermore, when the next operator is the final operator, since the final operator requires the results of multiple operators, the result cannot be released and must be temporarily stored until it is passed to the final operator along with the other results.

[0052] In this embodiment, the determining whether to delete the operation results of the n operators based on the n operators and the last operator includes:

[0053] See Figure 4FIG. 1 is a flowchart of the detailed steps for determining whether to delete the operation results of the n operators based on the n operators and the last operator in step S3 of the image processing method based on a neural network model disclosed in this application. The order of the steps in this flowchart may be changed, and some steps may be omitted, depending on different requirements.

[0054] S31: traverse the n operators in sequence;

[0055] S32: Determine whether the current operator is the last operator. If the operator is not the last operator, execute step S33; if the current operator is the last operator, execute step S37;

[0056] S33: Determine whether the current operator is an input operator, wherein the input operator is an operator that transfers data to the end operator. If the current operator is not an input operator, execute step S34; if the current operator is an input operator, execute step S36;

[0057] S34: Control the current operator to operate on the data and obtain an operation result, and pass the operation result to the next operator that has a logical operation relationship with the current operator;

[0058] S35: After the current operator transmits the operation result, the operation result is deleted, and then step S38 is executed;

[0059] S36: After the current operator operates on the data, the operation result is pushed into the second stack, and then the step S38 is executed;

[0060] S37: Popping the operation result of the input operator corresponding to the last operator in the second stack, passing the operation result to the last operator, deleting the operation result, and then the process goes to step S33;

[0061] S38: Continue traversing the next operator among the n operators. If all operators among the n operators have been traversed, end the traversal.

[0062] Since the operators and the nodes are in a one-to-one correspondence, exemplary reasoning can be completed through the nodes, such as Figure 6 As shown, OP3, OP14 and OP15 are the end nodes corresponding to the end operator.

[0063] Traverse the nodes starting from OP1;

[0064] OP1 is not the last node, but OP1 is the input node of the last node OP3, so after OP1 operates on the data, the operation result of OP1 is pushed into the second stack;

[0065] OP2 is not the last node, but is the input node of the last node OP3. Therefore, after OP2 operates on the data, the operation result of OP2 is pushed into the second stack.

[0066] OP3 is the last node, so the calculation results of OP3's input nodes OP1 and OP2 in the second stack need to be popped out and passed to OP3. After the transfer is complete, the calculation results of the input nodes OP1 and OP2 are deleted. Since OP3 is not an input operator, after OP3 completes the calculation results of the input nodes OP1 and OP2 and passes the calculation results to OP4, the calculation results of OP3 are deleted.

[0067] OP4 is neither the last node nor the input node, so after OP4 completes the operation and passes the operation result to OP5, OP6, OP7 and OP8, the operation result of OP4 is deleted;

[0068] OP5, OP6, OP7, and OP8 are neither end nodes nor input nodes, so after the operation is completed and the operation results are passed to OP9, OP10, OP11, and OP12, the operation results of OP5, OP6, OP7, and OP8 are deleted;

[0069] OP9, OP10 and OP11 are not the last nodes, but are input nodes of the last node OP15, so the operation results of OP9, OP10 and OP11 are pushed into the second stack;

[0070] OP12 is not the last node, but is the input node of the last node OP14, so the operation result of OP12 is pushed into the second stack;

[0071] OP13 is not the last node, but the input node of the last node OP14, so the operation result of OP13 is pushed into the second stack;

[0072] OP14 is the last node, so the calculation results of the input nodes OP12 and OP13 in the second stack need to be popped out, and after the calculation results of OP12 and OP13 are passed to OP14, the calculation results of OP12 and OP13 are deleted. Since OP14 is the input node of the last node OP15, the calculation result of OP14 is pushed into the second stack;

[0073] OP15 is the last node, so the operation results of OP9, OP10, and OP11 and the operation result of OP14 in the second stack need to be popped out.

[0074] By releasing computational results that have no use value, memory usage can be reduced and image detection efficiency can be improved.

[0075] Step S4: Based on the calculation result, output the processing result of the target image.

[0076] In this embodiment, after the last operator completes the operation, the operation result of the last operator is used as the detection result of the target image.

[0077] For example, if cells in the target image need to be detected using the neural network model, features of the cells in the target image need to be extracted. The operator's calculation result can be the cell features. By deleting the extracted cell features, memory usage is reduced, CPU processing speed is increased, and cell detection results can be quickly obtained.

[0078] Please continue reading Figure 1 In this embodiment, the memory 11 may be an internal memory of the electronic device 1, that is, a memory built into the electronic device 1. In other embodiments, the memory 11 may also be an external memory of the electronic device 1, that is, a memory externally connected to the electronic device 1.

[0079] In some embodiments, the memory 11 is used to store program codes and various data, and to automatically access programs or data at high speed during the operation of the electronic device 1 .

[0080] The memory 11 may include a random access memory and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0081] In one embodiment, the processor 12 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor may be any other conventional processor, etc.

[0082] If the program code and various data in the memory 11 are implemented in the form of a software functional unit and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, such as implementing the steps in the method of image processing based on a neural network model, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. 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, etc. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), etc.

[0083] It is understood that the module division described above is a logical functional division, and other division methods may be used in actual implementation. In addition, the functional modules in the various embodiments of the present application can be integrated into the same processing unit, or each module can exist physically separately, or two or more modules can be integrated into the same unit. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0084] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit the present application. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application.

Claims

1. An image processing method based on a neural network model, applied in electronic equipment, characterized in that: The image processing method based on the neural network model includes: Obtaining a neural network model, wherein the neural network model includes n operators; Determine all tail operators among the n operators; Input a target image to the neural network model, and when the neural network model uses the n operators to process the target image, determine whether to delete the operation results of the n operators based on the n operators and the last operator, including: using the n operators to operate on data according to priority, after the first operator among the n operators completes the operation, pass the operation result of the first operator to the next second operator, if the second operator is not the last operator, delete the operation result of the first operator, if the second operator is the last operator, temporarily store the operation result of the first operator; Based on the operation result, the processing result of the target image is output.

2. The image processing method based on the neural network model according to claim 1, characterized in that: Determining all the tail operators in the n operators includes: Determining an operator subgroup in the neural network model based on the n operators; The last operator in the operator subgroup to perform an operation is determined as the end operator of the operator subgroup.

3. The image processing method based on the neural network model according to claim 2, characterized in that: Determining an operator subgroup in the neural network model based on the n operators includes: Based on the logical operation relationship between the n operators, mapping the neural network model into a single linked list structure, wherein the single linked list structure includes n nodes; Scan each node in the single linked list structure, and count the output and input of each node in the neural network model; A data pair vector corresponding to the single linked list structure is established based on the output and input of each node, wherein the data pair in the data pair vector represents [a n , b n ], a n is the output of the nth node, b n is the input of the nth node; determining a plurality of node subsets based on the data pair vector; An operator subset in the neural network model is determined based on the multiple node subsets.

4. The image processing method based on the neural network model according to claim 3, characterized in that: Determining a plurality of node subsets according to the data pair vector includes: Step 21: starting from [a1, b1], traverse the data pairs in the data pair vector; Step 22: Determine whether the data pair meets the conditions for being pushed into the first stack. If the data pair meets the conditions for being pushed into the first stack, execute step 23; if the data pair does not meet the conditions for being pushed into the first stack, execute step 24. Step 23: pushing the data pair into the first stack; The step 24: determining whether the data pair meets the pop-out condition of the first stack, if the data pair meets the pop-out condition of the first stack, executing step 25; if the data pair does not meet the pop-out condition of the first stack, executing step 27; Step 25: popping out the topmost data pair in the current first stack, and counting the number m of remaining data pairs in the first stack; Step 26: Determine the starting node corresponding to the topmost data pair in the first stack, and determine the ending node corresponding to the data pair that meets the condition for popping the first stack, and set the subset consisting of all nodes from the starting node to the ending node as the m+1 level node subset; Step 27: Determine whether there are any untraversed data pairs in the data pair vector. If there are any untraversed data pairs in the data pair vector, return to step 21 and continue traversing the next data pair in the data pair vector. If all the data pairs in the data pair vector have been traversed, end the traversal.

5. The image processing method based on the neural network model according to claim 4, characterized in that: If the data pair [a i , b i ] in the i Greater than or equal to 2, determine the data pair [a i , b i ]Satisfy the pop-up condition of the first stack; If the data pair [a i , b i a in ] i Greater than or equal to 2, determine the data pair [a i , b i ] satisfies the conditions for pushing into the first stack.

6. The image processing method based on the neural network model according to claim 3, characterized in that: Determining an operator subgroup in the neural network model according to the plurality of node subsets includes: traversing the plurality of node subsets; If the nodes in any node subset of the multiple node subsets are not repeated with the nodes in other node subsets, the any node subset is determined to be an operator subgroup in the neural network model.

7. The image processing method based on the neural network model according to claim 3, characterized in that: Determining an operator subgroup in the neural network model according to the plurality of node subsets includes: Traversing the multiple node subsets to obtain multiple first node subsets and multiple second node subsets, wherein the second node subset truly contains the first node subset; removing all nodes of the first node subset from the second node subset; Setting the set of remaining nodes in the second node subset as an operator subset of the neural network model; The plurality of first node subsets are set as operator subsets of the neural network model.

8. The image processing method based on a neural network model according to any one of claims 1 to 7, characterized in that: The determining whether to delete the operation results of the n operators based on the n operators and the last operator includes: Step 31: traverse the n operators; Step 32: Determine whether the current operator is the last operator. If the operator is not the last operator, execute step 33; if the current operator is the last operator, execute step 37. Step 33: determining whether the current operator is an input operator, wherein the input operator is an operator that transfers data to the end operator; if the current operator is not an input operator, executing step 34; if the current operator is an input operator, executing step 36; controlling the current operator; Step 34: controlling the current operator to operate on the data and obtain an operation result, and transmitting the operation result to the next operator having a logical operation relationship with the current operator; Step 35: After the current operator transmits the operation result, delete the operation result, and then execute step 38; Step 36: After the current operator operates on the data, the operation result is pushed into the second stack, and then step 38 is executed; Step 37: popping the operation result of the input operator corresponding to the last operator in the second stack, passing the operation result to the last operator, deleting the operation result, and then going to step 33; The step 38: continuing to traverse the next operator among the n operators, and ending the traversal if all operators among the n operators have been traversed.

9. An electronic device, characterized in that: The electronic device includes a processor and a memory, and the processor is used to execute a computer program stored in the memory to implement the image processing method based on the neural network model as described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by the processor, the image processing method based on the neural network model as described in any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Image processing method, electronic device and computer readable storage medium

    CN109559300A

  • Neural network model processing method and device and electronic equipment

    CN110378413A