Image processing method, device, computer equipment and storage medium

By extracting original image features, image area features and position features, combined with the attention mechanism, target image features are generated, which solves the image processing problem that has a great impact on manual recognition in the existing technology and improves the accuracy of the recognition results.

CN113569867BActive Publication Date: 2024-10-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110083964.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-21
Publication Date
2024-10-29
Estimated Expiration
2041-01-21

Smart Images

  • Figure CN113569867B_ABST
    Figure CN113569867B_ABST
Patent Text Reader

Abstract

The embodiment of the present application proposes an image processing method, specifically: obtaining an image to be processed containing a target object; extracting the original image features of the image to be processed, the original image features include N original feature maps, any original feature map includes K feature map pixels, and the feature map pixels at the same position in the N original feature maps correspond to an image region of the image to be processed; determining K image region features based on the attention mechanism and the N original feature maps; respectively obtaining the position features of each image region in the original image features, and superimposing the original image features, K image region features and K position features as the target image features of the image to be processed; performing recognition processing on the target image features to obtain the object recognition result of the target object. Through the present application, the accuracy of the image recognition results is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to an image processing method, apparatus, computer equipment and storage medium. Background Art

[0002] With the continuous development and evolution of Internet technology, image processing is closely related to people's daily life and has been widely used in many fields such as text recognition, medical image processing, and remote sensing image processing.

[0003] At present, the implementation of image processing is mainly based on manual recognition. Specifically, when an image to be processed that needs to be processed is obtained, the image to be processed is analyzed manually, and the image recognition result corresponding to the image to be processed is finally identified based on past experience and common knowledge. The image recognition result obtained by manual analysis based on the existing method may be affected by the user's subjective influence and is therefore not accurate enough. Summary of the invention

[0004] The embodiments of the present application propose an image processing method, apparatus, computer device and storage medium, which can determine target image features including original image features, image area features and position features, improve the accuracy of target image features, and further improve the accuracy of object recognition results.

[0005] An embodiment of the present application provides an image processing method, including:

[0006] Obtain an image to be processed containing a target object;

[0007] Extracting original image features of the image to be processed, where the original image features include N original feature maps, any original feature map includes K feature map pixels, feature map pixels at the same position in the N original feature maps correspond to an image region of the image to be processed, and N and K are positive integers;

[0008] Determine K image region features of K image regions in the image to be processed based on the attention mechanism and the N original feature maps;

[0009] Respectively obtain the position features of each image region in the original image features, and superimpose the original image features, the K image region features and the K position features as the target image features of the image to be processed;

[0010] The target image features are identified and processed to obtain an object recognition result of the target object.

[0011] An embodiment of the present application provides an image processing device, including:

[0012] An acquisition unit, used for acquiring an image to be processed containing a target object;

[0013] An extraction unit, used to extract original image features of the image to be processed, the original image features include N original feature maps, any original feature map includes K feature map pixels, the feature map pixels at the same position in the N original feature maps correspond to an image region of the image to be processed, and N and K are positive integers;

[0014] A determination unit, configured to determine K image region features of K image regions in the image to be processed based on an attention mechanism and the N original feature maps;

[0015] A processing unit, used to respectively obtain the position features of each image region in the original image features, and superimpose the original image features, the K image region features and the K position features as target image features of the image to be processed;

[0016] The recognition unit is used to perform recognition processing on the target image features to obtain an object recognition result of the target object.

[0017] On one hand, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the methods in the above embodiments.

[0018] On the one hand, an embodiment of the present application provides a computer storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the methods in the above embodiments are executed.

[0019] On the one hand, an embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. When the computer instructions are executed by a processor of a terminal device, the methods in the above embodiments are executed.

[0020] Through the image processing method of the embodiment of the present application, first, the terminal device can extract the original image features of the image to be processed containing the target object, wherein the original image features include N original feature maps, any original feature map includes K feature map pixels, and the feature map pixels at the same position in the N original feature maps correspond to an image area of ​​the image to be processed. Secondly, the terminal device can determine K image area features of K image areas in the image to be processed based on the attention mechanism and the N original feature maps. Then, the terminal device can obtain the position features of each image area in the original image features respectively, and superimpose the original image features, K image area features and K position features as the target image features of the image to be processed. Compared with manual image recognition, this scheme is to automatically identify the image to be processed by a machine, and can extract image area features that can reflect global information based on the attention mechanism, thereby improving the accuracy of the target image features; further, since the original image features and position features are also extracted, the feature extraction methods are rich and varied, and all features are superimposed as target image features, thereby improving the accuracy of the target image features. Subsequently, the object recognition result of the target object can be obtained based on the target image features, thereby further improving the accuracy of the object recognition result. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 is a structural schematic diagram of an image processing system provided in an embodiment of the present application;

[0023] Figure 2a This is a schematic diagram of an interface of a terminal device provided in an embodiment of the present application;

[0024] Figure 2b This is a schematic diagram of a scene for extracting original image features provided by an embodiment of the present application;

[0025] Figure 2c This is a schematic diagram of a scenario for extracting image region features provided by an embodiment of the present application;

[0026] Figure 2d 1 is a schematic diagram of a scenario for extracting a convolution operation provided by an embodiment of the present application;

[0027] Figure 2e is a schematic diagram of a scene for determining target image features provided by an embodiment of the present application;

[0028] Figure 2f is a schematic diagram of a scene for determining an object recognition result provided by an embodiment of the present application;

[0029] Figure 2g is a schematic diagram of an image processing scenario provided by an embodiment of the present application;

[0030] Figure 2h is a schematic diagram of an image processing scenario provided by an embodiment of the present application;

[0031] Figure 3 It is a flowchart of an image processing method provided by the present application;

[0032] Figure 4 It is a flowchart of a self-attention mechanism provided in an embodiment of the present application;

[0033] Figure 5 is a schematic diagram of a process for determining image region features provided by an embodiment of the present application;

[0034] Figure 6 It is a flowchart of a training image processing model provided in an embodiment of the present application;

[0035] Figure 7a is a schematic diagram of a sample image set provided in an embodiment of the present application;

[0036] Figure 7b It is a flowchart of a training sample image processing model provided in an embodiment of the present application;

[0037] Figure 7c It is a flowchart of a training discriminator provided in an embodiment of the present application;

[0038] Figure 8 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;

[0039] Fig. 9 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0041] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0042] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0043] The solution provided in the embodiment of the present application belongs to the deep learning technology and machine learning technology in the field of artificial intelligence.

[0044] Machine Learning (ML) / Deep Learning (DL) is a multi-disciplinary cross-discipline involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.

[0045] In this application, it mainly involves extracting original image features of an image to be processed using machine learning technology, obtaining position features of each image region in the original image features using machine learning technology, and performing recognition processing on target image features using machine learning technology to obtain object recognition results of the target object. In addition, it involves determining K image region features of K image regions in the image to be processed based on the attention mechanism and N original feature maps contained in the original image features using deep learning technology.

[0046] The present application can be applied to the following scenarios: when an image to be processed containing a target object is acquired and object recognition is to be performed on the target object in the image to be processed, the scheme of the present application can be used to extract the original image features, image area features and position features of the image to be processed, and the object recognition result of the target object can be determined based on the original image features, image area features and position features.

[0047] Specifically, if the target object includes a formula object, the object recognition result determined according to the present application may include a typesetting code sequence of the formula object. More specifically, the present application can be used in a photo search scenario. Specifically, mathematical formulas are widely present in various documents and test questions. The solution provided by the present application can be used for offline mathematical formula recognition, and the mathematical symbols in the picture are analyzed to generate the Latex code corresponding to the picture. Since mathematical symbols are difficult to directly use as input for a search engine, the present application solution can be used as a component of a search engine to convert the mathematical symbols in the picture into a Latex code that is easy to retrieve. Then, in the search interface, the Latex code is used as input to search for the corresponding question in the question bank, thereby realizing the function of searching for questions. In addition, the present application can realize the electronicization of documents, test questions, etc. containing mathematical symbols, reducing the burden on text editors.

[0048] Specifically, if the target object includes a character object, the object recognition result determined according to the present application includes a typesetting code sequence of the character object. The present application can be used for photo recognition scenarios. Specifically, the solution provided by the present application can be used for offline character sequence recognition, by analyzing the character sequence in the image, generating a Latex code sequence corresponding to the image, or a Java code sequence and a Python code sequence, etc.

[0049] Specifically, if the target object includes a first character object, the object recognition result determined according to the present application includes a second character object, wherein the language type of the first character object and the language type of the second character object are different. The present application can be used in a picture translation scenario. Specifically, the user selects an image to be processed that requires image recognition, and then uses the solution of the present application to identify the image to be processed containing the first character object, and outputs the recognition result of the image to be processed (the second character object). For example, if the language type of the first character object is Chinese, the language type of the second character object can be English. Therefore, the effects of image recognition and character translation are achieved.

[0050] See also Figure 1 , see Figure 1 , Figure 11 is a schematic diagram of the structure of an image processing system provided by an embodiment of the present application. A server 140 and a terminal device cluster, wherein the terminal device cluster may include: a terminal device 110, a terminal device 120, ..., a terminal device 130, etc. The terminal device cluster and the server 140 may be directly or indirectly connected via wired or wireless communication, and the present application does not limit this.

[0051] Figure 1 The server 140 shown can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.

[0052] Figure 1 The terminal device 110, terminal device 120, terminal device 130, etc. shown in the figure can be a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile Internet device (MID), a vehicle, a roadside device, an aircraft, a wearable device such as a smart watch, a smart bracelet, a pedometer, etc., and other smart devices with image processing functions.

[0053] Taking the terminal device 110 as an example, the terminal device 110 obtains an image to be processed containing a target object; the terminal device sends the image to be processed containing the target object to the server 140. The server 140 extracts the original image features of the image to be processed, wherein the original image features include N original feature maps, any original feature map includes K feature map pixels, and the feature map pixels at the same position in the N original feature maps correspond to an image region of the image to be processed. The server 140 determines K image region features of the K image regions in the image to be processed based on the attention mechanism and the N original feature maps. The server 140 obtains the position features of each image region in the original image features respectively, and superimposes the original image features, the K image region features and the K position features as the target image features of the image to be processed. The server 140 performs recognition processing on the target image features to obtain an object recognition result of the target object.

[0054] Subsequently, the server 140 may send the object recognition result of the target object to the terminal device 110, and the terminal device 110 may output the object recognition result; or, the terminal device 110 may further post-process the image to be processed according to the object recognition result to output the post-processing result.

[0055] Of course, extracting the original image features of the image to be processed, determining K image region features of K image regions in the image to be processed based on the attention mechanism and the N original feature maps included in the original image features, obtaining the position features of each image region in the original image features, and performing recognition processing on the target image features to obtain the object recognition result of the target object can also be performed by the terminal device 110 or any terminal device in the terminal device cluster.

[0056] It can be understood that the system architecture diagram described in the embodiment of the present application is for more clearly illustrating the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. A person of ordinary skill in the art can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.

[0057] See also Figure 2a , Figure 2a Schematic diagram of the interface of a computer device provided in an embodiment of the present application. Figure 2a As shown, the user can select the image to be processed in the album interface of the computer device. The image to be processed may include a target object, and the target object may be a formula object or a character object. Figure 2a The image to be processed shown includes a formula object, and the formula object is specifically -ik / 12π. After the terminal device obtains the image to be processed, it performs original image feature extraction, image region feature extraction, and position feature extraction on the image to be processed.

[0058] See also Figure 2b , Figure 2b Schematic diagram of a scene for extracting original image features provided by an embodiment of the present application. Figure 2b As shown, the computer device can identify and process the image to be processed containing the target object (formula object) through a convolutional neural network model (CNN) to obtain the original image features of the image to be processed. Among them, the convolutional neural network model is the most commonly used model for extracting features from an image, and the convolution operator only aggregates information in the local neighborhood, that is, it only focuses on the local features of the image. Among them, the original image features include N original feature maps, any original feature map includes K feature map pixels, and the feature map pixels at the same position in the N original feature maps correspond to an image area of ​​the image to be processed. Specifically, N is the feature dimension of the original image feature, and the feature dimension can specifically be the number of channels.

[0059] See also Figure 2c , Figure 2c FIG. 1 is a schematic diagram of a scenario for extracting image region features provided by an embodiment of the present application. Figure 2cAs shown, the computer device performs three 1*1 convolution operations on the original image features, that is, f(x), g(x), and h(x) each represent a 1*1 convolution operation. Of course, f(x), g(x), and h(x) can also be linear transformation operations in addition to convolution operations, and this embodiment of the application does not limit this.

[0060] For the convolution operation, see Figure 2d , Figure 2d FIG. 1 is a schematic diagram of a scenario in which a convolution operation is extracted according to an embodiment of the present application. Figure 2d As shown, for any original feature map among the N original feature maps included in the original image feature, the computer device can perform a convolution operation on the original feature map according to the convolution kernel. Specifically, if the convolution kernel is a 1*1 convolution kernel, the computer device performs a 1*1 convolution operation on the original feature map, and the number of convolution kernels is equal to the feature dimension of the original image feature (i.e., the number of channels N). Therefore, after the convolution operation of the N convolution kernels, the convolution feature corresponding to the original feature map can be obtained.

[0061] In one possible implementation, since the parameters of the convolution kernel may be different, the convolution features corresponding to each convolution operation are different, that is, f(x), g(x) and h(x) are different from each other. By calculating the attention weights of f(x) and g(x) through the attention mechanism, the feature similarity between any two image regions i and image region j in the image to be processed can be obtained, and then, based on the obtained feature similarity and h(x), a weighted summation operation is performed to obtain the regional features of each image region. Since this scheme can obtain the similarity between any two image regions in the image to be processed after the convolution operation and combined with the attention mechanism, the image region features finally extracted by the computer device focus on other region positions except the region position itself, so the image region feature is a global feature. It should be noted that the feature dimension of the image region feature is the same as the feature dimension of the original image region feature.

[0062] See also Figure 2e , Figure 2e is a schematic diagram of a scenario for determining target image features provided by an embodiment of the present application. Figure 2e As shown, after the computer device obtains the image region features, the computer device can also obtain the position features of each image region in the original image features according to the original image features, wherein the feature sizes of the position features, the original image features, and the image region features are the same (assuming they are all H×W). Then, the computer device can superimpose the original image features, the K image region features, and the K position features as the target image features of the image to be processed.

[0063] See also Figure 2f , Figure 2f It is a schematic diagram of a scenario for determining an object recognition result provided by an embodiment of the present application. In one possible implementation, a computer device calls a decoder to perform recognition processing on a target image feature to obtain an object recognition result of the target object. Specifically, in the actual processing process, a feature vector corresponding to each feature map pixel in the K feature map pixels is input into a decoder for decoding processing, and after processing by the decoder, an object recognition result (-\frac{ik}{12\pi}) corresponding to the target object (-ik / 12π) is finally output.

[0064] In a possible implementation, the solution provided by the present application can be applied to scenarios such as mathematical expression recognition (MER) and character recognition. Specifically, if the target object includes a formula object, the object recognition result includes a typesetting code sequence of the formula object; if the target object includes a character object, the object recognition result includes a typesetting code sequence of the character object; if the target object includes a first character object, the object recognition result includes a second character object, wherein the language type of the first character object is different from the language type of the second character object (which may correspond to a text translation scenario).

[0065] See also Figure 2g , Figure 2g This is a schematic diagram of an image processing scenario provided by an embodiment of the present application. The user can select an image to be processed with a formula object in the mobile phone, and then the user clicks the "Send" button, and the computer device can send the image to be processed to the server, so that the server performs image processing on the image to be processed and obtains the object recognition result of the formula object, and then the server sends the object recognition result of the formula object to the mobile phone, and displays the object recognition result in the display interface of the mobile phone. Figure 2h As shown, the formula object is "-ik / 12π", and the object recognition result is "-\frac{ik}{12\pi}". Of course, after the mobile phone obtains the image to be processed input by the user, the mobile phone can also perform image processing on the image to be processed to obtain the object recognition result of the formula object, and display the object recognition result in the display interface.

[0066] In a possible implementation, the present application can also be used for character object recognition, by analyzing the character objects in the image, and generating a typesetting code sequence corresponding to the character objects. The typesetting code sequence corresponding to the characters can be a Java code or a Python code, etc. Of course, the present application can also be used for text translation, that is, by converting the first language type corresponding to the first character object into the second language type corresponding to the second character object, wherein the first language type and the second language type are different.

[0067] For example, if Figure 2h As shown, Figure 2h This is another image processing scenario diagram provided by an embodiment of the present application. The user can select an image to be processed with a character object in the mobile phone, and then the user clicks the "Send" button, and the computer device can send the image to be processed to the server, so that the server performs image processing on the image to be processed and obtains the object recognition result of the character object, and then the server sends the object recognition result of the character object to the mobile phone, and displays the object recognition result in the display interface of the mobile phone. Figure 2h As shown, the character object is "I love you China", and the object recognition result is "I love you China". Of course, after the mobile phone obtains the image to be processed input by the user, the mobile phone can also perform image processing on the image to be processed to obtain the object recognition result of the character object, and display the object recognition result in the display interface.

[0068] See also Figure 3 , Figure 3 is a flow chart of an image processing method provided in an embodiment of the present application. The method is applied to a computer device, such as Figure 3 As shown, the image processing method may include steps S310 to S350. Among them:

[0069] Step S310: Acquire an image to be processed containing a target object.

[0070] In specific implementation, the user can upload or send the image to be processed containing the target object through the computer device. If the user triggers the sending or uploading operation, the computer device can obtain the image to be processed containing the target object. Figure 2a As shown, in the operation interface of the computer device, after the user selects the image to be processed, the user can click the "Send" button, and the computer device acquires the image to be processed.

[0071] The target object may be a formula object or a character object. For example, if the target object is a formula object, it may be "-ik / 12π"; or if the target object is a character object, it may be "I love you China".

[0072] Step S320: extracting original image features of the image to be processed, where the original image features include N original feature maps, any original feature map includes K feature map pixels, and feature map pixels at the same position in the N original feature maps correspond to an image area of ​​the image to be processed, and N and K are positive integers.

[0073] In specific implementation, the computer device calls the encoding model to identify the image to be processed and obtains the original image features of the image to be processed. The original image features include N original feature maps, any original feature map includes K feature map pixels, the feature map pixels at the same position in the N original feature maps correspond to an image area of ​​the image to be processed, and N and K are positive integers. N is the number of channels, and K refers to the size of the original feature map, that is, the product of length and width.

[0074] It should be noted that the encoding model can specifically be a neural network model, and the neural network model can specifically be a CNN (Convolutional Neural Networks, CNN) model, an RNN (Recurrent Neural Network, RNN) model, an LSTM (Long Short-Term Memory Network, LSTM, Long Short-Term Memory), a GRU (Gated Recurrent Neural Network, Gated Recurrent Neural network) model, and the like.

[0075] For example, a convolutional neural network model is used as an example for specific description. The computer device can identify the image to be processed through the convolutional neural network model to obtain the original image features of the image to be processed. Among them, the convolutional neural network model mainly includes two steps to extract image features. First, the image features of the image to be processed are preliminarily extracted through the convolution layer, and then the image features preliminarily obtained by the convolution layer can be pooled through the pooling layer to finally obtain the original image features of the image to be processed. Among them, the pooling process includes maximum pooling and mean pooling. Specifically, the maximum pooling (max-pooling) is mainly to select the largest number in the specified area to represent the entire area; mean pooling (mean-pooling) is mainly to select the average value of the numerical value in the specified area to represent the entire area. After the pooling process is performed through the pooling layer, useful image information can be retained in the process of image feature extraction, so that the extracted original image features are more effective.

[0076] Step S330: determining K image region features of K image regions in the image to be processed according to the N original feature maps.

[0077] In specific implementation, the computer device can perform three convolution operations on the obtained N original feature maps, and then obtain the convolution feature maps after the three convolution operations respectively. Finally, based on the attention mechanism and the convolution feature maps after the three convolution operations, the K image area features of the K image areas in the image to be processed are determined. It should be noted that since the parameters of the convolution kernel used in each convolution operation may be different, the convolution feature maps obtained after the three convolution operations may also be different. However, the convolution operation will only change the number of channels of the original image features, and will not change the size of the original image features, that is, N will change after the convolution operation, but K will not change.

[0078] In one possible implementation, convolutional neural network is the most commonly used model to extract features from images. Since the convolution operator only aggregates information in a local neighborhood, it is inefficient in modeling long-distance dependencies. However, long-distance dependencies are important for image-to-Latex code generation. For example, the left bracket in a formula may be far away from the right bracket. Therefore, we introduce a self-attention mechanism into the image feature extractor. The similarity of features between image regions is used to model the dependencies between symbols.

[0079] Specifically, first, the computer device can extract the original image features obtained by a convolutional neural network from the image to be processed, and record them as x. Then, the computer device maps the extracted features x to two different spaces using functions f(*) and g(*), respectively, where f(*) and g(*) can be convolution operations or some linear transformations. The similarity of features between regions i and j is defined as shown in Formula 1:

[0080]

[0081] The final K image region features are shown in Formula 2:

[0082]

[0083] Wherein, in formula (2), K = H × W. That is, K image region features are combined into a region feature matrix corresponding to the image to be processed.

[0084] Through this solution, the relationship between symbols is modeled using the similarity of features between image regions, which can achieve high-quality feature extraction of the image to be processed, making the extracted image features more accurate.

[0085] Step S340: respectively obtaining the position features of each image region in the original image features, and superimposing the original image features, the K image region features and the K position features as the target image features of the image to be processed.

[0086] In a specific implementation, the computer device obtains the position information of each image region in the N original feature maps, and determines the position feature of each image region based on the position information. Finally, the computer device superimposes the original image feature, the K image region features and the K position features as the target image feature of the image to be processed. The position information may include the row and column, for example, the position information is the 3rd row and the 5th column.

[0087] For example, the process in which the computer device superimposes the original image features, K image region features and K position features as the target image features of the image to be processed can be shown as formula (3):

[0088]

[0089] In formula (1), V refers to the target image feature, refers to the original image features, o refers to the K image region features, E refers to the K position features, and γ is a learnable parameter.

[0090] Specifically, the superposition here means: combining the original image features, K image region features and K position features. For example, if the original image features are 200 dimensions, the K image region features are 150 dimensions, and the K position features are 150 dimensions, then the combined target image features are: 200+150+150=500 dimensions.

[0091] In a possible implementation, the reference image region is one of the K image regions. The process of the computer device obtaining the position feature of the reference image region in the original image feature may specifically include: first, the computer device obtains the reference feature map pixel corresponding to the reference image region in the original image feature; then, the computer device obtains the first reference position and the second reference position corresponding to the reference feature map pixel in the N original feature maps; finally, the computer device generates a reference position feature according to the first reference position and the second reference position, wherein the dimension of the reference position feature is P.

[0092] For example, first, the computer device obtains the reference feature map pixel x corresponding to the reference image area i in the original image feature, and then obtains the first reference position and the second reference position of the reference feature map pixel x in the N original feature maps, wherein the first reference position can be generated according to the row position information, and the second reference position can be generated according to the column position information. If the row position information of the reference feature map pixel x is the 3rd row and the column position information is the 5th column, the first reference position generated according to the 3rd row can be (0, 0, 1), and the second reference position generated according to the 5th column can be (0, 0, 0, 0, 1). Finally, according to the dimension P of the reference position feature, the first P / 2 elements contained in the reference position feature can be generated according to the first reference position, and the last P / 2 elements can be generated according to the second reference position. Assuming that the dimension P of the reference position feature is 100, the reference position can be a 100-dimensional feature vector, then the first 50 elements of this 100-dimensional feature vector are generated according to the first reference position, and the last 50 elements are generated according to the second reference position. Specifically, it can be (0, 0, 1, 0, ..., 0, 0, 0, 0, 1, ...), that is, for the first reference position, since there are only 3 elements, the following 47 elements are all 0. Similarly, for the second reference position, there are 5 elements, and the following 45 elements are all 0.

[0093] By analogy, for each image region, the dimension of the corresponding position feature is P, and the position feature of each image region can be determined by analogy with the method of determining the position feature of the reference position region, which is not described in detail in this application. Finally, K image regions can correspond to K position features.

[0094] Step S350: performing recognition processing on the target image features to obtain an object recognition result of the target object.

[0095] In a specific implementation, the computer device calls the decoding model to perform recognition processing on the target image features to obtain the object recognition result of the target object. It should be noted that the object type of the target object is different, and the corresponding object recognition result is also different. Specifically, if the target object includes a formula object, the object recognition result includes the typesetting code sequence of the formula object; if the target object includes a character object, the object recognition result includes the typesetting code sequence of the character object; if the target object includes a first character object, the object recognition result includes a second character object, and the language type of the first character object is different from the language type of the second character object.

[0096] It should be noted that the decoding model can be a neural network model, and the neural network model can be a Transformer model, a CRF (Conditional Random Field) model, etc. Taking the decoding model as an example, a detailed description is given. The Transformer model abandons the CNN model and RNN model used in previous deep learning tasks. Currently, the Transformer model is widely used in the field of Natural Language Process (NLP), such as machine translation, question-answering system, text summarization, speech recognition, etc.

[0097] In a possible implementation, the target image features include K feature vectors, and the dimension of each feature vector is P. The process of a computer device identifying and processing the target image features to obtain an object recognition result of the target object may specifically include: first, the computer device obtains a self-attention weight matrix based on a self-attention mechanism and the K feature vectors, and determines K attention feature vectors corresponding to the K feature vectors according to the self-attention weight matrix; then, the computer device calls a decoder to identify the K attention feature vectors respectively, and determines the object recognition result of the target object.

[0098] For example, see Figure 4 , Figure 4 It is a flow chart of a self-attention mechanism provided by an embodiment of the present application. In specific implementation, the computer device inputs K feature vectors h1, h2, h3, ..., hk into a decoding model, and the decoding model decodes the K feature vectors h1, h2, h3, ..., hk to obtain K feature output vectors y1, y2, y3, ..., yk. Subsequently, the K feature output vectors y1, y2, y3, ..., yk are fully connected based on the fully connected layer and the normalization layer, and the object recognition result of the target object can be output. Among them, the K feature vectors h1, h2, h3, ..., hk are the hidden feature sequences obtained after the K feature input vectors x1, x2, x3, ..., xk are input into the encoder model for encoding processing, and the K attention feature vectors c1, c2, c3, ..., ck are the self-attention feature sequences obtained after the K feature vectors h1, h2, h3, ..., hk are input into the self-attention module in the decoder model for processing. The K feature vectors s1, s2, s3, ..., sk are the hidden feature sequences obtained after the K feature vectors h1, h2, h3, ..., hk are input into the decoder model and decoded. Of course, Figure 4 In the figure, only k=3 feature input vectors are taken as an example for detailed description.

[0099] In a possible implementation, the computer device can characterize the correlation between each feature vector through the self-attention weight based on the self-attention mechanism, so the self-attention weight matrix can be determined. For example, the self-attention weight matrix can be:

[0100] Furthermore, based on the self-attention weight matrix, K self-attention feature vectors can be calculated. The K self-attention feature vectors are shown in formula (4):

[0101]

[0102] As shown in Formula 4, h1, h2, h3 are input feature vectors, c1, c2, c3 are K attention feature vectors (K=3) determined according to the self-attention weight matrix and the K feature vectors. Finally, the K attention feature vectors are processed by the fully connected layer and the normalization layer, and the object recognition result of the target object is finally output.

[0103] Through the image processing method provided by the embodiment of the present application, first, the terminal device can extract the original image features of the image to be processed containing the target object, wherein the original image features include N original feature maps, any original feature map includes K feature map pixels, and the feature map pixels at the same position in the N original feature maps correspond to an image area of ​​the image to be processed. Secondly, the terminal device can determine K image area features of K image areas in the image to be processed based on the attention mechanism and the N original feature maps. Then, the terminal device can obtain the position features of each image area in the original image features respectively, and superimpose the original image features, K image area features and K position features as the target image features of the image to be processed. Compared with the existing method, this scheme improves the accuracy of the target image features because it extracts the image area features that can reflect the global information; further, because the original image features and position features are also extracted, the feature extraction methods are rich and varied, and all the features are superimposed as the target image features, which improves the accuracy of the target image features. Subsequently, the object recognition result of the target object can be obtained based on the target image features, thereby further improving the accuracy of the object recognition result.

[0104] See also Figure 5 , Figure 5 is a flow chart of determining image region features provided by an embodiment of the present application. The method is applied to a computer device, wherein: Figure 5 The embodiment is Figure 3 A specific embodiment corresponding to step S330 in the embodiment. Figure 5 As shown, the image processing method may include steps S510 to S540. Among them:

[0105] Step S510: performing a convolution operation on the N original feature maps based on a first convolution kernel to obtain P first convolution feature maps, where P is a positive integer.

[0106] In a specific implementation, the computer device can perform a convolution operation on the N original feature maps based on the first convolution kernel to obtain P first convolution feature maps, where P is a positive integer. The purpose of the convolution operation is to change the number of channels N of the original image feature without changing the size K of the original image feature. Of course, the convolution operation can reduce the number of channels or increase the number of channels. Generally speaking, in order to reduce the processing efficiency of the computer device, the convolution operation is usually performed to reduce the number of channels of the original image feature.

[0107] Among them, the convolution operation can be regarded as a weighted summation of a certain part, which corresponds to local perception. Its principle is that when observing an object, we can neither observe each pixel nor the whole at once, but start from the local part, which corresponds to convolution. The size of the convolution kernel is generally 1×1, 3×3 and 5×5. The number of convolution kernels corresponds to the number of output channels. It should be noted here that for each input channel, the convolution kernel on each output channel is different.

[0108] For example, if the input is 28×28×192 (H×W×N, N represents the number of channels), and the number of convolution channels is 128 (P) in the 3x3 convolution kernel, then the convolution parameters are 3×3×192×128, of which the first two (3×3) correspond to the parameters in each convolution, and the last two (192×128) correspond to the total number of convolutions. Similarly, if it is a 1x1 convolution kernel, if the input is 28×28×192 (H×W×N, N represents the number of channels), then a total of 128 first convolution kernels are required, and each first convolution kernel can be 1×1×192. Therefore, after the 1x1 first convolution kernel operates on the input 28×28×192, 128 28×28 first convolution feature maps are obtained.

[0109] Step S520: performing a convolution operation on the N original feature maps based on a second convolution kernel to obtain P second convolution feature maps.

[0110] In a specific implementation, a computer device performs a convolution operation on N original feature maps based on a second convolution kernel to obtain P second convolution feature maps. For details, please refer to a computer device performs a convolution operation on N original feature maps based on a first convolution kernel to obtain P first convolution feature maps. This application will not go into details here.

[0111] Among them, the convolution kernel size used by the second convolution kernel and the first convolution kernel can be the same, but because the parameters corresponding to the second convolution kernel and the first convolution may be different, the obtained P second convolution feature maps and the P first convolution feature maps may also be different. However, the size of the P second convolution feature maps is the same as the N original feature maps, which is K.

[0112] Step S530: performing a convolution operation on the N original feature maps based on a third convolution kernel to obtain P third convolution feature maps.

[0113] In the specific implementation, the computer device performs a convolution processing operation on N original feature maps based on the third convolution kernel to obtain P third convolution feature maps. For details, please refer to the computer device performs a convolution processing operation on N original feature maps based on the first convolution kernel to obtain P first convolution feature maps. This application will not repeat it here.

[0114] Among them, the convolution kernel size used by the third convolution kernel and the first convolution kernel can be the same, but because the parameters corresponding to the third convolution kernel, the first convolution kernel and the second convolution kernel may be different, the obtained P third convolution feature maps, the P first convolution feature maps and the P second convolution feature maps may also be different. However, the size of the P third convolution feature maps is the same as the N original feature maps, which is K.

[0115] In summary, the size of any first convolution feature map, any second convolution feature map, and any third convolution feature map is the same as that of any original feature map (all equal to K).

[0116] Step S540: Based on the attention mechanism, identify the P first convolution feature maps, the P second convolution feature maps, and the P third convolution feature maps, and determine K image region features of the K image regions in the image to be processed.

[0117] In specific implementation, based on the attention mechanism, the computer device can use P first convolution feature maps as keys and P second convolution feature maps as queries, and then calculate the similarity between the keys (P first convolution feature maps) and the queries (P second convolution feature maps). Finally, based on the similarity and the P third convolution feature maps, the K image region features of the K image regions in the image to be processed are determined. It should be noted that the attention mechanism involved in the embodiment of the present application refers to: first, the three convolution operation results obtained after the original image features are subjected to three convolution operations respectively (each convolution operation result is P convolution feature maps, and the size of each convolution feature map in all convolution feature maps is the same). Then, based on the results of any two convolution operations, similarity calculations are performed to obtain multiple similarities between any image region and all image regions. Finally, a weighted operation is performed based on multiple similarities and another convolution operation result to finally obtain the image region features corresponding to each image region.

[0118] In a possible implementation, the reference image region is one of the K image regions. The process of a computer device identifying P first convolution feature maps, P second convolution feature maps, and P third convolution feature maps based on an attention mechanism to determine the image region features of the reference image region in the image to be processed may specifically include: first, the computer device determines K region similarities between the reference image region and the K image regions based on the P first convolution feature maps and the P second convolution feature maps; then, the computer device determines the image region features of the reference image region based on the K region similarities between the reference image region and the K image regions and the P third convolution feature maps.

[0119] In a specific implementation, the P second convolution feature maps include K second convolution feature vectors, and the dimension of each second convolution feature vector is P. The computer device determines the K regional similarities between the reference image region and the K image regions based on the P first convolution feature maps and the P second convolution feature maps, which may specifically include: first, the computer device respectively obtains the pixel values ​​of the pixels corresponding to the reference image region in each first convolution feature map, and combines the obtained P pixel values ​​into a first convolution feature vector; then, the computer device performs dot product operations on the first convolution feature vector and the K second convolution feature vectors respectively, to obtain the K regional similarities between the reference image region and the K image regions.

[0120] For example, since each image region corresponds to a feature map pixel, for P first convolution feature maps, the computer device can determine the pixel value of each pixel corresponding to the reference image region in the P first convolution feature maps, and thus can determine P pixel values. Assume that the P pixel values ​​are m1, m2, ..., m p, then the first convolution feature vector can be (m1,m2,...,m p ). Then, the dimension of each second feature convolution vector in the K second convolution feature vectors is also P. Assume that the K second convolution feature vectors are (n 11 ,n 12 ,...,n 1p ), (n 21 ,n 22 ,...,n 2p ),...,(n k1 ,n k2 ,...,n kp ). Therefore, according to Figure 3 Formula (1) in the embodiment can convert (m1, m2, ..., m p ) and (n 11 ,n 12 ,...,n 1p ), (n 21 ,n 22 ,...,n 2p ),...,(n k1 ,n k2 ,...,n kp ) perform dot product operations respectively, and then normalize the results of each dot product operation to obtain K region similarities α 11 ,α 12 ,...,α 1k .

[0121] Furthermore, the P third convolution feature maps include K third convolution feature vectors, and the dimension of each third convolution feature vector is P. Assume that the K third convolution feature vectors are (h 11 ,h 12 ,...,h 1p ), (h 21 ,h 22 ,...,h 2p ),...,(h k1 ,h k2 ,...,h kp ), the computer device calculates the similarity α of the K regions 11 ,α 12 ,...,α 1k and the K third convolution feature vectors (h 11 ,h 12 ,...,h 1p ), (h 21 ,h 22 ,...,h 2p ),...,(h k1 ,h k2,...,h kp ) to determine the image region feature of the reference image region. The image region feature of the reference image region is shown in formula (5):

[0122] O1=α 11 h1+α 11 h1+...+α 1k h k (5)

[0123] Among them, h1, h2, ..., hk in Formula 5 represent K third convolution feature vectors (h 11 ,h 12 ,...,h 1p ), (h 21 ,h 22 ,...,h 2p ),...,(h k1 ,h k2 ,...,h kp ). Thus, the image region feature o1 of the reference image region can be calculated. It should be noted that the image region features o2, o3, ..., o4 of all other (k-1) image regions are k The determination method can be analogous to the determination method of the image area features of the reference image area, and the present application will not go into details here.

[0124] Through the embodiment of the present application, a structure-aware module (such as Figure 2c As shown in the figure, the image to be processed of the mathematical formula containing complex structural relationships is subjected to feature extraction. The module is based on the attention mechanism and uses the similarity of features between image regions to model the relationship between symbols, thereby achieving high-quality feature extraction and obtaining image region features of the image to be processed. Compared with only using the convolutional neural network model to perform image recognition on the image to be processed to extract image features, the image region features obtained in the present application focus on the correlation between each image region in the image to be processed, so the image region features are a kind of global feature information. The image features (original image features) extracted by the convolutional neural network model are local feature information, so the extracted target image features are more accurate. Furthermore, the object recognition result obtained after decoding processing based on the target image features is also more accurate.

[0125] See also Figure 6 , Figure 6 is a flow chart of a training image processing model provided in an embodiment of the present application. The method is applied to a computer device, such as Figure 6 As shown, the image processing method may include steps S610 to S640. Among them:

[0126] Step S610: Acquire a sample image set, where the sample image set includes a plurality of sample images, a positive sample object recognition result corresponding to each sample image, and a negative sample object recognition result corresponding to each sample image.

[0127] In a specific implementation, the user can select a batch of modeling samples (a collection of sample images), and then the user can send the modeling samples to a computer device so that the computer device can use the modeling samples to perform training operations on the image processing model. The image processing model refers to a model that can identify the image to be processed containing the target object and generate an object recognition result of the target object. Specifically, the image processing model may include an encoder module and a decoder module, wherein the encoder module may also include a neural network submodule and a structure perception submodule. For example, the structural diagram of the neural network submodule may be as follows: Figure 2b As shown, the structural diagram of the structure perception submodule can be as follows Figure 2c As shown, the structural diagram of the decoder module can be as follows Figure 2f shown.

[0128] The sample image set may include multiple sample images, positive sample object recognition results corresponding to each sample image, and negative sample object recognition results corresponding to each sample image. For example, see Figure 7a , Figure 7a is a schematic diagram of a sample image set provided in an embodiment of the present application. Figure 7a As shown, each sample image includes a target object, and the target object can be a formula object. If the target object is "-qw / 12", the positive sample object recognition result corresponding to "-qw / 12" is "-\frac{qw}{12}", and the negative sample object recognition result corresponding to "-qw / 12" can be "a^\ast"; if the target object is "|a|", the positive sample object recognition result corresponding to "|a|" is "\vert a\vert", and the negative sample object recognition result corresponding to "|a|" can be "-\frac{qw}{12}"; if the target object is "a*", the positive sample object recognition result corresponding to "a*" is "a^\ast", and the negative sample object recognition result corresponding to "a*" can be "\vert a\vert".

[0129] It should be noted that the negative sample object recognition result corresponding to the reference sample image can be any other sample object recognition result in the sample image set except the positive sample object recognition result corresponding to the reference sample image. The negative sample object recognition result corresponding to the reference sample image can also be other object recognition results that do not match the reference sample image. This application does not limit this, as long as it is a negative sample. Of course, the number of sample images in the sample image set can be specified by the user, and the sample images in the sample image set can be updated regularly. The update process can specifically include adding some sample images or deleting some sample images, or randomly selecting some sample images for other users to check. The checking standard can be whether the sample image matches the positive sample object recognition result, or whether the sample image does not match the negative sample object recognition result, etc.

[0130] Step S620: calling a sample image processing model to obtain a first prediction probability set corresponding to each sample image, wherein the sample image processing model includes a discriminator and a generator.

[0131] In specific implementation, the computer device calls the sample image processing model to perform recognition processing on each sample image in the sample image set, and obtains a first probability prediction set corresponding to each sample image. The sample image processing model includes a discriminator and a generator.

[0132] For example, if sample image 1 is "-qw / 12", the sample image processing model is called to perform recognition processing on "-qw / 12", and the first prediction probability set corresponding to "-qw / 12" can be obtained, wherein the first prediction probability set includes the prediction probability corresponding to each code, that is, the first prediction probability set can include the prediction probability corresponding to "-", the prediction probability corresponding to "\frac", the prediction probability corresponding to "{", ... and so on.

[0133] Step S630: performing adversarial training on the sample image processing model according to each positive sample object recognition result, each negative sample object recognition result and each first prediction probability set.

[0134] In a specific implementation, the computer device performs adversarial training on the discriminator and the generator according to each positive sample object recognition result, each negative sample object recognition result and each first prediction probability set.

[0135] The training process of the sample image processing model can be modeled as a Markov decision process (MDP) process, which considers the generation of the entire sequence in the decision-making process instead of doing a single-step evaluation. Figure 7b , Figure 7bIt is a flow chart of a training sample image processing model provided in an embodiment of the present application.

[0136] Among them, the Markov decision process can usually be represented by the tuple Define, where represents the state space, represents the action space, Represents the reward function, ρ represents the initial state distribution, and P represents the state transition probability matrix. In the Latex code generation task, the state is the picture and the currently generated sequence fragment, the action is to select the next word in the vocabulary, and the strategy is the probability of the word being selected in the vocabulary. Based on the definition of the Markov decision process, we use reinforcement learning to solve the strategy. In the code generation process, at each time step, sampling is performed from the vocabulary according to the strategy (i.e., the distribution of words in the vocabulary) as a prediction for the next step. The above process is repeated until the sampled word is the end mark, then sampling is stopped to obtain the predicted Latex code sequence.

[0137] Specifically, since mathematical formulas usually correspond to multiple different code sequences, if the evaluation indicators for text in natural language processing technology are used, these indicators are all evaluated based on ground-truth, such as BLEU, Edit Distance and other indicators. It is difficult to use these indicators as reward functions to effectively evaluate sequences that do not exist in the ground-truth but are also correct. Based on the above analysis, in the process of training the sample image processing model (modeling), a discriminator D can be learned to classify the image and sequence pairs. The discriminator can be used to classify the image sequence pairs, avoiding the problem of selecting evaluation indicators. In addition, for the problem that the same image has multiple different code sequences, for the correct sample pairs, the discriminator learns to classify them as positive samples, and for the generated samples, the discriminator learns to classify them as negative samples. The discriminator and the generator are in confrontation. The generator is committed to generating correct sequences, thereby obtaining a larger reward from the discriminator, and the discriminator learns to distinguish true and false samples.

[0138] In a possible implementation, the process of the computer device performing adversarial training on the discriminator and the generator according to each positive sample object recognition result, each negative sample object recognition result and each first prediction probability set may specifically include: first, the computer device adjusts the model parameters of the discriminator according to the positive sample object recognition result of each sample image, the first prediction probability set of each sample image and the negative sample object recognition result of each sample image; then, the computer device obtains the second prediction probability set corresponding to each sample image according to the adjusted discriminator; finally, the computer device adjusts the model parameters of the generator according to the positive sample object recognition result of each sample image and the second prediction probability set of each sample image. The discriminator and the generator are trained alternately, and the so-called alternating training means that when the discriminator is trained, the generator remains unchanged (that is, the model structure and model parameters of the generator are not changed); when the generator is trained, the discriminator remains unchanged (that is, the model structure and model parameters of the discriminator are not changed).

[0139] In a specific implementation, the computer device adjusts the model parameters of the discriminator according to the positive sample object recognition result of each sample image, the first predicted probability set of each sample image, and the negative sample object recognition result of each sample image. The process of adjusting the model parameters of the discriminator may specifically include: first, the computer device determines a first reward feedback according to the positive sample object recognition result of each sample image and the first predicted probability set of each sample image; then, the computer device determines a second reward feedback according to the first predicted probability set of each sample image; second, the computer device determines a third reward feedback according to the negative sample object recognition result of each sample image and the first predicted probability set of each sample image; finally, the computer device superimposes the first reward feedback, the second reward feedback, and the third reward feedback into a target reward feedback, and reversely adjusts the model parameters of the discriminator according to the target reward feedback.

[0140] For example, if Figure 7c As shown, Figure 7c This is a flowchart of a training discriminator provided in an embodiment of the present application. The model structure of the discriminator D is consistent with that of the generator, including an encoder for processing images and a decoder for processing Latex sequences. Its training samples include three categories: image and sequence sample pairs (X, Y) matched in ground-truth, and sample pairs composed of images and sequences generated by the generator. Unmatched sample pairs in ground-truth Among them, Y refers to the positive sample object recognition result, is the prediction object identification result determined according to the first prediction probability set, Refers to the negative sample object recognition result. The target reward feedback determined according to the first reward feedback, the second reward feedback and the third reward feedback is shown in formula (6):

[0141]

[0142] In formula (6), λ is a hyperparameter, E(X, Y) represents the expectation between the sample image and the positive sample object recognition result, represents the expectation between the sample image and the predicted object recognition result, represents the expectation between the sample image and the negative sample object recognition results. logD(X, Y) refers to the first reward feedback, refers to the second reward feedback, Refers to the third reward feedback.

[0143] Finally, the model parameters of the discriminator are reversely adjusted according to the target reward feedback. Specifically, the model parameters of the discriminator can be adjusted by maximizing the target reward feedback through the gradient optimization algorithm.

[0144] In one possible implementation, a process in which a computer device adjusts the model parameters of a generator based on a positive sample object recognition result of each sample image and a second prediction probability set of each sample image may specifically include: first, the computer device obtains a target loss based on the positive sample object recognition result of each sample image and the second prediction probability set of each sample image; then, the computer device reversely adjusts the model parameters of the generator based on the target loss.

[0145] Specifically, since the existing evaluation indicators are usually evaluated for the entire sequence, that is, the feedback signal in the training process can only be obtained after the entire sequence is generated, and then the strategy can only be updated after the sequence is completely generated. This will lead to the problem of reward delay, which is not conducive to strategy learning. Combined with the above analysis, we hope to get feedback at each step of the decision. In reinforcement learning, the state-action value function is used to evaluate how much cumulative reward can be obtained in the future by performing a certain action in a certain state. According to the state-action value function and the previous definition of the discriminator, it can be found that the discriminator D and the state-action value function The relationship between is shown in formula (7):

[0146]

[0147] For example, according to formula (7), the reward feedback corresponding to each decision step can be calculated. For example, if the reward feedback corresponding to the i-th action needs to be calculated, the probability set corresponding to the i-th action can be selected from the first prediction probability set, where the first prediction probability set includes i prediction probability sets. Assume that the probability set corresponding to the i-th action is {y i1 ,y i2 ,...,y it}; Then, according to the code corresponding to the i-th action in the positive sample recognition result, in {y i1 ,y i2 ,...,y it} to determine the predicted probability of the correct code corresponding to this step action, assuming it is y i1 , and then use the obtained predicted probability y i1 As the reward feedback corresponding to the i-th step action. Similarly, each step can refer to this method to obtain the corresponding reward feedback. Furthermore, the feedback corresponding to all actions can be weighted averaged to obtain the average reward feedback in the process of generating this code sequence.

[0148] Therefore, by analyzing the relationship between the discriminator and the value function, single-step reward feedback is implemented so that each step of the action can get feedback and update the model to solve the problem of reward delay. Therefore, the final target loss function is shown in formula (8):

[0149]

[0150] Specifically, the target loss function in formula (8) can be maximized by the policy gradient algorithm in reinforcement learning, that is, the new model parameter θ can be learned, thereby adjusting the model parameters of the generator. Of course, in addition to the policy gradient algorithm, other policy optimization methods can also be used to optimize the target loss function, such as the Trust Region Policy Optimization (TRPO) algorithm, the Proximal Policy Optimization (PPO) algorithm, and so on.

[0151] Step S640: When the trained sample image processing model meets the model convergence condition, the trained generator is determined as the image processing model, and the image processing model is used to identify the image to be processed containing the target object to obtain the object recognition result of the target object.

[0152] It should be noted that the so-called model convergence condition may refer to: when the number of training times of the sample image processing model reaches a preset training threshold, for example 100 times, the sample image processing model meets the model convergence condition; when the error between the predicted object label corresponding to each sample image and the positive sample recognition result corresponding to each sample image is less than the error threshold, the sample image processing model meets the model convergence condition, wherein the predicted object label is determined based on the predicted probability set; when the change between the predicted object labels corresponding to each transaction object obtained from two consecutive trainings of the sample image processing model is less than the change threshold, the sample image processing model meets the model convergence condition.

[0153] Finally, the trained generator is used as an image processing model. The image processing model can be used to identify the image to be processed containing the target object and generate an object recognition result of the target object.

[0154] Through this solution, the code generation process is modeled as a Markov decision process, and the generation of the entire sequence is considered in the decision-making process, rather than a single-step evaluation. It can be achieved that the corresponding reward feedback can be calculated for each step of the work. That is, the model training process focuses on the modeling and training methods at the sequence level, so that the model training pays more attention to the overall performance of the generated code sequence. Therefore, the trained generator (image processing model) may more accurately identify the image to be processed, thereby obtaining the object recognition result of the target object.

[0155] See also Figure 8 , Figure 8 It is a structural schematic diagram of an image processing device provided in an embodiment of the present application. Figure 8 is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application. The image processing device can be applied to Figure 3 to Figure 7c The computer device in the corresponding method embodiment. The image processing device may be a computer program (including program code) running in a lightweight node, for example, the image processing device is an application software; the device may be used to execute the corresponding steps in the method provided in the embodiment of the present application. The image processing device may include:

[0156] An acquisition unit 810 is used to acquire an image to be processed containing a target object;

[0157] An extraction unit 820 is used to extract original image features of the image to be processed, where the original image features include N original feature maps, each of which includes K feature map pixels, and feature map pixels at the same position in the N original feature maps correspond to an image region of the image to be processed, where N and K are positive integers;

[0158] A determining unit 830 is used to determine K image region features of K image regions in the image to be processed based on an attention mechanism and the N original feature maps;

[0159] The processing unit 840 is used to respectively obtain the position features of each image region in the original image features, and superimpose the original image features, the K image region features and the K position features as the target image features of the image to be processed;

[0160] The recognition unit 850 is used to perform recognition processing on the target image features to obtain an object recognition result of the target object.

[0161] In a possible implementation, the target object includes a formula object, and the object recognition result includes a typeset code sequence of the formula object; or,

[0162] The target object includes a character object, and the object recognition result includes a typesetting code sequence of the character object; or,

[0163] The target object includes a first character object, the object recognition result includes a second character object, and the language type of the first character object is different from the language type of the second character object.

[0164] In a possible implementation, the determining unit 830 determines K image region features of K image regions in the image to be processed based on the attention mechanism and the N original feature maps, including:

[0165] Performing a convolution operation on the N original feature maps based on a first convolution kernel to obtain P first convolution feature maps, where P is a positive integer;

[0166] Performing a convolution operation on the N original feature maps based on a second convolution kernel to obtain P second convolution feature maps;

[0167] Performing a convolution operation on the N original feature maps based on a third convolution kernel to obtain P third convolution feature maps, wherein the size of any first convolution feature map, any second convolution feature map, and any third convolution feature map is the same as that of any original feature map;

[0168] Based on the attention mechanism, the P first convolution feature maps, the P second convolution feature maps, and the P third convolution feature maps are identified, and K image region features of the K image regions in the image to be processed are determined.

[0169] In a possible implementation manner, the reference image region is one image region among the K image regions;

[0170] The process in which the determination unit 830 identifies the P first convolution feature maps, the P second convolution feature maps, and the P third convolution feature maps based on the attention mechanism, and determines the image region features of the reference image region in the image to be processed includes:

[0171] Determining K region similarities between the reference image region and the K image regions according to the P first convolution feature maps and the P second convolution feature maps;

[0172] The image region features of the reference image region are determined according to K region similarities between the reference image region and the K image regions and the P third convolution feature maps.

[0173] In a possible implementation, the P second convolution feature maps include K second convolution feature vectors, and the dimension of each second convolution feature vector is P;

[0174] The determining unit 830 determines K region similarities between the reference image region and the K image regions according to the P first convolution feature maps and the P second convolution feature maps, including:

[0175] Obtain pixel values ​​of pixels corresponding to the reference image area in each first convolution feature map respectively, and combine the obtained P pixel values ​​into a first convolution feature vector;

[0176] Perform dot product operations on the first convolution feature vector and the K second convolution feature vectors respectively to obtain K region similarities between the reference image region and the K image regions.

[0177] In a possible implementation, the P third convolution feature maps include K third convolution feature vectors, and the dimension of each third convolution feature vector is P;

[0178] The determining unit 830 determines the image region feature of the reference image region according to the K region similarities between the reference image region and the K image regions and the P third convolution feature maps, including:

[0179] A weighted operation is performed on the K region similarities and the K third convolution feature vectors to determine the image region feature of the reference image region.

[0180] In a possible implementation manner, the reference image region is an image region among the K image regions;

[0181] The process of the processing unit 840 obtaining the position feature of the reference image area in the original image feature includes:

[0182] Obtain reference feature map pixels corresponding to the reference image region in the original image features;

[0183] Obtaining first reference positions and second reference positions corresponding to the reference feature map pixels in the N original feature maps respectively;

[0184] A reference position feature is generated according to the first reference position and the second reference position, where the dimension of the reference position feature is P.

[0185] In a possible implementation, the target image features include K feature vectors, and the dimension of each feature vector is P;

[0186] The recognition unit 850 performs recognition processing on the target image features to obtain an object recognition result of the target object, including:

[0187] Based on the self-attention mechanism and the K eigenvectors, a self-attention weight matrix is ​​obtained, and according to the self-attention weight matrix, K attention eigenvectors corresponding to the K eigenvectors are determined;

[0188] The decoder is called to respectively identify the K attention feature vectors to determine the object recognition result of the target object.

[0189] In a possible implementation, the image processing device provided in the embodiment of the present application further includes: a training unit 760.

[0190] The acquisition unit 810 acquires a sample image set, where the sample image set includes a plurality of sample images, a positive sample object recognition result corresponding to each sample image, and a negative sample object recognition result corresponding to each sample image;

[0191] The processing unit 840 calls a sample image processing model to obtain a first prediction probability set corresponding to each sample image, wherein the sample image processing model includes a discriminator and a generator;

[0192] The training unit 760 performs adversarial training on the sample image processing model according to each positive sample object recognition result, each negative sample object recognition result and each first prediction probability set;

[0193] When the trained sample image processing model meets the model convergence condition, the determination unit 830 determines the trained generator as an image processing model, which is used to identify the image to be processed containing the target object to obtain an object recognition result of the target object.

[0194] In a possible implementation, the training unit 760 performs adversarial training on the sample image processing model according to each positive sample object recognition result, each negative sample object recognition result, and each first prediction probability set, including:

[0195] Adjusting the model parameters of the discriminator according to the positive sample object recognition result of each sample image, the first prediction probability set of each sample image, and the negative sample object recognition result of each sample image;

[0196] According to the adjusted discriminator, obtaining a second prediction probability set corresponding to each sample image;

[0197] According to the positive sample object recognition result of each sample image and the second prediction probability set of each sample image, the model parameters of the generator are adjusted, and the discriminator and the generator are trained alternately.

[0198] In a possible implementation, the training unit 760 adjusts the model parameters of the discriminator according to the positive sample object recognition result of each sample image, the first prediction probability set of each sample image, and the negative sample object recognition result of each sample image, including:

[0199] Determining a first reward feedback according to the positive sample object recognition result of each sample image and the first predicted probability set of each sample image;

[0200] Determining a second reward feedback according to the first predicted probability set of each sample image;

[0201] Determining a third reward feedback according to the negative sample object recognition result of each sample image and the first prediction probability set of each sample image;

[0202] The first reward feedback, the second reward feedback and the third reward feedback are superimposed as a target reward feedback, and the model parameters of the discriminator are reversely adjusted according to the target reward feedback.

[0203] In a possible implementation, the training unit 760 adjusts the model parameters of the generator according to the positive sample object recognition result of each sample image and the second prediction probability set of each sample image, including:

[0204] Obtaining a target loss according to a positive sample object recognition result of each sample image and a second prediction probability set of each sample image;

[0205] The model parameters of the generator are reversely adjusted according to the target loss.

[0206] See also Fig. 9 , Fig. 9 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 3 to Figure 7c The computer device in the corresponding embodiment may be a computer device 900, such as Fig. 9 As shown, the computer device 900 may include: a user interface 902, a processor 904, an encoder 906 and a memory 908. The signal receiver 916 is used to receive or send data via a cellular interface 910, a WIFI interface 912, ..., or an NFC interface 914. The encoder 906 encodes the received data into a data format for computer processing. A computer program is stored in the memory 908, and the processor 904 is configured to perform the steps in any of the above method embodiments through the computer program. The memory 908 may include a volatile memory (e.g., a dynamic random access memory DRAM), and may also include a non-volatile memory (e.g., a one-time programmable read-only memory OTPROM). In some instances, the memory 908 may further include a memory remotely arranged relative to the processor 1004, and these remote memories may be connected to the computer device 900 via a network. The user interface 9002 may include: a keyboard 918 and a display 920.

[0207] exist Fig. 9 In the computer device 900 shown, the processor 904 may be used to call a computer program stored in the memory 908 to implement:

[0208] Obtain an image to be processed containing a target object;

[0209] Extracting original image features of the image to be processed, where the original image features include N original feature maps, any original feature map includes K feature map pixels, feature map pixels at the same position in the N original feature maps correspond to an image region of the image to be processed, and N and K are positive integers;

[0210] Determine K image region features of K image regions in the image to be processed based on the attention mechanism and the N original feature maps;

[0211] Respectively obtain the position features of each image region in the original image features, and superimpose the original image features, the K image region features and the K position features as the target image features of the image to be processed;

[0212] The target image features are identified and processed to obtain an object recognition result of the target object.

[0213] In a possible implementation, the target object includes a formula object, and the object recognition result includes a typeset code sequence of the formula object; or,

[0214] The target object includes a character object, and the object recognition result includes a typesetting code sequence of the character object; or,

[0215] The target object includes a first character object, the object recognition result includes a second character object, and the language type of the first character object is different from the language type of the second character object.

[0216] In a possible implementation, the processor 904 determines K image region features of K image regions in the image to be processed based on the attention mechanism and the N original feature maps, including:

[0217] Performing a convolution operation on the N original feature maps based on a first convolution kernel to obtain P first convolution feature maps, where P is a positive integer;

[0218] Performing a convolution operation on the N original feature maps based on a second convolution kernel to obtain P second convolution feature maps;

[0219] Performing a convolution operation on the N original feature maps based on a third convolution kernel to obtain P third convolution feature maps, wherein the size of any first convolution feature map, any second convolution feature map, and any third convolution feature map is the same as that of any original feature map;

[0220] Based on the attention mechanism, the P first convolution feature maps, the P second convolution feature maps, and the P third convolution feature maps are identified, and K image region features of the K image regions in the image to be processed are determined.

[0221] In a possible implementation manner, the reference image region is one image region among the K image regions;

[0222] The processor 904 identifies the P first convolution feature maps, the P second convolution feature maps, and the P third convolution feature maps based on the attention mechanism, and determines the image region features of the reference image region in the image to be processed, including:

[0223] Determining K region similarities between the reference image region and the K image regions according to the P first convolution feature maps and the P second convolution feature maps;

[0224] The image region features of the reference image region are determined according to K region similarities between the reference image region and the K image regions and the P third convolution feature maps.

[0225] In a possible implementation, the P second convolution feature maps include K second convolution feature vectors, and the dimension of each second convolution feature vector is P;

[0226] The processor 904 determines K region similarities between the reference image region and the K image regions according to the P first convolution feature maps and the P second convolution feature maps, including:

[0227] Obtain pixel values ​​of pixels corresponding to the reference image area in each first convolution feature map respectively, and combine the obtained P pixel values ​​into a first convolution feature vector;

[0228] Perform dot product operations on the first convolution feature vector and the K second convolution feature vectors respectively to obtain K region similarities between the reference image region and the K image regions.

[0229] In a possible implementation, the P third convolution feature maps include K third convolution feature vectors, and the dimension of each third convolution feature vector is P;

[0230] The processor 904 determines the image region feature of the reference image region according to the K region similarities between the reference image region and the K image regions and the P third convolution feature maps, including:

[0231] A weighted operation is performed on the K region similarities and the K third convolution feature vectors to determine the image region feature of the reference image region.

[0232] In a possible implementation manner, the reference image region is an image region among the K image regions;

[0233] The process of the processor 904 acquiring the position feature of the reference image region in the original image feature includes:

[0234] Obtain reference feature map pixels corresponding to the reference image region in the original image features;

[0235] Obtaining first reference positions and second reference positions corresponding to the reference feature map pixels in the N original feature maps respectively;

[0236] A reference position feature is generated according to the first reference position and the second reference position, where the dimension of the reference position feature is P.

[0237] In a possible implementation, the target image features include K feature vectors, and the dimension of each feature vector is P;

[0238] The processor 904 performs recognition processing on the target image features to obtain an object recognition result of the target object, including:

[0239] Based on the self-attention mechanism and the K eigenvectors, a self-attention weight matrix is ​​obtained, and according to the self-attention weight matrix, K attention eigenvectors corresponding to the K eigenvectors are determined;

[0240] The decoder is called to respectively identify the K attention feature vectors to determine the object recognition result of the target object.

[0241] In a possible implementation, the processor 904 is further configured to perform the following operations:

[0242] Acquire a sample image set, wherein the sample image set includes a plurality of sample images, a positive sample object recognition result corresponding to each sample image, and a negative sample object recognition result corresponding to each sample image;

[0243] Calling a sample image processing model to obtain a first prediction probability set corresponding to each sample image, wherein the sample image processing model includes a discriminator and a generator;

[0244] Performing adversarial training on the sample image processing model according to each positive sample object recognition result, each negative sample object recognition result and each first prediction probability set;

[0245] When the trained sample image processing model meets the model convergence condition, the trained generator is determined as the image processing model, and the image processing model is used to identify the image to be processed containing the target object to obtain the object recognition result of the target object.

[0246] In a possible implementation, the processor 904 performs adversarial training on the sample image processing model according to each positive sample object recognition result, each negative sample object recognition result, and each first prediction probability set, including:

[0247] Adjusting the model parameters of the discriminator according to the positive sample object recognition result of each sample image, the first prediction probability set of each sample image, and the negative sample object recognition result of each sample image;

[0248] According to the adjusted discriminator, obtaining a second prediction probability set corresponding to each sample image;

[0249] According to the positive sample object recognition result of each sample image and the second prediction probability set of each sample image, the model parameters of the generator are adjusted, and the discriminator and the generator are trained alternately.

[0250] In a possible implementation, the processor 904 adjusts the model parameters of the discriminator according to the positive sample object recognition result of each sample image, the first prediction probability set of each sample image, and the negative sample object recognition result of each sample image, including:

[0251] Determining a first reward feedback according to the positive sample object recognition result of each sample image and the first predicted probability set of each sample image;

[0252] Determining a second reward feedback according to the first predicted probability set of each sample image;

[0253] Determining a third reward feedback according to the negative sample object recognition result of each sample image and the first prediction probability set of each sample image;

[0254] The first reward feedback, the second reward feedback and the third reward feedback are superimposed as a target reward feedback, and the model parameters of the discriminator are reversely adjusted according to the target reward feedback.

[0255] In a possible implementation, the processor 904 adjusts the model parameters of the generator according to the positive sample object recognition result of each sample image and the second prediction probability set of each sample image, including:

[0256] Obtaining a target loss according to a positive sample object recognition result of each sample image and a second prediction probability set of each sample image;

[0257] The model parameters of the generator are reversely adjusted according to the target loss.

[0258] It should be understood that the computer device 900 described in the embodiment of the present application can execute the above Figure 3 to Figure 7c The description of the image processing method in the corresponding embodiment can also be performed as described above. Figure 8 The description of the image processing device in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated here either.

[0259] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and systems can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0260] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer storage medium, and the computer storage medium stores a computer program executed by the image processing device mentioned above, and the computer program includes program instructions. When the processor executes the above program instructions, it can execute the above Figure 3 to Figure 7cThe method in the corresponding embodiment, therefore, will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed on a computer device, or executed on multiple computer devices located in one location, or, executed on multiple computer devices distributed in multiple locations and interconnected by a communication network, and multiple computer devices distributed in multiple locations and interconnected by a communication network can constitute a blockchain system.

[0261] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device can perform the above Figure 3 to Figure 7c The method in the corresponding embodiment will therefore not be described in detail here.

[0262] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0263] The above disclosure is only part of the embodiments of the present application, which certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of implementing the above embodiments and making equivalent changes according to the claims of this application are still within the scope of the invention.

Claims

1. An image processing method, characterized in that: include: Obtain an image to be processed containing a target object; Extracting original image features of the image to be processed, where the original image features include N original feature maps, any original feature map includes K feature map pixels, feature map pixels at the same position in the N original feature maps correspond to an image region of the image to be processed, and N and K are positive integers; Performing a convolution operation on the N original feature maps based on a first convolution kernel to obtain P first convolution feature maps, where P is a positive integer; Performing a convolution operation on the N original feature maps based on a second convolution kernel to obtain P second convolution feature maps; Performing a convolution operation on the N original feature maps based on a third convolution kernel to obtain P third convolution feature maps, wherein the size of any first convolution feature map, any second convolution feature map, and any third convolution feature map is the same as that of any original feature map; Based on the attention mechanism, identifying the P first convolution feature maps, the P second convolution feature maps, and the P third convolution feature maps, and determining K image region features of the K image regions in the image to be processed; Respectively obtain the position features of each image region in the original image features, and superimpose the original image features, the K image region features and the K position features as the target image features of the image to be processed; The target image features are identified and processed to obtain an object recognition result of the target object.

2. The method according to claim 1, characterized in that The target object includes a formula object, and the object recognition result includes a typeset code sequence of the formula object; or, The target object includes a character object, and the object recognition result includes a typesetting code sequence of the character object; or, The target object includes a first character object, the object recognition result includes a second character object, and the language type of the first character object is different from the language type of the second character object.

3. The method according to claim 1, characterized in that The reference image region is one of the K image regions; Based on the attention mechanism, the process of identifying the P first convolution feature maps, the P second convolution feature maps, and the P third convolution feature maps, and determining the image region features of the reference image region in the image to be processed includes: Determining K region similarities between the reference image region and the K image regions according to the P first convolution feature maps and the P second convolution feature maps; The image region features of the reference image region are determined according to K region similarities between the reference image region and the K image regions and the P third convolution feature maps.

4. The method according to claim 3, characterized in that The P second convolution feature maps include K second convolution feature vectors, and the dimension of each second convolution feature vector is P; Determining K region similarities between the reference image region and the K image regions according to the P first convolution feature maps and the P second convolution feature maps includes: Obtain pixel values ​​of pixels corresponding to the reference image area in each first convolution feature map respectively, and combine the obtained P pixel values ​​into a first convolution feature vector; Perform dot product operations on the first convolution feature vector and the K second convolution feature vectors respectively to obtain K region similarities between the reference image region and the K image regions.

5. The method according to claim 3, characterized in that: The P third convolution feature maps include K third convolution feature vectors, and the dimension of each third convolution feature vector is P; The step of determining the image region feature of the reference image region according to the K region similarities between the reference image region and the K image regions and the P third convolution feature maps comprises: A weighted operation is performed on the K region similarities and the K third convolution feature vectors to determine the image region feature of the reference image region.

6. The method according to claim 1, characterized in that The reference image region is one of the K image regions; The process of obtaining the position features of the reference image area in the original image features includes: Obtain reference feature map pixels corresponding to the reference image region in the original image features; Obtaining first reference positions and second reference positions corresponding to the reference feature map pixels in the N original feature maps respectively; A reference position feature is generated according to the first reference position and the second reference position, where the dimension of the reference position feature is P.

7. The method according to claim 6, characterized in that The target image features include K feature vectors, each feature vector has a dimension of P; The step of performing recognition processing on the target image features to obtain an object recognition result of the target object includes: Based on the self-attention mechanism and the K eigenvectors, a self-attention weight matrix is ​​obtained, and according to the self-attention weight matrix, K attention eigenvectors corresponding to the K eigenvectors are determined; The decoder is called to respectively identify the K attention feature vectors to determine the object recognition result of the target object.

8. The method according to claim 1, characterized in that: The method further comprises: Acquire a sample image set, wherein the sample image set includes a plurality of sample images, a positive sample object recognition result corresponding to each sample image, and a negative sample object recognition result corresponding to each sample image; Calling a sample image processing model to obtain a first prediction probability set corresponding to each sample image, wherein the sample image processing model includes a discriminator and a generator; Performing adversarial training on the sample image processing model according to each positive sample object recognition result, each negative sample object recognition result and each first prediction probability set; When the trained sample image processing model meets the model convergence condition, the trained generator is determined as the image processing model, and the image processing model is used to identify the image to be processed containing the target object to obtain the object recognition result of the target object.

9. The method according to claim 8, characterized in that The performing adversarial training on the sample image processing model according to each positive sample object recognition result, each negative sample object recognition result and each first prediction probability set comprises: Adjusting the model parameters of the discriminator according to the positive sample object recognition result of each sample image, the first prediction probability set of each sample image, and the negative sample object recognition result of each sample image; According to the adjusted discriminator, a second prediction probability set corresponding to each sample image is obtained; According to the positive sample object recognition result of each sample image and the second prediction probability set of each sample image, the model parameters of the generator are adjusted, and the discriminator and the generator are trained alternately.

10. The method according to claim 9, characterized in that The adjusting the model parameters of the discriminator according to the positive sample object recognition result of each sample image, the first prediction probability set of each sample image and the negative sample object recognition result of each sample image comprises: Determining a first reward feedback according to the positive sample object recognition result of each sample image and the first predicted probability set of each sample image; Determining a second reward feedback according to the first predicted probability set of each sample image; Determining a third reward feedback according to the negative sample object recognition result of each sample image and the first prediction probability set of each sample image; The first reward feedback, the second reward feedback and the third reward feedback are superimposed as a target reward feedback, and the model parameters of the discriminator are reversely adjusted according to the target reward feedback.

11. The method according to claim 9, characterized in that The adjusting the model parameters of the generator according to the positive sample object recognition result of each sample image and the second prediction probability set of each sample image comprises: Obtaining a target loss according to a positive sample object recognition result of each sample image and a second prediction probability set of each sample image; The model parameters of the generator are reversely adjusted according to the target loss.

12. An image processing device, characterized in that: include: An acquisition unit, used for acquiring an image to be processed containing a target object; An extraction unit, used to extract original image features of the image to be processed, the original image features include N original feature maps, any original feature map includes K feature map pixels, the feature map pixels at the same position in the N original feature maps correspond to an image region of the image to be processed, and N and K are positive integers; A determining unit, configured to perform a convolution operation on the N original feature maps based on a first convolution kernel to obtain P first convolution feature maps, where P is a positive integer; The determining unit is further configured to perform a convolution operation on the N original feature maps based on a second convolution kernel to obtain P second convolution feature maps; The determining unit is further configured to perform a convolution operation on the N original feature maps based on a third convolution kernel to obtain P third convolution feature maps, wherein the size of any first convolution feature map, any second convolution feature map, and any third convolution feature map is the same as that of any original feature map; The determining unit is further used to identify the P first convolution feature maps, the P second convolution feature maps, and the P third convolution feature maps based on an attention mechanism, and determine K image region features of the K image regions in the image to be processed; A processing unit, used to respectively obtain the position features of each image region in the original image features, and superimpose the original image features, the K image region features and the K position features as target image features of the image to be processed; The recognition unit is used to perform recognition processing on the target image features to obtain an object recognition result of the target object.

13. A computer device, characterized in that: The invention comprises a memory and a processor, wherein the memory stores a set of program codes, and the processor calls the program codes stored in the memory to execute the method according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 11.

15. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 11 is performed.