Image processing method and apparatus, and storage medium

By determining the foreground score of image feature vectors and selecting important feature vectors for processing in the target detection model, the problem of high computational complexity of the model is solved, efficient target detection is achieved and the scope of application is expanded.

WO2024175099A1PCT designated stage expired Publication Date: 2024-08-29HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/078338
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-24
Filing Date
2024-02-23
Publication Date
2024-08-29

AI Technical Summary

Technical Problem

The current transformer-based target detection model has high computational complexity, making it difficult to reduce model complexity and improve model efficiency while maintaining model accuracy.

Method used

By determining the foreground score of the first feature vector of the image, some feature vectors are selected as the second feature vector, so that the neural network model processes the second feature vector and updates the first feature vector to focus on the important information feature vectors. , balances computational efficiency and accuracy, and compresses the model while maintaining accuracy.

Benefits of technology

It reduces the calculation amount of the model, improves the operating efficiency, enables the model to be deployed on terminals, expands the scope of application, and outputs more accurate target detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024078338_29082024_PF_FP_ABST
    Figure CN2024078338_29082024_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to an image processing method and apparatus, and a storage medium. The method comprises: performing feature extraction on an acquired image, and determining first feature vectors of the image; determining foreground scores of the plurality of first feature vectors, and selecting some feature vectors from the plurality of first feature vectors as second feature vectors on the basis of the foreground scores, wherein the foreground score represents the probability that an image portion indicated by the first feature vector is the foreground; inputting the first feature vectors and the second feature vectors into a neural network model, processing the second feature vectors, and updating the first feature vectors on the basis of the processed second feature vectors to obtain updated first feature vectors; and the neural network model determining a target detection result on the basis of the updated first feature vectors. According to the embodiments of the present application, a model can be compressed while the model precision is kept, the computation amount of the model is reduced, the operation efficiency of the model is improved, and the application range of the model is expanded.
Need to check novelty before this filing date? Find Prior Art

Description

Image processing method, device and storage medium

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on February 24, 2023, with application number 202310212196.X and invention name “Image processing method, device and storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of artificial intelligence (AI) technology, and in particular to an image processing method, device, and storage medium. Background Art

[0003] AI is the theory, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. Computer vision is a crucial component of artificial intelligence, and object detection is a fundamental task in computer vision. Its goal is to predict the bounding box and object category of an object in an image. Object detection has numerous real-world applications, such as smart cities, autonomous driving, industrial robotics, and image retrieval, and is therefore gaining increasing attention.

[0004] Transformer-based object detectors have made significant progress and are gradually closing the gap with convolutional neural network (CNN)-based object detectors. However, current models typically perform indiscriminate calculations on all extracted feature vectors (tokens), resulting in high computational complexity. Therefore, it is crucial to reduce model complexity and improve efficiency while maintaining accuracy.

[0005] Summary of the Invention

[0006] In view of this, an image processing method, device and storage medium are proposed.

[0007] In a first aspect, an embodiment of the present application provides an image processing method. The method includes:

[0008] Performing feature extraction on the acquired image to determine the first eigenvector of the image;

[0009] determining foreground scores of the plurality of first eigenvectors, and selecting, based on the foreground scores, some eigenvectors from the plurality of first eigenvectors as second eigenvectors, wherein the foreground scores represent a probability that the image portion indicated by the first eigenvector is a foreground;

[0010] Inputting the first eigenvector and the second eigenvector into the neural network model, processing the second eigenvector, and updating the first eigenvector based on the processed second eigenvector to obtain an updated first eigenvector;

[0011] The neural network model determines the target detection result based on the updated first eigenvector.

[0012] According to an embodiment of the present application, by determining the foreground score of the first eigenvector of the image, some eigenvectors are selected as second eigenvectors based on the foreground score, and the neural network model processes the second eigenvector. Based on the processed second eigenvector, the first eigenvector is updated to determine the target detection result, so that the model can focus on the eigenvectors that are more likely to correspond to the foreground and have important information, so as to balance the computational efficiency and accuracy of the model. While maintaining the accuracy of the model, the model is compressed to reduce the computational amount of the model, improve the operating efficiency of the model, and support deployment on the terminal, thereby expanding the application scope of the model.

[0013] According to the first aspect, in a first possible implementation of the image processing method, determining foreground scores of a plurality of first eigenvectors, and selecting some eigenvectors from the plurality of first eigenvectors as second eigenvectors based on the foreground scores includes:

[0014] Based on the semantic information of the plurality of first feature vectors, the first feature vectors are scored respectively by using a first multi-layer perceptron to determine foreground scores of the plurality of first feature vectors.

[0015] According to an embodiment of the present application, by determining the foreground score based on the semantic information of the first eigenvector, the calculated score can be made more accurate, so that more important eigenvectors can be selected therefrom, thereby improving the calculation accuracy of subsequent models.

[0016] According to the first aspect or the first possible implementation manner of the first aspect, in a second possible implementation manner of the image processing method, the first feature vector is a feature vector on a multi-layer feature image, foreground scores of the plurality of first feature vectors are determined, and based on the foreground scores, some feature vectors are selected from the plurality of first feature vectors as second feature vectors, including:

[0017] Determining a foreground score of the first eigenvector on the uppermost layer of the feature image using a first multilayer perceptron according to the first eigenvector, wherein the upper-layer feature images include more semantic information;

[0018] The first multilayer perceptron determines, for the first eigenvector on each layer of the feature image, a foreground score of the first eigenvector on the feature image of the previous layer based on the foreground score of the first eigenvector on the feature image of the previous layer.

[0019] According to an embodiment of the present application, it is possible to use the foreground score of the first feature vector on a high-level feature image to modulate the foreground score of the first feature image on a low-level feature image, so that the high-level semantic information can be better integrated into the adjacent low-level feature image, which can make the calculated foreground score of the first feature vector more accurate and improve the efficiency of subsequent calculations.

[0020] According to the second possible implementation manner of the first aspect, in a third possible implementation manner of the image processing method, the first multilayer perceptron determines, for the first eigenvector on each layer of the feature image, based on the foreground score of the first eigenvector on the feature image on the previous layer, the foreground score of the first eigenvector on the feature image on the previous layer, including:

[0021] The first multilayer perceptron, for the first eigenvector on each layer of feature image, fuses the result of upsampling the foreground score of the first eigenvector on the feature image of the previous layer with the first eigenvector on the feature image of the current layer to determine the foreground score of the first eigenvector on the feature image of the current layer.

[0022] According to an embodiment of the present application, by fusing the result of upsampling the foreground score of the first eigenvector on the feature image of the previous layer with the first eigenvector on the feature image of this layer, the foreground score of the first eigenvector on the feature image of this layer is determined. In the process of calculating the foreground score, it is possible to better transfer the upper-layer semantic information to the feature image of the adjacent lower layer to obtain a more accurate foreground score calculation result, thereby better assisting subsequent target detection and enabling the model to output more accurate target detection results.

[0023] According to the first aspect or the first, second, or third possible implementation manner of the first aspect, in a fourth possible implementation manner of the image processing method, the second eigenvector includes an updated second eigenvector, the first eigenvector and the second eigenvector are input into the neural network model, the second eigenvector is processed, and the first eigenvector is updated based on the processed second eigenvector to obtain the updated first eigenvector, including:

[0024] Inputting the first eigenvector and the second eigenvector into the neural network model, scoring the second eigenvectors respectively using a second multilayer perceptron based on the second eigenvectors to determine category scores for the plurality of second eigenvectors, the category scores representing the probability that the image portion indicated by the second eigenvector belongs to a certain category;

[0025] Based on the foreground score and the category score, selecting some feature vectors from the plurality of second feature vectors as the third feature vector;

[0026] Processing the third eigenvector, and updating the second eigenvector based on the processed third eigenvector to obtain an updated second eigenvector;

[0027] The updated second eigenvector is processed, and the first eigenvector is updated based on the processed second eigenvector to obtain an updated first eigenvector.

[0028] According to an embodiment of the present application, by using a second multi-layer perceptron to score the second eigenvectors separately, determining the category scores of multiple second eigenvectors, and selecting the third eigenvector based on the foreground score and the category score, it is possible to comprehensively consider the position information and category semantic information, further screen the second eigenvectors, and obtain more fine-grained eigenvectors for processing, while maintaining the accuracy of the model, significantly reducing the computational complexity of the model.

[0029] According to a fourth possible implementation manner of the first aspect, in a fifth possible implementation manner of the image processing method, the neural network model includes an encoder and a decoder, processes the third eigenvector, and updates the second eigenvector based on the processed third eigenvector to obtain an updated second eigenvector, including:

[0030] The encoder processes the third eigenvector using a self-attention mechanism, and based on the processed third eigenvector, updates the portion of the third eigenvector in the second eigenvector to obtain an updated second eigenvector.

[0031] Processing the updated second eigenvector and updating the first eigenvector based on the processed second eigenvector to obtain an updated first eigenvector includes:

[0032] The encoder processes the updated second eigenvector using a deformable attention mechanism, and based on the processed second eigenvector, updates the part of the second eigenvector in the first eigenvector to obtain an updated first eigenvector.

[0033] The neural network model determines the target detection result based on the updated first eigenvector, including:

[0034] The decoder determines the target detection result based on the updated first feature vector.

[0035] According to an embodiment of the present application, by further screening the second eigenvector in the encoder, the encoder can interact only with important eigenvectors, and taking into account the defects of the deformable attention mechanism in long-distance information interaction, it is possible to significantly reduce the amount of computation in the encoder of the transformer model, improve the computational efficiency of the model, and enable the decoder to output more accurate target detection results based on the updated first eigenvector, thereby maintaining the computational accuracy of the model.

[0036] According to the fourth or fifth possible implementation manner of the first aspect, in a sixth possible implementation manner of the image processing method, the category does not include a background category.

[0037] According to the embodiments of the present application, the strategy can be made more reasonable, and the filtered feature vectors can be made more important feature vectors, thereby better assisting the model in target detection and improving the accuracy of the model.

[0038] According to the first, second, third, fourth, fifth, or sixth possible implementation manner of the first aspect, in a seventh possible implementation manner of the image processing method, the first multilayer perceptron is a trained first multilayer perceptron, and the method further includes:

[0039] Based on the position of the detection frame of the true value and the position of the first eigenvector, a binary label is generated for each of the plurality of first eigenvectors, wherein the image portion indicated by the detection frame of the true value is the foreground, and a binary label that is the true value indicates that the image portion indicated by the corresponding first eigenvector is the foreground;

[0040] The first multilayer perceptron is trained based on the binary label and the foreground score of the first eigenvector determined during the training process to obtain a trained first multilayer perceptron.

[0041] According to an embodiment of the present application, by generating binary labels for multiple first eigenvectors based on the position of the detection box of the true value and the position of the first eigenvector, the binary labels can be used to indicate whether the image portion indicated by the corresponding first eigenvector is the foreground, thereby better adjusting the parameters of the first multi-layer perceptron during the training phase, so that the first multi-layer perceptron can calculate the foreground score more accurately, thereby improving the accuracy of the model.

[0042] According to the seventh possible implementation of the first aspect, in the eighth possible implementation of the image processing method, the interval size of the detection frame corresponding to each layer of feature image is different, and the interval of the detection frame corresponding to the feature image of the upper layer is larger.

[0043] According to an embodiment of the present application, by making the interval of the detection box corresponding to the feature image of the upper layer larger, it is possible to achieve overlap in the areas supported for detection by the feature images of each layer, thereby improving the prediction situation near the boundary, generating more accurate binary labels, achieving better training effects, and improving the accuracy of the model.

[0044] In a second aspect, an embodiment of the present application provides an image processing device. The device includes:

[0045] A feature extraction module is used to extract features from the acquired image and determine a first feature vector of the image;

[0046] a selection module, configured to determine foreground scores of the plurality of first eigenvectors, and select some eigenvectors from the plurality of first eigenvectors as second eigenvectors based on the foreground scores, wherein the foreground scores represent a probability that the image portion indicated by the first eigenvector is the foreground;

[0047] an updating module, configured to input the first eigenvector and the second eigenvector into the neural network model, process the second eigenvector, and update the first eigenvector based on the processed second eigenvector to obtain an updated first eigenvector;

[0048] The determination module is used for the neural network model to determine the target detection result based on the updated first eigenvector.

[0049] According to the second aspect, in a first possible implementation manner of the image processing apparatus, the selection module is configured to:

[0050] Based on the semantic information of the plurality of first feature vectors, the first feature vectors are scored respectively by using a first multi-layer perceptron to determine foreground scores of the plurality of first feature vectors.

[0051] According to the second aspect or the first possible implementation manner of the second aspect, in a second possible implementation manner of the image processing device, the first feature vector is a feature vector on a multi-layer feature image, and the selection module is configured to:

[0052] Determining a foreground score of the first eigenvector on the uppermost layer of the feature image using a first multilayer perceptron according to the first eigenvector, wherein the upper-layer feature images include more semantic information;

[0053] The first multilayer perceptron determines, for the first eigenvector on each layer of the feature image, a foreground score of the first eigenvector on the feature image of the previous layer based on the foreground score of the first eigenvector on the feature image of the previous layer.

[0054] According to the second possible implementation manner of the second aspect, in a third possible implementation manner of the image processing device, the first multilayer perceptron determines, for the first eigenvector on each layer of the feature image, based on the foreground score of the first eigenvector on the feature image on the previous layer, including:

[0055] The first multilayer perceptron, for the first eigenvector on each layer of feature image, fuses the result of upsampling the foreground score of the first eigenvector on the feature image of the previous layer with the first eigenvector on the feature image of the current layer to determine the foreground score of the first eigenvector on the feature image of the current layer.

[0056] According to the second aspect or the first or second or third possible implementation manner of the second aspect, in a fourth possible implementation manner of the image processing apparatus, the second feature vector includes an updated second feature vector, and the updating module is configured to:

[0057] Inputting the first eigenvector and the second eigenvector into the neural network model, scoring the second eigenvectors respectively using a second multilayer perceptron based on the second eigenvectors to determine category scores for the plurality of second eigenvectors, the category scores representing the probability that the image portion indicated by the second eigenvector belongs to a certain category;

[0058] Based on the foreground score and the category score, selecting some feature vectors from the plurality of second feature vectors as the third feature vector;

[0059] Processing the third eigenvector, and updating the second eigenvector based on the processed third eigenvector to obtain an updated second eigenvector;

[0060] The updated second eigenvector is processed, and the first eigenvector is updated based on the processed second eigenvector to obtain an updated first eigenvector.

[0061] According to a fourth possible implementation manner of the second aspect, in a fifth possible implementation manner of the image processing device, the neural network model includes an encoder and a decoder, processes the third eigenvector, and updates the second eigenvector based on the processed third eigenvector to obtain an updated second eigenvector, including:

[0062] The encoder processes the third eigenvector using a self-attention mechanism, and based on the processed third eigenvector, updates the portion of the third eigenvector in the second eigenvector to obtain an updated second eigenvector.

[0063] Processing the updated second eigenvector and updating the first eigenvector based on the processed second eigenvector to obtain an updated first eigenvector includes:

[0064] The encoder processes the updated second eigenvector using a deformable attention mechanism, and based on the processed second eigenvector, updates the part of the second eigenvector in the first eigenvector to obtain an updated first eigenvector.

[0065] Identify modules for:

[0066] The decoder determines the target detection result based on the updated first feature vector.

[0067] According to the fourth or fifth possible implementation manner of the second aspect, in a sixth possible implementation manner of the image processing apparatus, the category does not include a background category.

[0068] According to the first, second, third, fourth, fifth, or sixth possible implementation manner of the second aspect, in a seventh possible implementation manner of the image processing device, the first multilayer perceptron is a trained first multilayer perceptron, and the device further includes:

[0069] A generating module, configured to generate a binary label for each of the plurality of first eigenvectors based on the position of the detection frame of the true value and the position of the first eigenvector, wherein the image portion indicated by the detection frame of the true value is the foreground, and a binary label being a true value indicates that the image portion indicated by the corresponding first eigenvector is the foreground;

[0070] The training module is used to train the first multi-layer perceptron based on the binary label and the foreground score of the first eigenvector determined during the training process to obtain a trained first multi-layer perceptron.

[0071] According to the seventh possible implementation of the second aspect, in an eighth possible implementation of the image processing device, the interval size of the detection frame corresponding to each layer of feature image is different, and the interval of the detection frame corresponding to the feature image of the upper layer is larger.

[0072] In a third aspect, an embodiment of the present application provides an image processing device, comprising: a processor and a memory; the memory is used to store programs; the processor is used to execute the programs stored in the memory, so that the device implements the above-mentioned first aspect or one or several image processing methods of the multiple possible implementation methods of the first aspect.

[0073] In a fourth aspect, an embodiment of the present application provides a terminal device that can execute the image processing method of the above-mentioned first aspect or one or more of the multiple possible implementations of the first aspect.

[0074] In the fifth aspect, an embodiment of the present application provides a computer-readable storage medium on which program instructions are stored, characterized in that when the program instructions are executed by a computer, the computer implements the image processing method of the above-mentioned first aspect or one or more of the multiple possible implementation methods of the first aspect.

[0075] In a sixth aspect, an embodiment of the present application provides a computer program product comprising program instructions, which, when executed by a computer, enable the computer to implement the image processing method of the first aspect or one or more of the multiple possible implementations of the first aspect.

[0076] These and other aspects of the present application will become more readily apparent from the following description of the embodiment(s). BRIEF DESCRIPTION OF THE DRAWINGS

[0077] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the application and, together with the description, serve to explain the principles of the application.

[0078] FIG1 is a schematic diagram showing an application scenario according to an embodiment of the present application.

[0079] FIG2 is a schematic diagram showing an application scenario according to an embodiment of the present application.

[0080] FIG3 shows a schematic diagram of a system architecture according to an embodiment of the present application.

[0081] FIG4 shows a flowchart of an image processing method according to an embodiment of the present application.

[0082] FIG5 shows a schematic diagram of a model architecture according to an embodiment of the present application.

[0083] FIG6 shows a flowchart of an image processing method according to an embodiment of the present application.

[0084] FIG7 is a schematic diagram showing a method for calculating a prospect score according to an embodiment of the present application.

[0085] FIG8 shows a flowchart of an image processing method according to an embodiment of the present application.

[0086] FIG9 shows a flowchart of an image processing method according to an embodiment of the present application.

[0087] FIG10 shows a structural diagram of an image processing apparatus according to an embodiment of the present application.

[0088] FIG11 shows a structural diagram of an electronic device 1100 according to an embodiment of the present application. DETAILED DESCRIPTION

[0089] Various exemplary embodiments, features, and aspects of the present application will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise indicated.

[0090] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0091] In addition, numerous specific details are provided in the detailed description below to better illustrate the present application. Those skilled in the art will appreciate that the present application can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art are not described in detail in order to highlight the main purpose of the present application.

[0092] AI is the theory, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. Computer vision is a crucial component of artificial intelligence, and object detection is a fundamental task within it. Its goal is to predict the bounding box and object category of an object in an image. Object detection has numerous real-world applications, such as smart cities, autonomous driving, industrial robotics, and image retrieval, and is therefore gaining increasing attention. Transformer-based object detectors have made significant progress and are gradually closing the gap with CNN-based object detectors. However, current models typically perform indiscriminate calculations on all extracted feature vectors (tokens), resulting in high computational complexity. Therefore, it is crucial to reduce model complexity and improve efficiency while maintaining accuracy.

[0093] In order to solve the above technical problems, the present application provides an image processing method. The image processing method of the embodiment of the present application determines the foreground score of the first eigenvector of the image, selects some eigenvectors as second eigenvectors based on the foreground score, and enables the neural network model to process the second eigenvector. Based on the processed second eigenvector, the first eigenvector is updated to determine the target detection result, so that the model can focus on the eigenvectors that are more likely to correspond to the foreground and have important information to balance the computational efficiency and accuracy of the model. While maintaining the accuracy of the model, the model is compressed to reduce the computational amount of the model, improve the operating efficiency of the model, and enable the model to be deployed on the terminal, thereby expanding the application scope of the model.

[0094] The image processing method of the present application can be used in target detection scenarios, such as general object detection, pedestrian detection in autonomous driving, traffic light detection, text detection in optical character recognition (OCR), layout analysis, etc., all of which involve detection tasks. The following uses text detection and autonomous driving scenarios as examples to introduce the application scenarios of the embodiments of the present application. Referring to Figures 1 and 2, schematic diagrams of application scenarios according to an embodiment of the present application are shown.

[0095] As shown in Figure 1, the image processing method of the embodiment of the present application can be applied to the text detection scenario. In this case, the target object to be recognized can be text. For example, document images, invoice images, and images containing text in natural scenes can be input into the neural network model of the embodiment of the present application. The neural network model can process these images and their locations. Thus, the model can output the location of the text box corresponding to the text and the corresponding text content.

[0096] As shown in Figure 2, the image processing method of the embodiment of the present application can also be applied to the scene of autonomous driving, in which there may be a variety of target detection needs, such as traffic light detection, traffic sign detection, pedestrian detection, vehicle detection, etc. Among them, the image collected by the vehicle sensor (such as the image including the traffic light, the image including the traffic sign, and the image including the pedestrian in the figure) can be input into the neural network model of the embodiment of the present application. The neural network model can process the image and output the corresponding detection result, which may include a detection box indicating the location of the target object and the corresponding category. For example, when the target object includes a traffic light, the detection result may include a detection box indicating the location of the traffic light and the corresponding category (traffic light).

[0097] The embodiments of the present application can also be used in other target detection scenarios besides the above, and this application does not limit this.

[0098] Figure 3 shows a schematic diagram of a system architecture according to an embodiment of the present application. As shown in Figure 3, the image processing system according to the embodiment of the present application may include a feature extraction module, a foreground feature selector, an encoder, and a decoder.

[0099] Among them, the feature extraction module can be used to extract features from the acquired image and determine the first feature vector on a multi-layer (for example, 4-layer) feature image; the foreground feature selector can be used to screen multiple first feature vectors based on the foreground score to obtain a second feature vector; the encoder can be used to further perform feature extraction based on the second feature vector and update the first feature vector; the decoder can be used to determine the target detection result based on the features extracted by the encoder, that is, to determine the detection box position and the corresponding category in the image.

[0100] Optionally, the encoder may further include an object enhanced self-attention module (OESM) for further screening the second eigenvector to obtain a third eigenvector, and performing processing and calculation based on the third eigenvector to update the second eigenvector.

[0101] The image processing system of the embodiment of the present application can be deployed in products involving target detection, such as terminal devices, monitoring equipment, and cloud servers. The method of the embodiment of the present application can be implemented through program code in the memory, for example, it can be deployed on the computer node of the relevant equipment to improve the accuracy and speed of product target detection.

[0102] The terminal devices involved in this application may be smart phones, image sensing devices (such as cameras, etc.), netbooks, tablet computers, laptops, wearable electronic devices (such as smart bracelets, smart watches, etc.), TVs, virtual reality devices, and the like. The terminal devices of this application may be touch-screen, non-touch-screen, or screenless. The touch-screen terminal devices may be controlled by clicking, sliding, etc. on the display screen with fingers, styluses, etc. The non-touch-screen devices may be connected to input devices such as a mouse, keyboard, and touch panel. The terminal devices involved in this application may refer to devices with a wireless connection function. The wireless connection function refers to the ability to connect to other terminal devices or servers through wireless connection methods such as Wi-Fi and Bluetooth. The terminal devices of this application may also have the function of communicating through a wired connection.

[0103] The cloud server involved in this application can be a physical device or a virtual device, such as a virtual machine, container, etc., with wireless communication capabilities, wherein the wireless communication capabilities can be set in the chip (system) or other parts or components of the server. It can refer to a device with a wireless connection function, and the wireless connection function means that it can be connected to other servers or vehicle terminals through wireless connection methods such as Wi-Fi and Bluetooth. The server of this application can also have the function of communicating via a wired connection.

[0104] The image processing method of the embodiment of the present application is described in detail below with reference to Figures 4 to 9.

[0105] FIG4 shows a flow chart of an image processing method according to an embodiment of the present application. The method can be used in a terminal device or a cloud server. As shown in FIG4 , the method includes:

[0106] Step S401: extract features from the acquired image to determine a first feature vector of the image.

[0107] The acquired image can be subjected to feature extraction using a backbone network to obtain a multi-layer feature map, where the scale of the feature map can be smaller as the layers increase. The first feature vector (token) can be a feature vector on the multi-layer feature map, and each layer of the feature map can include multiple first feature vectors to indicate the characteristics of the image.

[0108] The backbone can be a neural network such as CNN, and this application does not impose any restrictions on this.

[0109] Referring to Figure 5 , a schematic diagram of a model architecture according to an embodiment of the present application is shown. As shown in Figure 5 , features can be extracted from an acquired image (e.g., Image in the figure) to obtain four layers of feature images, each of which can include multiple first feature vectors.

[0110] However, since the image portion indicated by the first eigenvector may include a foreground that is more important for target detection and a background that is less important, the importance of the first eigenvector can be further judged to further screen the first eigenvector and reduce the computational complexity of subsequent models.

[0111] Step S402 : determining foreground scores of the plurality of first eigenvectors, and selecting some eigenvectors from the plurality of first eigenvectors as second eigenvectors based on the foreground scores.

[0112] The foreground score can represent the probability that the image portion indicated by the first eigenvector is the foreground. A foreground score can be determined for each first eigenvector. A higher foreground score indicates that the image portion indicated by the first eigenvector is more likely to be the foreground, and therefore more important in the object detection process.

[0113] After obtaining the foreground score of each first eigenvector, the first K first eigenvectors with the highest corresponding foreground scores may be selected as the second eigenvector, where K is a positive integer and may be determined as needed.

[0114] The method for determining the foreground score of the first feature vector may be described below. Optionally, step S402 may include:

[0115] Based on the semantic information of the plurality of first feature vectors, the first feature vectors are scored respectively by using a first multi-layer perceptron to determine foreground scores of the plurality of first feature vectors.

[0116] Semantic information can be used to characterize the content of an image, and including more semantic information can better help determine whether the image portion corresponding to the first eigenvector belongs to the foreground or background. This application does not limit the structure of the first multi-layer perception (MLP).

[0117] According to an embodiment of the present application, by determining the foreground score based on the semantic information of the first eigenvector, the calculated score can be made more accurate, so that more important eigenvectors can be selected therefrom, thereby improving the calculation accuracy of subsequent models.

[0118] Since the first eigenvector can be a eigenvector on multiple layers of feature images, and the feature images of different layers include different semantic information, the feature images of high layers have richer semantic information than the feature images of low layers. In the embodiment of the present application, the foreground score of the first eigenvector on the high-layer feature image is used to modulate the foreground score of the first eigenvector on the low-layer feature image, so that the semantic information of the high layer can be better transmitted to the adjacent layer, so as to more accurately calculate the foreground score of the first eigenvector, see below.

[0119] FIG6 is a flowchart of an image processing method according to an embodiment of the present application. As shown in FIG6 , optionally, the process of determining the foreground score may include:

[0120] Step S601: Determine the foreground score of the first eigenvector on the top-layer feature image using a first multi-layer perceptron based on the first eigenvector.

[0121] The feature images at higher layers may include more semantic information. The first multi-layer perceptron may be used to process each first feature vector in the top-most feature image. The processing method may be implemented based on existing technologies, thereby determining the foreground score of each first feature vector in the top-most feature image.

[0122] Step S602: The first multilayer perceptron determines, for the first eigenvector on each layer of the feature image, a foreground score of the first eigenvector on the feature image of the previous layer based on the foreground score of the first eigenvector on the feature image of the previous layer.

[0123] The foreground score of the first eigenvector on the feature image of the previous layer can be fused with the feature image of this layer, so as to use the first multi-layer perceptron to determine the foreground score of the first eigenvector on the feature image of this layer based on the fusion result. One implementation method can be found below.

[0124] According to an embodiment of the present application, it is possible to use the foreground score of the first feature vector on a high-level feature image to modulate the foreground score of the first feature image on a low-level feature image, so that the high-level semantic information can be better integrated into the adjacent low-level feature image, which can make the calculated foreground score of the first feature vector more accurate and improve the efficiency of subsequent calculations.

[0125] Optionally, step S602 may include:

[0126] The first multilayer perceptron, for the first eigenvector on each layer of feature image, fuses the result of upsampling the foreground score of the first eigenvector on the feature image of the previous layer with the first eigenvector on the feature image of the current layer to determine the foreground score of the first eigenvector on the feature image of the current layer.

[0127] Among them, a calculation method for performing fusion to calculate the foreground score can be referred to the following formula (1): S l-1 =MLP F (f l-1 (1+UP(α l *S l ))) Formula (1)

[0128] See FIG7, which shows a schematic diagram of a method for calculating a prospect score according to an embodiment of the present application. As shown in FIG7, S l-1 It can represent the foreground score of the first feature vector on the l-th layer feature image, S l It can represent the foreground score of the first feature vector on the l+1th layer feature image. l-1 It can represent the feature image of the lth layer. For example, when there are 4 layers of feature images, the value range of l can be {2, 3, 4}. UP(·) can represent the upsampling function (such as UP Sample in the figure), MLP F It can represent the first multi-layer perceptron (MLP in the figure), which is used to calculate the foreground score of the first feature vector on the feature image. l (or α in the figure) can represent learnable parameters, and the parameters corresponding to the feature images of different layers can be different.

[0129] As shown in Figure 5, the feature images of each layer pass through the foreground feature vector selector. After calculating the foreground score of the first feature vectors on each layer, a predetermined number of first feature vectors (such as the TOP K in the figure, i.e., the K with the highest scores) are selected based on the foreground score. That is, for all the first feature vectors on all layers, the K with the highest scores are selected. The examples of the selected first feature vectors for each layer can be seen in the figure. The selected first feature vectors can be used as input to the encoder for subsequent calculations.

[0130] According to an embodiment of the present application, by fusing the result of upsampling the foreground score of the first eigenvector on the feature image of the previous layer with the first eigenvector on the feature image of this layer, the foreground score of the first eigenvector on the feature image of this layer is determined. In the process of calculating the foreground score, it is possible to better transfer the upper-layer semantic information to the feature image of the adjacent lower layer to obtain a more accurate foreground score calculation result, thereby better assisting subsequent target detection and enabling the model to output more accurate target detection results.

[0131] Optionally, the first multilayer perceptron can be a trained first multilayer perceptron, and the parameters of the first multilayer perceptron can be modulated and learned during the training phase. The embodiment of the present application generates a binary label indicating whether the corresponding image portion is a foreground, so as to better train the first multilayer perceptron during the training phase. Referring to FIG. 8 , a flow chart of an image processing method according to an embodiment of the present application is shown. As shown in FIG. 8 , during the training phase, the method may further include:

[0132] Step S801 : Generate binary labels for the plurality of first eigenvectors based on the position of the detection frame of the true value and the position of the first eigenvector.

[0133] The detection frame indicated by the true value is the foreground portion of the image. The detection frame can be obtained by binary classification detection or other means in the prior art and is used to indicate the foreground portion of the detected image. The detection frame corresponding to the foreground portion can be represented by the true value. A true value for the binary label indicates that the image portion indicated by the corresponding first eigenvector is the foreground.

[0134] One way to generate binary labels can be found in formula (2):

[0135] in, The first eigenvector can be represented by The corresponding label, (i, j) can represent the position of the first eigenvector in the feature image, l can represent the level of the corresponding feature image. (x, y) can represent the position of the first eigenvector in the original image, and the corresponding relationship between (x, y) and (i, j) can be expressed as (x, y) = ([s l / 2]+i·s l ,[s l / 2]+j·s l ), where s l It can represent the step size corresponding to the first eigenvector in the lth layer feature image. Bbox A detection box that can represent the true value, It can represent the maximum distance from (i, j) to the detection box, and They can respectively represent the minimum and maximum values ​​of the object that can be predicted by the feature image of the lth layer.

[0136] To improve the prediction near the boundary, the regions where the feature images of each layer support detection can be set to overlap, as described below.

[0137] Optionally, the interval size of the detection frame corresponding to each layer of feature images is different, and the interval of the detection frame corresponding to the feature image of the upper layer is larger.

[0138] The minimum and maximum values ​​of the objects that can be predicted by the feature image of the first layer can be restricted so that the interval of the detection box corresponding to the feature image of the upper layer is larger. For example, This makes the upper-level feature images capable of detecting larger objects. Since the scale of the upper-level feature images can be smaller, the area supported by the feature images of each layer can be realized.

[0139] Step S802 : Training the first multi-layer perceptron based on the binary labels and the foreground score of the first eigenvector determined during the training process to obtain a trained first multi-layer perceptron.

[0140] After determining the binary label for each first eigenvector, since the binary label can indicate whether the image portion represented by the corresponding first eigenvector is the foreground, during the training phase, the parameters of the first multi-layer perceptron can be adjusted by calculating the loss function value between the foreground score of the first eigenvector and the binary label, thereby obtaining a trained first multi-layer perceptron.

[0141] According to an embodiment of the present application, by generating binary labels for multiple first eigenvectors based on the position of the detection box of the true value and the position of the first eigenvector, the binary labels can be used to indicate whether the image portion indicated by the corresponding first eigenvector is the foreground, thereby better adjusting the parameters of the first multi-layer perceptron during the training phase, so that the first multi-layer perceptron can calculate the foreground score more accurately, thereby improving the accuracy of the model.

[0142] Step S403: input the first eigenvector and the second eigenvector into the neural network model, process the second eigenvector, and update the first eigenvector based on the processed second eigenvector to obtain an updated first eigenvector.

[0143] The neural network model can be a transformer model, or other detectors, such as CNN, MLP based detectors, etc. For example, the process of step S403 can be implemented by the encoder of the transformer model. The input of the encoder is the first eigenvector (which can be called T a ), the second eigenvector (which can be called Tf ), it can also include the position encoding corresponding to the second feature vector (position embedding, which can be called PE f , which can be calculated based on existing technology), the number of second eigenvectors k, and the prospect score corresponding to the second eigenvector (which can be called S f ), the index of the second eigenvector (which can be called I f , which can be used to index from the first eigenvector to the location of the second eigenvector).

[0144] To further reduce the computational complexity of the model, the position information and category semantic information of the second eigenvector can be comprehensively considered, the obtained second eigenvector can be further filtered, and calculations can be performed based on the filtered eigenvector. See below.

[0145] Optionally, the second feature vector may include an updated second feature vector. FIG9 shows a flow chart of an image processing method according to an embodiment of the present application. As shown in FIG9 , step S403 may include:

[0146] Step S901: Input the first eigenvector and the second eigenvector into the neural network model, and score the second eigenvectors respectively using a second multi-layer perceptron according to the second eigenvectors to determine category scores of the plurality of second eigenvectors.

[0147] The category score can represent the probability that the image portion indicated by the second eigenvector belongs to a certain category. Categories include, for example, pedestrians, vehicles, and traffic lights. For example, in a multi-category object detection scenario, a second multi-layer perceptron can be used to predict the category to which the image portion indicated by each second eigenvector belongs and the probability that the image portion belongs to that category, and then use this probability as the category score.

[0148] Optionally, since the first feature vector has been screened based on foreground importance, in the process of further screening the second feature vector and calculating the category score, the predicted category does not include the background category.

[0149] In this way, the strategy can be made more reasonable, and the filtered feature vectors can be made more important feature vectors, which can better assist the model in target detection and improve the accuracy of the model.

[0150] Step S902 : Based on the foreground score and the category score, select some feature vectors from the plurality of second feature vectors as third feature vectors.

[0151] For example, the foreground score and the category score can be multiplied to obtain the final score corresponding to each second eigenvector. Based on the final score, a predetermined number of eigenvectors with the highest scores are selected from the plurality of second eigenvectors as the third eigenvectors. One method for calculating the final score can be found in formula (3):

[0152] Among them, p j The second eigenvector can be represented by The corresponding final score, f can represent the corresponding feature image, j can represent the jth feature vector on the corresponding feature image, s j and c j The foreground score and category score corresponding to the second eigenvector can be represented respectively, MLP C It can represent the second multi-layer perceptron.

[0153] Step S903 : Process the third eigenvector, and update the second eigenvector based on the processed third eigenvector to obtain an updated second eigenvector.

[0154] Among them, the indexes of the top k third eigenvectors with the highest final scores can be determined based on the final scores of the second eigenvectors. Based on this index, the third eigenvector can be determined from the second eigenvector Where T f The second eigenvector can be represented by . Correspondingly, the position encoding of the third eigenvector can be obtained Among them, PE f It can represent the position encoding of the second eigenvector.

[0155] Optionally, the neural network model may include an encoder, and step S903 may include:

[0156] The encoder processes the third eigenvector using a self-attention mechanism, and based on the processed third eigenvector, updates the part of the third eigenvector in the second eigenvector to obtain an updated second eigenvector.

[0157] The process of the encoder processing the third feature vector using the self-attention mechanism can be implemented based on existing technology. For example, q=k=PE in the self-attention mechanism can be made o +T o ,υ=T o , where q, k, and v can represent the query vector, key vector, and value vector in the self-attention mechanism, respectively. o It can represent the position encoding of the third eigenvector, T oIt can represent the third eigenvector. Therefore, the multi-head self-attention (MHSA) mechanism can be used to process the third eigenvector, further extract the features of the third eigenvector, and normalize the processed third eigenvector, so that the index of the third eigenvector can be obtained. Update the third eigenvector in the second eigenvector to obtain the updated second eigenvector T′ f .

[0158] Referring to Figure 5, the above-mentioned S901-S903 process can be implemented in a target enhanced self-supervision module (such as OESM in the figure), which can perform multi-category score prediction on the second eigenvector, determine the category score of the second eigenvector, and screen out the top K (Top K in the figure) third eigenvectors with the highest final scores based on the category score and foreground score, so as to utilize the self-attention mechanism (such as self-supervision in the figure) to process the third eigenvector, and update the second eigenvector based on the processed third eigenvector.

[0159] Step S904 : Process the updated second eigenvector, and update the first eigenvector based on the processed second eigenvector to obtain an updated first eigenvector.

[0160] According to an embodiment of the present application, by using a second multi-layer perceptron to score the second eigenvectors separately, determining the category scores of multiple second eigenvectors, and selecting the third eigenvector based on the foreground score and the category score, it is possible to comprehensively consider the position information and category semantic information, further screen the second eigenvectors, and obtain more fine-grained eigenvectors for processing, while maintaining the accuracy of the model, significantly reducing the computational complexity of the model.

[0161] In the case where the neural network model is a transformer model, processing the updated second feature vector may be implemented by the encoder based on a self-attention mechanism. Optionally, step S904 may include:

[0162] The encoder processes the updated second eigenvector using a deformable attention mechanism, and based on the processed second eigenvector, updates the part of the second eigenvector in the first eigenvector to obtain an updated first eigenvector.

[0163] For example, we can make q = T′ in the self-attention mechanism f , k = T a +PE f ,υ=T a, where q, k, and v can represent the query vector, key vector, and value vector in the self-attention mechanism, respectively. f It can represent the updated second eigenvector, PE f It can represent the position encoding of the second eigenvector, T a Thus, the multi-scale deformable attention (MSDeformAttn) mechanism can be used to process the second eigenvector and further extract the features of the second eigenvector, so that the index I of the second eigenvector can be used. f , update the part of the second eigenvector in the first eigenvector to obtain the updated first eigenvector T′ a .

[0164] The process of the above step S904 can be seen in Figure 5, which is implemented using the deformable attention in the illustrated encoder. The encoder can have multiple layers (as shown in the figure, there are N layers), and the output of each layer of encoder can include an updated first feature vector and an updated second feature vector. After passing through multiple layers of encoders, the final updated first feature vector and updated second feature vector can be input into a subsequent module (such as a decoder, which can also have multiple layers) for decoding, wherein the updated second feature vector can be used to initialize the query vector of the decoder.

[0165] In step S404, the neural network model determines the target detection result based on the updated first eigenvector.

[0166] The target detection result may include the location of the detection box corresponding to the target object and the category corresponding to the target object.

[0167] According to an embodiment of the present application, by determining the foreground score of the first eigenvector of the image, some eigenvectors are selected as second eigenvectors based on the foreground score, and the neural network model processes the second eigenvector. Based on the processed second eigenvector, the first eigenvector is updated to determine the target detection result, so that the model can focus on the eigenvectors that are more likely to correspond to the foreground and have important information, so as to balance the computational efficiency and accuracy of the model. While maintaining the accuracy of the model, the model is compressed to reduce the computational amount of the model, improve the operating efficiency of the model, and support deployment on the terminal, thereby expanding the application scope of the model.

[0168] When the neural network model is a transformer, the neural network model may include a decoder. Optionally, step S404 may include:

[0169] The decoder determines the target detection result based on the updated first feature vector.

[0170] For example, referring to Figure 5 , the decoder can process the updated first feature vector using a self-attention mechanism (e.g., self-supervision in the figure), a cross-attention mechanism (e.g., cross-attention in the figure), and a feed-forward neural network (e.g., FFN) to determine the target detection result. The above process can be implemented based on existing technologies. During this process, the updated second feature vector can be used to initialize the query vector query of the attention mechanism.

[0171] According to an embodiment of the present application, by further screening the second eigenvector in the encoder, the encoder can interact only with important eigenvectors, and taking into account the defects of the deformable attention mechanism in long-distance information interaction, it is possible to significantly reduce the amount of computation in the encoder of the transformer model, improve the computational efficiency of the model, and enable the decoder to output more accurate target detection results based on the updated first eigenvector, thereby maintaining the computational accuracy of the model.

[0172] Table 1 shows the effect of running the model according to an embodiment of the present application.

[0173] Table 1

[0174] Among them, FTS can represent the foreground token selector in this application, predictor can represent the method of calculating the foreground score, supervision can represent the method of generating binary labels during the training process, score modulations can represent the foreground score modulation, cascade can represent the top-down score modulation strategy of transferring semantics from high-level feature images to low-level feature images, and OESM can represent the target enhanced self-supervisory module in this application. AP can be an indicator representing the average precision, AP 50 It can be expressed as the average precision when the intersection over union (IoU) threshold is greater than 0.5, AP 75 It can represent the average accuracy when the IoU threshold is greater than 0.75, and FPS can represent the frames per second. As can be seen from the table, each module in the embodiment of the present application has achieved good results, while improving the model inference speed and maintaining the accuracy of the model.

[0175] FIG10 shows a structural diagram of an image processing device according to an embodiment of the present application. The device can be used in a terminal device or a cloud server. As shown in FIG10 , the device includes:

[0176] A feature extraction module 1001 is used to extract features from the acquired image and determine a first feature vector of the image;

[0177] a selection module 1002 configured to determine foreground scores of the plurality of first eigenvectors, and select some eigenvectors from the plurality of first eigenvectors as second eigenvectors based on the foreground scores, wherein the foreground scores represent a probability that the image portion indicated by the first eigenvector is the foreground;

[0178] An updating module 1003 is configured to input the first eigenvector and the second eigenvector into a neural network model, process the second eigenvector, and update the first eigenvector based on the processed second eigenvector to obtain an updated first eigenvector;

[0179] The determination module 1004 is used for the neural network model to determine the target detection result based on the updated first eigenvector.

[0180] According to an embodiment of the present application, by determining the foreground score of the first eigenvector of the image, some eigenvectors are selected as second eigenvectors based on the foreground score, and the neural network model processes the second eigenvector. Based on the processed second eigenvector, the first eigenvector is updated to determine the target detection result, so that the model can focus on the eigenvectors that are more likely to correspond to the foreground and have important information, so as to balance the computational efficiency and accuracy of the model. While maintaining the accuracy of the model, the model is compressed to reduce the computational amount of the model, improve the operating efficiency of the model, and support deployment on the terminal, thereby expanding the application scope of the model.

[0181] Optionally, the selection module 1002 is configured to:

[0182] Based on the semantic information of the plurality of first feature vectors, the first feature vectors are scored respectively by using a first multi-layer perceptron to determine foreground scores of the plurality of first feature vectors.

[0183] According to an embodiment of the present application, by determining the foreground score based on the semantic information of the first eigenvector, the calculated score can be made more accurate, so that more important eigenvectors can be selected therefrom, thereby improving the calculation accuracy of subsequent models.

[0184] Optionally, the first eigenvector is a eigenvector on a multi-layer eigenimage, and the selection module 1002 is configured to:

[0185] Determining a foreground score of the first eigenvector on the uppermost layer of the feature image using a first multilayer perceptron according to the first eigenvector, wherein the upper-layer feature images include more semantic information;

[0186] The first multilayer perceptron determines, for the first eigenvector on each layer of the feature image, a foreground score of the first eigenvector on the feature image of the previous layer based on the foreground score of the first eigenvector on the feature image of the previous layer.

[0187] According to an embodiment of the present application, it is possible to use the foreground score of the first feature vector on a high-level feature image to modulate the foreground score of the first feature image on a low-level feature image, so that the high-level semantic information can be better integrated into the adjacent low-level feature image, which can make the calculated foreground score of the first feature vector more accurate and improve the efficiency of subsequent calculations.

[0188] Optionally, the first multilayer perceptron determines, for the first eigenvector on each layer of the feature image, a foreground score of the first eigenvector on the feature image of the previous layer based on the foreground score of the first eigenvector on the feature image of the previous layer, including:

[0189] The first multilayer perceptron, for the first eigenvector on each layer of feature image, fuses the result of upsampling the foreground score of the first eigenvector on the feature image of the previous layer with the first eigenvector on the feature image of the current layer to determine the foreground score of the first eigenvector on the feature image of the current layer.

[0190] According to an embodiment of the present application, by fusing the result of upsampling the foreground score of the first eigenvector on the feature image of the previous layer with the first eigenvector on the feature image of this layer, the foreground score of the first eigenvector on the feature image of this layer is determined. In the process of calculating the foreground score, it is possible to better transfer the upper-layer semantic information to the feature image of the adjacent lower layer to obtain a more accurate foreground score calculation result, thereby better assisting subsequent target detection and enabling the model to output more accurate target detection results.

[0191] Optionally, the first multi-layer perceptron is a trained first multi-layer perceptron, and the apparatus further includes:

[0192] A generating module, configured to generate a binary label for each of the plurality of first eigenvectors based on the position of the detection frame of the true value and the position of the first eigenvector, wherein the image portion indicated by the detection frame of the true value is the foreground, and a binary label being a true value indicates that the image portion indicated by the corresponding first eigenvector is the foreground;

[0193] The training module is used to train the first multi-layer perceptron based on the binary label and the foreground score of the first eigenvector determined during the training process to obtain a trained first multi-layer perceptron.

[0194] According to an embodiment of the present application, by generating binary labels for multiple first eigenvectors based on the position of the detection box of the true value and the position of the first eigenvector, the binary labels can be used to indicate whether the image portion indicated by the corresponding first eigenvector is the foreground, thereby better adjusting the parameters of the first multi-layer perceptron during the training phase, so that the first multi-layer perceptron can calculate the foreground score more accurately, thereby improving the accuracy of the model.

[0195] Optionally, the interval size of the detection frame corresponding to each layer of feature images is different, and the interval of the detection frame corresponding to the feature image of the upper layer is larger.

[0196] According to an embodiment of the present application, by making the interval of the detection box corresponding to the feature image of the upper layer larger, it is possible to achieve overlap in the areas supported for detection by the feature images of each layer, thereby improving the prediction situation near the boundary, generating more accurate binary labels, achieving better training effects, and improving the accuracy of the model.

[0197] Optionally, the second eigenvector includes an updated second eigenvector, and the updating module 1003 is configured to:

[0198] Inputting the first eigenvector and the second eigenvector into the neural network model, scoring the second eigenvectors respectively using a second multilayer perceptron based on the second eigenvectors to determine category scores for the plurality of second eigenvectors, the category scores representing the probability that the image portion indicated by the second eigenvector belongs to a certain category;

[0199] Based on the foreground score and the category score, selecting some feature vectors from the plurality of second feature vectors as the third feature vector;

[0200] Processing the third eigenvector, and updating the second eigenvector based on the processed third eigenvector to obtain an updated second eigenvector;

[0201] The updated second eigenvector is processed, and the first eigenvector is updated based on the processed second eigenvector to obtain an updated first eigenvector.

[0202] According to an embodiment of the present application, by using a second multi-layer perceptron to score the second eigenvectors separately, determining the category scores of multiple second eigenvectors, and selecting the third eigenvector based on the foreground score and the category score, it is possible to comprehensively consider the position information and category semantic information, further screen the second eigenvectors, and obtain more fine-grained eigenvectors for processing, while maintaining the accuracy of the model, significantly reducing the computational complexity of the model.

[0203] Optionally, the neural network model includes an encoder and a decoder, processes the third eigenvector, and updates the second eigenvector based on the processed third eigenvector to obtain an updated second eigenvector, including:

[0204] The encoder processes the third eigenvector using a self-attention mechanism, and based on the processed third eigenvector, updates the portion of the third eigenvector in the second eigenvector to obtain an updated second eigenvector.

[0205] Processing the updated second eigenvector and updating the first eigenvector based on the processed second eigenvector to obtain an updated first eigenvector includes:

[0206] The encoder processes the updated second eigenvector using a deformable attention mechanism, and based on the processed second eigenvector, updates the part of the second eigenvector in the first eigenvector to obtain an updated first eigenvector.

[0207] The determination module 1004 is configured to:

[0208] The decoder determines the target detection result based on the updated first feature vector.

[0209] According to an embodiment of the present application, by further screening the second eigenvector in the encoder, the encoder can interact only with important eigenvectors, and taking into account the defects of the deformable attention mechanism in long-distance information interaction, it is possible to significantly reduce the amount of computation in the encoder of the transformer model, improve the computational efficiency of the model, and enable the decoder to output more accurate target detection results based on the updated first eigenvector, thereby maintaining the computational accuracy of the model.

[0210] Optionally, the categories do not include a background category.

[0211] According to the embodiments of the present application, the strategy can be made more reasonable, and the filtered feature vectors can be made more important feature vectors, thereby better assisting the model in target detection and improving the accuracy of the model.

[0212] An embodiment of the present application provides an image processing device, comprising: a processor and a memory for storing processor-executable instructions; wherein the processor is configured to implement the above-mentioned image processing method when executing the instructions.

[0213] An embodiment of the present application provides a terminal device that can execute the above-mentioned image processing method.

[0214] An embodiment of the present application provides a non-volatile computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the above-mentioned image processing method is implemented.

[0215] An embodiment of the present application provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above-mentioned image processing method.

[0216] Figure 11 shows a block diagram of an electronic device 1100 according to an embodiment of the present application. As shown in Figure 11, the electronic device 1100 can be the aforementioned terminal device or cloud server, configured to perform the functions of the image processing method shown in any of Figures 4-9 above. The electronic device 1100 includes at least one processor 1801, at least one memory 1802, and at least one communication interface 1803. Furthermore, the electronic device may also include common components such as an antenna, which will not be described in detail here.

[0217] The following is a detailed introduction to the various components of the electronic device 1100 with reference to FIG11 .

[0218] Processor 1801 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above program. Processor 1801 may include one or more processing units. For example, processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.

[0219] The communication interface 1803 is used to communicate with other electronic devices or communication networks, such as Ethernet, Radio Access Network (RAN), core network, Wireless Local Area Networks (WLAN), etc.

[0220] The memory 1802 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.

[0221] The memory 1802 is used to store application code for executing the above solution, and the execution is controlled by the processor 1801. The processor 1801 is used to execute the application code stored in the memory 1802.

[0222] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0223] A computer-readable storage medium may be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof.

[0224] The computer-readable program instructions or codes described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.

[0225] The computer program instructions for performing the operations of the present application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, by utilizing the state information of computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field-programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit can execute the computer-readable program instructions, thereby implementing various aspects of the present application.

[0226] Various aspects of the present application are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.

[0227] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0228] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0229] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, systems, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a part for a module, program segment or instruction, and the part for the module, program segment or instruction comprises one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous boxes can actually be performed substantially in parallel, and they can sometimes also be performed in the opposite order, depending on the function involved.

[0230] It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by hardware (such as a circuit or ASIC (Application Specific Integrated Circuit)) that performs the corresponding function or action, or can be implemented by a combination of hardware and software, such as firmware.

[0231] Although the present invention is described herein in conjunction with various embodiments, in the process of implementing the claimed invention, those skilled in the art can understand and implement other variations of the disclosed embodiments by reviewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple situations. A single processor or other unit can implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0232] The embodiments of the present application have been described above. The above description is illustrative and not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons skilled in the art to understand the embodiments disclosed herein.

Claims

1. An image processing method, characterized in that: The method comprises: Performing feature extraction on the acquired image to determine the first feature vector of the image; Determine foreground scores of the plurality of first feature vectors, and based on the foreground scores, select some feature vectors from the plurality of first feature vectors as second feature vectors, wherein the foreground scores represent the probability that the image portion indicated by the first feature vector is the foreground; Inputting the first feature vector and the second feature vector into a neural network model, processing the second feature vector, and updating the first feature vector based on the processed second feature vector to obtain an updated first feature vector; The neural network model determines the target detection result based on the updated first eigenvector.

2. The method according to claim 1, characterized in that The determining of prospect scores of the plurality of first feature vectors and selecting some feature vectors from the plurality of first feature vectors as second feature vectors based on the prospect scores comprises: Based on the semantic information of the plurality of first feature vectors, the first feature vectors are scored respectively by using a first multi-layer perceptron to determine the prospect scores of the plurality of first feature vectors.

3. The method according to claim 1 or 2, characterized in that: The first feature vector is a feature vector on a multi-layer feature image, and the determining of foreground scores of the plurality of first feature vectors and selecting some feature vectors from the plurality of first feature vectors as second feature vectors based on the foreground scores includes: Determine, according to the first feature vector, a foreground score of the first feature vector on the uppermost feature image using a first multilayer perceptron, wherein the feature images at the upper layers contain more semantic information; The first multi-layer perceptron determines, for the first eigenvector on each layer of the feature image, a foreground score of the first eigenvector on the feature image of the previous layer based on the foreground score of the first eigenvector on the feature image of the previous layer.

4. The method according to claim 3, characterized in that The first multi-layer perceptron determines, for each layer of the first feature vector on the feature image, a foreground score of the first feature vector on the feature image of the previous layer based on the foreground score of the first feature vector on the feature image of the previous layer, including: The first multi-layer perceptron, for the first eigenvector on each layer of feature images, fuses the result of upsampling the foreground score of the first eigenvector on the feature image of the previous layer with the first eigenvector on the feature image of this layer to determine the foreground score of the first eigenvector on the feature image of this layer.

5. The method according to any one of claims 1 to 4, characterized in that: The second feature vector includes an updated second feature vector, and the first feature vector and the second feature vector are input into a neural network model, the second feature vector is processed, and the first feature vector is updated based on the processed second feature vector to obtain an updated first feature vector, including: Inputting the first feature vector and the second feature vector into a neural network model, and scoring the second feature vectors respectively using a second multilayer perceptron according to the second feature vector to determine category scores of a plurality of second feature vectors, wherein the category score represents the probability that the image portion indicated by the second feature vector belongs to a certain category; Based on the foreground score and the category score, selecting some feature vectors from the plurality of second feature vectors as third feature vectors; Processing the third eigenvector, and updating the second eigenvector based on the processed third eigenvector to obtain an updated second eigenvector; The updated second feature vector is processed, and based on the processed second feature vector, the first feature vector is updated to obtain an updated first feature vector.

6. The method according to claim 5, characterized in that The neural network model includes an encoder and a decoder, and the processing of the third feature vector and updating the second feature vector based on the processed third feature vector to obtain an updated second feature vector include: The encoder processes the third feature vector using a self-attention mechanism, and based on the processed third feature vector, updates a portion of the third feature vector in the second feature vector to obtain an updated second feature vector; The step of processing the updated second feature vector and updating the first feature vector based on the processed second feature vector to obtain the updated first feature vector includes: The encoder processes the updated second feature vector using a deformable attention mechanism, and based on the processed second feature vector, updates a portion of the second feature vector in the first feature vector to obtain an updated first feature vector; The neural network model determines the target detection result based on the updated first feature vector, including: The decoder determines a target detection result based on the updated first feature vector.

7. The method according to claim 5 or 6, characterized in that: The categories do not include background categories.

8. The method according to any one of claims 2 to 7, characterized in that: The first multilayer perceptron is a trained first multilayer perceptron, and the method further includes: Based on the position of the detection frame of the true value and the position of the first eigenvector, generating binary labels for the multiple first eigenvectors respectively, the image portion indicated by the detection frame of the true value is the foreground, and the binary label is the true value indicating that the image portion indicated by the corresponding first eigenvector is the foreground; Based on the binary label and the foreground score of the first feature vector determined during the training process, the first multi-layer perceptron is trained to obtain a trained first multi-layer perceptron.

9. The method according to claim 8, characterized in that The interval size of the detection frame corresponding to each layer of feature images is different, and the interval of the detection frame corresponding to the feature image of the upper layer is larger.

10. An image processing device, characterized in that: The device comprises: A feature extraction module, used to extract features from the acquired image and determine a first feature vector of the image; A selection module, configured to determine foreground scores of the plurality of first feature vectors, and select part of the feature vectors from the plurality of first feature vectors as second feature vectors based on the foreground scores, wherein the foreground scores represent the probability that the image portion indicated by the first feature vector is the foreground; An updating module, configured to input the first feature vector and the second feature vector into a neural network model, process the second feature vector, and update the first feature vector based on the processed second feature vector to obtain an updated first feature vector; A determination module is used for the neural network model to determine the target detection result based on the updated first feature vector.

11. The device according to claim 10, characterized in that The selection module is used to: Based on the semantic information of the plurality of first feature vectors, the first feature vectors are scored respectively by using a first multi-layer perceptron to determine the prospect scores of the plurality of first feature vectors.

12. The device according to claim 10 or 11, characterized in that The first feature vector is a feature vector on a multi-layer feature image, and the selection module is used to: Determine, according to the first feature vector, a foreground score of the first feature vector on the uppermost feature image using a first multilayer perceptron, wherein the feature images at the upper layers contain more semantic information; The first multi-layer perceptron determines, for the first eigenvector on each layer of the feature image, a foreground score of the first eigenvector on the feature image of the previous layer based on the foreground score of the first eigenvector on the feature image of the previous layer.

13. The device according to claim 12, characterized in that The first multi-layer perceptron determines, for each layer of the first feature vector on the feature image, a foreground score of the first feature vector on the feature image of the previous layer based on the foreground score of the first feature vector on the feature image of the previous layer, including: The first multi-layer perceptron, for the first eigenvector on each layer of feature images, fuses the result of upsampling the foreground score of the first eigenvector on the feature image of the previous layer with the first eigenvector on the feature image of this layer to determine the foreground score of the first eigenvector on the feature image of this layer.

14. The device according to any one of claims 10 to 13, characterized in that: The second feature vector includes an updated second feature vector, and the updating module is used to: Inputting the first feature vector and the second feature vector into a neural network model, and scoring the second feature vectors respectively using a second multilayer perceptron according to the second feature vector to determine category scores of a plurality of second feature vectors, wherein the category score represents the probability that the image portion indicated by the second feature vector belongs to a certain category; Based on the foreground score and the category score, selecting some feature vectors from the plurality of second feature vectors as third feature vectors; Processing the third eigenvector, and updating the second eigenvector based on the processed third eigenvector to obtain an updated second eigenvector; The updated second feature vector is processed, and based on the processed second feature vector, the first feature vector is updated to obtain an updated first feature vector.

15. The device according to claim 14, characterized in that The neural network model includes an encoder and a decoder, and the processing of the third feature vector and updating the second feature vector based on the processed third feature vector to obtain an updated second feature vector include: The encoder processes the third feature vector using a self-attention mechanism, and based on the processed third feature vector, updates a portion of the third feature vector in the second feature vector to obtain an updated second feature vector; The step of processing the updated second feature vector and updating the first feature vector based on the processed second feature vector to obtain the updated first feature vector includes: The encoder processes the updated second feature vector using a deformable attention mechanism, and based on the processed second feature vector, updates a portion of the second feature vector in the first feature vector to obtain an updated first feature vector; The determining module is used to: The decoder determines a target detection result based on the updated first feature vector.

16. The device according to claim 14 or 15, characterized in that The categories do not include background categories.

17. The device according to any one of claims 11 to 16, characterized in that: The first multi-layer perceptron is a trained first multi-layer perceptron, and the device further includes: A generating module, configured to generate binary labels for the plurality of first feature vectors respectively based on the position of the detection frame of the true value and the position of the first feature vector, wherein the image portion indicated by the detection frame of the true value is the foreground, and the binary label being the true value indicates that the image portion indicated by the corresponding first feature vector is the foreground; The training module is used to train the first multi-layer perceptron based on the binary label and the foreground score of the first feature vector determined during the training process to obtain a trained first multi-layer perceptron.

18. The device according to claim 17, characterized in that The interval size of the detection frame corresponding to each layer of feature images is different, and the interval of the detection frame corresponding to the feature image of the upper layer is larger.

19. An image processing device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method according to any one of claims 1 to 9 when executing the instructions.

20. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.

21. A computer program product, comprising a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code, wherein when the computer-readable code is executed in an electronic device, a processor in the electronic device executes the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Picture feature extraction method and device, target re-identification method and device and electronic equipment

    CN111310518A

  • Feature model generation method and system, equipment and storage medium

    CN113361656A

  • Character interaction detection method, neural network and training method thereof, equipment and medium

    CN114005177A

  • Image classification method and device, electronic equipment and storage medium

    CN114120034A

  • Image processing method and device and storage medium

    CN116385771A

Cited By

  • Industrial scene-oriented defect detection method and related device

    CN119048492A