Task execution method, device, medium and equipment based on image recognition model

By adjusting the network layer matrix in the image recognition model, the problem of reduced recognition accuracy of high-level matrices in image recognition is solved, and the efficiency of the image recognition task is improved.

CN118397435BActive Publication Date: 2024-10-01ZHEJIANG LAB
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410839719.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-10-01
Estimated Expiration
2044-06-26

AI Technical Summary

Technical Problem

When existing image recognition models process high-level correlation matrices, the recognition accuracy decreases, affecting task execution efficiency, especially in tasks such as image segmentation, image clustering, and image feature matching.

Method used

By obtaining the initial image recognition model and sample images, calculate the category activation map, compensate according to the affinity matrix of the network layer, determine the correlation weight matrix and label of the pixel, and adjust the matrix of the network layer to improve recognition accuracy and efficiency. .

Benefits of technology

It enhances the image recognition model's ability to compensate for category activation maps, improves recognition accuracy and task execution efficiency, especially during high-level matrix compensation, to avoid a reduction in recognition accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118397435B_ABST
    Figure CN118397435B_ABST
Patent Text Reader

Abstract

This specification discloses a task execution method, device, medium and equipment based on an image recognition model. The terminal device inputs a sample image into an initial image recognition model to obtain a class activation map corresponding to the sample image and representing the region of interest. The class activation map is then compensated by the affinity matrix corresponding to each network layer contained in the initial image recognition model, and then the correlation weight matrix corresponding to each pixel in the sample image is determined, thereby determining the correlation label corresponding to each pixel pair in the sample image. According to the correlation label corresponding to each pixel pair, the affinity matrix corresponding to each network layer is adjusted, and the task is executed through the adjusted image recognition model. By enhancing the degree of compensation of the affinity matrix in the adjusted image recognition model for the class activation map, the adjusted image recognition model has a stronger recognition accuracy during the task execution process, and the execution efficiency of the image recognition task is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer vision, and in particular to methods, devices, media and equipment for executing tasks based on image recognition models. Background Art

[0002] With the continuous development of computer vision, image recognition models that can identify images are increasingly being applied to various tasks. For example, in autonomous driving tasks, image segmentation models can classify each pixel in the image of the front of the vehicle collected by the acquisition device during the autonomous driving process to obtain the area where the drivable road is located, thereby performing autonomous driving tasks.

[0003] However, for existing image recognition models, especially image recognition models involving image segmentation, image clustering, or image feature matching, when processing images, these models often need to obtain the degree of correlation between pixels in the image based on the correlation matrix contained in the model, also known as the affinity matrix, so as to improve the recognition accuracy of the image recognition model according to the affinity matrix. However, for some image recognition models that require a higher-level affinity matrix to improve recognition accuracy, the correlation matrix at a higher level will have the problem of increased similarity of processing results when processing image data, which affects the recognition accuracy of the image recognition model for the image and reduces the execution efficiency of tasks based on the image recognition model. Summary of the invention

[0004] This specification provides a task execution method, device, medium and equipment based on an image recognition model to partially solve the above-mentioned problems existing in the prior art.

[0005] This manual adopts the following technical solutions:

[0006] This specification provides a task execution method based on an image recognition model, including:

[0007] Obtain an initial image recognition model and sample images;

[0008] Inputting the sample image into the initial image recognition model to obtain a class activation map corresponding to the sample image, wherein the class activation map is used to characterize the region of interest of the initial image recognition model in the sample image;

[0009] Compensating the class activation map according to affinity matrices corresponding to each network layer included in the initial image recognition model to obtain a compensated matrix;

[0010] For each pixel in the sample image, determine a correlation weight matrix corresponding to the pixel according to the correlation between the pixel and the pixels around the pixel;

[0011] For each pixel pair in the sample image, determining a correlation label corresponding to the pixel pair according to the compensated matrix and the correlation weight matrices corresponding to the two pixels in the pixel pair;

[0012] According to the correlation labels corresponding to the pairs of pixels in the sample image, the values ​​contained in the affinity matrices corresponding to the network layers are adjusted to obtain an adjusted image recognition model;

[0013] The task is performed using the adjusted image recognition model.

[0014] Optionally, compensating the class activation map according to affinity matrices corresponding to each network layer included in the initial image recognition model to obtain a compensated matrix specifically includes:

[0015] Performing a reshaping operation on the class activation map to convert the class activation map into a one-dimensional sequence;

[0016] Transposing the affinity matrices corresponding to the network layers, and compensating the one-dimensional sequence by using the transposed affinity matrices to obtain a compensated sequence;

[0017] The compensated sequence is converted into a two-dimensional matrix to obtain the compensated matrix.

[0018] Optionally, for each pixel in the sample image, determining a correlation weight matrix corresponding to the pixel according to the correlation between the pixel and each pixel around the pixel, specifically includes:

[0019] For each pixel in the sample image, determine the correlation between the pixel and the pixels around the pixel according to the attribute information of the pixel and the attribute information of the pixels around the pixel, wherein for any pixel, the attribute information of the pixel includes: at least one of the spatial position of the pixel in the sample image and the pixel density corresponding to the pixel;

[0020] According to the correlation between the pixel point and the pixels around the pixel point, a correlation weight matrix corresponding to the pixel point is determined.

[0021] Optionally, for each pixel pair in the sample image, determining a correlation label corresponding to the pixel pair according to the compensated matrix and a correlation weight matrix corresponding to each of two pixels in the pixel pair, specifically includes:

[0022] For each pixel in the sample image, determine a predicted correlation label corresponding to the pixel according to a value corresponding to the pixel in the compensated matrix and a correlation weight matrix corresponding to the pixel;

[0023] Determine the semantic label corresponding to the pixel point according to the numerical relationship between the predicted correlation label corresponding to the pixel point and a preset threshold;

[0024] For each pixel pair in the sample image, a correlation label corresponding to the pixel pair is determined according to semantic labels corresponding to two pixels in the pixel pair.

[0025] Optionally, for each pixel in the sample image, determining a predicted correlation label corresponding to the pixel according to a value corresponding to the pixel in the compensated matrix and a correlation weight matrix corresponding to the pixel, specifically includes:

[0026] For each pixel in the sample image, determine a fusion matrix corresponding to the pixel according to a value corresponding to the pixel in the compensated matrix and a correlation weight matrix corresponding to the pixel;

[0027] The maximum value contained in the fusion matrix corresponding to the pixel point is used as the predicted correlation label corresponding to the pixel point.

[0028] Optionally, the preset threshold includes: a first threshold and a second threshold, wherein the first threshold is greater than 0 and less than the second threshold, and the second threshold is less than 1;

[0029] Determine the semantic label corresponding to the pixel point according to the numerical relationship between the predicted correlation label corresponding to the pixel point and the preset threshold, specifically including:

[0030] When the determined predicted correlation label corresponding to the pixel point is less than the first threshold, the first specified value is used as the semantic label corresponding to the pixel point;

[0031] When the determined predicted correlation label corresponding to the pixel point is greater than the second threshold, the correlation weight value corresponding to the pixel point is determined as the semantic label corresponding to the pixel point.

[0032] Optionally, for each pixel pair in the sample image, determining a correlation label corresponding to the pixel pair according to semantic labels corresponding to two pixels in the pixel pair, specifically includes:

[0033] For each pixel pair in the sample image, when the semantic labels corresponding to the two pixels in the pixel pair are the same and neither is the preset first designated semantic label, the second designated value is used as the correlation label corresponding to the pixel pair;

[0034] When the semantic labels corresponding to the two pixel points of the pixel point are different and neither of them is the first designated semantic label, the third designated value is determined as the correlation label corresponding to the pixel point.

[0035] Optionally, according to the correlation labels corresponding to the pixel pairs in the sample image, adjusting the values ​​contained in the affinity matrices corresponding to the network layers to obtain the adjusted image recognition model specifically includes:

[0036] For the affinity matrix corresponding to each network layer, determine the attention entropy value of the affinity matrix according to the correlation labels corresponding to each pixel pair in the sample image and the values ​​corresponding to each pixel pair included in the affinity matrix;

[0037] According to the attention entropy value of the affinity matrix corresponding to each network layer, determine the attention entropy sum value of the affinity matrix corresponding to each network layer;

[0038] Taking minimizing the attention entropy and value as the optimization goal, the values ​​contained in the affinity matrix corresponding to each network layer are adjusted to obtain an adjusted image recognition model.

[0039] This specification provides a task execution device based on an image recognition model, including:

[0040] Acquisition module: used to obtain the initial image recognition model and sample images;

[0041] Input module: used to input the sample image into the initial image recognition model to obtain a class activation map corresponding to the sample image, wherein the class activation map is used to characterize the region of interest of the initial image recognition model in the sample image;

[0042] Compensation module: used for compensating the class activation map according to the affinity matrix corresponding to each network layer contained in the initial image recognition model to obtain a compensated matrix;

[0043] A first determination module is used to determine, for each pixel in the sample image, a correlation weight matrix corresponding to the pixel according to the correlation between the pixel and the pixels around the pixel;

[0044] A second determination module is used to determine, for each pixel pair in the sample image, a correlation label corresponding to the pixel pair according to the compensated matrix and the correlation weight matrices corresponding to the two pixels in the pixel pair;

[0045] An adjustment module: used to adjust the values ​​contained in the affinity matrix corresponding to each network layer according to the correlation labels corresponding to each pixel pair in the sample image, so as to obtain an adjusted image recognition model;

[0046] Execution module: used to execute tasks through the adjusted image recognition model.

[0047] Optionally, the compensation module is specifically used to:

[0048] A reshaping operation is performed on the class activation map to convert the class activation map into a one-dimensional sequence; the affinity matrix corresponding to each network layer is transposed, and the one-dimensional sequence is compensated by the transposed affinity matrix to obtain a compensated sequence; and the compensated sequence is converted into a two-dimensional matrix to obtain the compensated matrix.

[0049] Optionally, the first determining module is specifically configured to:

[0050] For each pixel in the sample image, the correlation between the pixel and the pixels around it is determined based on the attribute information of the pixel and the attribute information of the pixels around it, wherein for any pixel, the attribute information of the pixel includes: the spatial position of the pixel in the sample image and at least one of the pixel density corresponding to the pixel; based on the correlation between the pixel and the pixels around it, the correlation weight matrix corresponding to the pixel is determined.

[0051] Optionally, the second determining module is specifically configured to:

[0052] For each pixel in the sample image, the predicted correlation label corresponding to the pixel is determined according to the value corresponding to the pixel in the compensated matrix and the correlation weight matrix corresponding to the pixel; the semantic label corresponding to the pixel is determined according to the numerical relationship between the predicted correlation label corresponding to the pixel and a preset threshold; for each pixel pair in the sample image, the correlation label corresponding to the pixel pair is determined according to the semantic labels corresponding to the two pixels in the pixel pair.

[0053] Optionally, the second determining module is specifically configured to:

[0054] For each pixel in the sample image, the fusion matrix corresponding to the pixel is determined according to the value corresponding to the pixel in the compensated matrix and the correlation weight matrix corresponding to the pixel; the maximum value contained in the fusion matrix corresponding to the pixel is used as the predicted correlation label corresponding to the pixel.

[0055] Optionally, the preset threshold includes: the preset threshold includes: a first threshold and a second threshold, wherein the first threshold is greater than 0 and less than the second threshold, and the second threshold is less than 1;

[0056] The second determination module is specifically configured to:

[0057] When the predicted correlation label corresponding to the pixel point is determined to be less than the first threshold, the first specified value is used as the semantic label corresponding to the pixel point; when the predicted correlation label corresponding to the pixel point is determined to be greater than the second threshold, the correlation weight value corresponding to the pixel point is determined as the semantic label corresponding to the pixel point.

[0058] Optionally, the second determining module is specifically configured to:

[0059] For each pixel pair in the sample image, when the semantic labels corresponding to the two pixels in the pixel pair are the same and are not the preset first specified semantic label, the second specified value is used as the correlation label corresponding to the pixel pair; when the semantic labels corresponding to the two pixels in the pixel pair are different and are not the first specified semantic label, the third specified value is determined as the correlation label corresponding to the pixel.

[0060] Optionally, the adjustment module is specifically configured to:

[0061] For the affinity matrix corresponding to each network layer, the attention entropy value of the affinity matrix is ​​determined according to the correlation labels corresponding to each pixel pair in the sample image and the numerical values ​​corresponding to each pixel pair contained in the affinity matrix; according to the attention entropy value of the affinity matrix corresponding to each network layer, the attention entropy sum value of the affinity matrix corresponding to each network layer is determined; with minimizing the attention entropy sum value as the optimization goal, the numerical values ​​contained in the affinity matrix corresponding to each network layer are adjusted to obtain an adjusted image recognition model.

[0062] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned task execution method based on the image recognition model is implemented.

[0063] This specification provides an electronic device, including a processor and a computer program stored in a memory and executable on the processor, wherein the processor implements the above-mentioned task execution method based on the image recognition model when executing the program.

[0064] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:

[0065] In the task execution method based on the image recognition model provided in the present specification, the terminal device first obtains the initial image recognition model and the sample image, and then inputs the sample image into the initial image recognition model to obtain the class activation map corresponding to the sample image, which is used to characterize the initial image recognition model for the area of ​​interest in the sample image, and then compensates the class activation map through the affinity matrix corresponding to each network layer contained in the initial image recognition model to obtain the compensated matrix, and then for each pixel in the sample image, according to the correlation between the pixel and the pixels around the pixel, the correlation weight matrix corresponding to the pixel is determined, and for each pixel pair in the sample image, according to the compensated matrix and the correlation weight matrix corresponding to the two pixels in the pixel pair, the correlation label corresponding to the pixel pair is determined, and according to the correlation label corresponding to each pixel pair, the values ​​in the affinity matrix are adjusted to obtain the adjusted image model, and the task is executed through the adjusted image recognition model.

[0066] It can be seen from the above method that after the terminal device inputs the sample image into the initial image recognition model, it can obtain the class activation map of the region of interest of the sample image corresponding to the corresponding model, and compensate the class activation map through the affinity matrix corresponding to each network layer in the model to obtain the compensated matrix, and then determine the correlation weight matrix corresponding to each pixel in the sample image, and then determine the correlation label corresponding to each pixel pair in the sample image, according to the correlation label corresponding to each pixel pair in the sample image, adjust the affinity matrix corresponding to each network layer contained in the initial image recognition model, and perform the task through the adjusted image recognition model. By determining the correlation weight value corresponding to each pixel and the correlation label corresponding to each pixel pair, the initial image recognition model is adjusted, and the compensation ability of the affinity matrix corresponding to each network layer contained in the initial image recognition model for the class activation map is enhanced, so that the adjusted image recognition model has stronger recognition accuracy in the process of executing the task, and improves the execution efficiency of the image recognition task. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:

[0068] Figure 1 A flowchart of a task execution method based on an image recognition model provided in this specification;

[0069] Figure 2 A schematic diagram of correlation labels corresponding to each pair of pixels in an image provided in this specification;

[0070] Figure 3 A schematic diagram of the structure of a task execution device based on an image recognition model provided in this specification;

[0071] Figure 4 A method provided in this specification corresponding to Figure 1 Schematic diagram of the structure of an electronic device. DETAILED DESCRIPTION

[0072] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.

[0073] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0074] Figure 1 A flowchart of a model training method provided in this specification includes:

[0075] S101: Obtain an initial image recognition model and sample images.

[0076] S102: Input the sample image into the initial image recognition model to obtain a category activation map corresponding to the sample image.

[0077] The execution subject of the task execution method based on the image recognition model provided in this specification can be a terminal device such as a laptop computer, a desktop computer, or a client installed in the terminal device, or a server. For the sake of ease of description, the following only takes the execution subject as an example to illustrate the task execution method based on the image recognition model provided in this specification.

[0078] In the existing computer vision field, the demand for image processing technology is increasing. As deep neural network technology matures, image recognition models are increasingly being used in various image recognition tasks. The existing image recognition model usually generates analogy activation maps (CAMs) as the initial pseudo-label to roughly locate the objects in the image, and then compensates the class activation map through the affinity matrix to more accurately locate the objects in the image. The affinity matrix is ​​used to characterize the degree of correlation between each pixel in the image, that is, the value corresponding to the degree of correlation between each pair of pixels in the image.

[0079] However, when the affinity matrix compensates the class activation map generated by the image recognition model, if the number of layers of the class activation map is too high, the compensation of the affinity matrix to the higher-level class activation map will be very similar, or even chaotic. That is, after the affinity matrix compensates the class activation map, the areas with improved accuracy in the compensated class activation map tend to be the same, which greatly reduces the compensation effect of the affinity matrix. Even in higher-level compensation, the affinity matrix not only cannot effectively compensate, but also weakens the positioning accuracy of the class activation map. It can be seen that when the compensation efficiency of the corresponding higher-level affinity matrix for the class activation map is low, the compensated class activation map obviously cannot meet the task requirements of the image recognition task.

[0080] Based on this, in order to avoid the situation where the higher-level affinity matrix has low compensation efficiency for the category activation map, the present application adjusts the affinity matrix corresponding to each network layer contained in the image recognition model so that the adjusted affinity matrix improves the compensation ability for the category activation map, thereby improving the adjusted image recognition model with higher recognition accuracy, thereby improving the execution efficiency of the image recognition task.

[0081] The terminal device needs to first obtain a sample image and an initial image recognition model, wherein the sample image can be any recognizable image, for example, a grassland image contains a sheepdog, and another example is a wall image contains a painting. In short, the sample image must contain recognizable objects, and the sample image must be avoided from being a completely chaotic image. The initial image recognition model must include a higher-level network layer as much as possible, so as to achieve effective optimization adjustment of the affinity matrix corresponding to the network layer through the method described in this specification. Of course, this method does not limit the network layer level corresponding to the initial image recognition model. For an initial image recognition model with only a lower-level network layer, the adjustment method used in this application can also improve the recognition accuracy of the image recognition model.

[0082] After acquiring the sample image, the terminal device can input the sample image into the initial image recognition model to obtain the class activation map corresponding to the sample image, wherein the class activation map is used to characterize the region of interest of the initial image recognition model in the sample image. The terminal device can then determine the data required to adjust the affinity matrix through the obtained class activation map corresponding to the sample image and the affinity matrix corresponding to each network layer contained in the initial image recognition model, and then adjust the affinity matrix corresponding to each network layer contained in the initial image recognition model according to the required adjustment data, so as to perform the image recognition task more efficiently through the adjusted image recognition model.

[0083] S103: Compensating the class activation map according to affinity matrices corresponding to each network layer included in the initial image recognition model to obtain a compensated matrix.

[0084] After obtaining the class activation map corresponding to the sample image, the terminal device can compensate the class activation map through the affinity matrix corresponding to each network layer contained in the initial image recognition model to obtain the compensated matrix. Specifically, CAM is defined as , corresponding types in CAM , which symbolizes the recognition result of the initial image recognition model for the corresponding category of each pixel in the sample image, such as the grassland category in the shepherding image. Represents a matrix, H is the height of the matrix, W is the width of the matrix, and the first The affinity matrix corresponding to the network layer is You need to first change the type The corresponding CAM dimension is reshaped to stretch it into a one-dimensional sequence , and then the first Affinity matrix corresponding to each network layer After transposition, the affinity matrix is ​​a two-dimensional matrix. The one-dimensional sequence is compensated by the transposed affinity matrix, and then the compensated matrix is ​​reshaped inversely to obtain the calculation process of the compensated matrix as follows:

[0085]

[0086] in, That is, the compensated matrix. Usually, after the compensation of the affinity matrix, the compensated matrix can more accurately reflect the probability distribution of each category. Of course, you can also becomes the probability distribution matrix, Represents the reshaping operation of converting a two-dimensional matrix into a one-dimensional sequence, that is, stretching. As parameters, It means The inverse operation is to convert the compensated sequence into a two-dimensional matrix, where T is the transpose operation symbol.

[0087] S104: For each pixel in the sample image, determine a correlation weight matrix corresponding to the pixel according to the correlation between the pixel and the pixels around the pixel.

[0088] After determining the compensated matrix, the terminal device also needs to determine a correlation weight matrix reflecting the correlation between each pixel in the sample image and each pixel around the pixel, that is, a correlation weight matrix corresponding to each pixel. Specifically, for each pixel in the sample image, the correlation between the pixel and each pixel around the pixel can be determined based on the attribute information of the pixel and the attribute information of each pixel around the pixel, wherein, for any pixel, the attribute information of the pixel includes: at least one of the spatial position of the pixel in the sample image and the pixel density corresponding to the pixel. Then, based on the correlation between the pixel and each pixel around the pixel, the correlation weight matrix corresponding to the pixel is determined. Below, the attribute information of the pixel includes the spatial position of the pixel in the sample image and the pixel density corresponding to the pixel, combined with the formula, to explain the calculation process of the correlation between a pixel and each pixel around the pixel and the correlation weight matrix corresponding to the pixel.

[0089] When the terminal device determines the correlation between any pixel in the sample image and the pixel points around it through the attribute information of the pixel in the sample image and the attribute information of the pixel points around it, it is necessary to calculate the pixel density adjustment value corresponding to the pixel based on the pixel density corresponding to the pixel in the sample image and the pixel density corresponding to the pixel points around it. , and calculate the spatial position adjustment value corresponding to the pixel point based on the spatial position of the pixel point in the sample image and the spatial positions of the pixels around the pixel point .

[0090]

[0091]

[0092] Among them, for the pixel point with coordinates (i, j) in the sample image, Indicates the pixel density at the pixel location. Spatial position, for each pixel point (x, y) around the pixel point with coordinates (i, j), each pixel point around the pixel point is represented by this (x, y) and then calculated separately. is the pixel density parameter, is the standard deviation parameter of the spatial position. A constant is added to control the color similarity between the pixel and the surrounding pixels. And control the spatial proximity between the pixel and the surrounding pixels , so that the calculated results are more in line with expectations. Of course, even if we do not add the constant that controls the color similarity between the pixel and the surrounding pixels And control the spatial proximity between the pixel and the surrounding pixels , the image recognition model can also be adjusted using the method described in this application.

[0093] Then, the pixel density corresponding to the pixel point is adjusted. And the spatial position adjustment value , determine the correlation between the pixel and the pixels around it :

[0094] in, and is the weight factor for adjusting the importance. In addition, it should be noted that for In this part of the formula, (x, y) is actually below the summation symbol, but it seems that due to a version issue, the display is incorrect. I would like to explain it here.

[0095] According to the correlation between the pixel and the pixels around it, the correlation weight matrix corresponding to the pixel is determined. , which is used to uniformly represent the correlation between the pixel and the surrounding pixels. As for the definition of the surrounding pixels, this application uses a 3*3 distribution as a set of a pixel and the surrounding pixels. Of course, there is no specific limitation, for example, 5*5, 7*7, or other distributions are all acceptable.

[0096] S105: For each pixel pair in the sample image, determine a correlation label corresponding to the pixel pair according to the compensated matrix and the correlation weight matrix corresponding to each of the two pixels in the pixel pair.

[0097] After the terminal device determines the correlation weight matrix corresponding to each pixel in the sample image, if it wants to determine the correlation label corresponding to each pixel pair in the sample image according to the correlation weight matrix corresponding to each pixel, it is also necessary to determine the fusion matrices corresponding to each pixel according to the correlation weight matrix corresponding to each pixel and the corresponding value of each pixel in the compensated matrix, and then for each pixel in the sample image, the maximum value contained in the fusion matrix corresponding to the pixel is used as the predicted correlation label corresponding to the pixel, and then the semantic label corresponding to the pixel is determined according to the numerical relationship between the predicted correlation label corresponding to the pixel and the preset threshold, and for each pixel pair in the sample image, the correlation label corresponding to the pixel pair is determined according to the semantic labels corresponding to the two pixels in the pixel pair.

[0098] Before determining the intermediate matrix, the terminal device needs to first determine the affinity matrix weight corresponding to the pixel point through the corresponding value of the pixel point in the compensated matrix. .

[0099]

[0100] is the value corresponding to the pixel point with coordinates (i, j) in the sample image in the compensated matrix.

[0101] Then, the weight superposition matrix is ​​determined by the affinity matrix weights corresponding to each pixel in the l-layer affinity matrix and the category activation map. .

[0102]

[0103] After the terminal device determines the weight superposition matrix, for each pixel in the sample image, the corresponding fusion matrix of the pixel can be determined according to the correlation weight matrix corresponding to the pixel and the corresponding value of the pixel in the weight superposition matrix. , the maximum value contained in the fusion matrix corresponding to the pixel As the predicted correlation label corresponding to the pixel:

[0104]

[0105] in Used to represent each pixel around pixel (i, j).

[0106] After determining the predicted correlation label corresponding to the pixel point, the semantic label corresponding to the pixel point can be determined according to the numerical relationship between the predicted correlation label corresponding to the pixel point and the preset threshold. Specifically, the preset threshold includes: a first threshold and a second threshold, wherein the first threshold Greater than 0 and less than the second threshold, the second threshold Less than 1.

[0107] Right now, .

[0108] Specifically, when the predicted correlation label corresponding to the pixel is less than the first threshold, the first specified value is used as the semantic label corresponding to the pixel; when the predicted correlation label corresponding to the pixel is greater than the second threshold, the correlation weight value corresponding to the pixel is determined as the semantic label corresponding to the pixel. The first specified value can be set to 0. If the predicted correlation label corresponding to the pixel is greater than the first threshold and less than the second threshold, the pixel is treated as an uncertain pixel and will not be used in subsequent calculations. Of course, the semantic label corresponding to the pixel can also be set to any specified value, for example, 255.

[0109] After the terminal device determines the semantic label corresponding to each pixel in the sample image, for each pixel pair in the sample image, the terminal device can determine the correlation label corresponding to the pixel pair according to the semantic labels corresponding to the two pixels in the pixel pair. Specifically, for each pixel pair in the sample image, when the semantic labels corresponding to the two pixels in the pixel pair are the same and neither is the preset first designated semantic label, the second designated value is used as the correlation label corresponding to the pixel; when the semantic labels corresponding to the two pixels in the pixel pair are different and neither is the first designated semantic label, the third designated value is determined as the correlation label corresponding to the pixel. Among them, the preset first designated semantic label is the label as the semantic label corresponding to the uncertain pixel described in the previous paragraph. Continuing with the above example, when the semantic labels corresponding to the two pixels are not the first designated semantic label, that is, neither is 255, if the semantic labels corresponding to the two pixels are the same, the second designated value, such as 1, is used as the correlation label corresponding to the pixel pair; if the semantic labels corresponding to the two pixels are different, the third designated value, such as 0, is used as the correlation label corresponding to the pixel pair. Of course, if the semantic label corresponding to any pixel in a pixel pair is 255, the pixel pair does not involve calculation. For the convenience of expression, the pixel pair can also be assigned a value. Taking 255 as an example, it can also be used as the correlation label corresponding to the pixel pair for easy recording.

[0110] Below, we will explain the relevance label with views and simple examples:

[0111] Figure 2A schematic diagram of correlation labels corresponding to each pixel pair in an image provided in this specification, comprising four pixels: the coordinates are (1, 1), (1, 2), (2, 1), (2, 2), wherein the semantic labels of the two pixels at the positions (1, 1) and (1, 2) are both 0, and the semantic labels of the two pixels at the positions (2, 1) and (2, 2) are both the maximum values ​​contained in the fusion matrix corresponding to the pixel. , and the values ​​corresponding to the semantic labels of the two pixels are also the same, then in the figure, for any pixel, such as (1,1), the value in the area where the pixel intersects with other pixels, such as (1,2) in the horizontal or vertical row is the correlation label corresponding to the pixel pair composed of these two pixels, that is, 1. However, the semantic labels of the pixels corresponding to the two positions (1,1) and (2,1) are different, so the correlation label corresponding to this pixel pair is 0.

[0112] S106: According to the correlation labels corresponding to the pixel pairs in the sample image, the values ​​included in the affinity matrices corresponding to the network layers are adjusted to obtain an adjusted image recognition model.

[0113] After the terminal device determines the correlation label corresponding to each pixel pair in the sample image, the attention entropy value of the affinity matrix of each network layer in the initial image recognition model can be determined according to the correlation label corresponding to each pixel pair in the sample image and the value corresponding to each pixel pair contained in the affinity matrix. Specifically, the calculation formula is as follows:

[0114]

[0115] in and Respectively represent the number of positive values ​​and negative values ​​in the affinity matrix. (ij, kl) is any pixel pair in the sample image, representing the pixel pair (i, j) and (k, l). is the correlation label corresponding to the pixel pair, is the value corresponding to the pixel pair in the affinity matrix of the lth network layer, The correlation label corresponding to the pixel pair is 1, which is the second specified value. It represents that the correlation label corresponding to the pixel pair is 0, that is, the third designated value. The specific data is used here only for the convenience of explanation in the above example. Other values ​​can be selected as the designated values.

[0116] Then, the terminal device calculates the attention entropy value of the affinity matrix corresponding to each network layer and the intermediate parameters , determine the attention entropy and value of the affinity matrix corresponding to each network layer :

[0117]

[0118] The terminal device adjusts the values ​​contained in the affinity matrix corresponding to each network layer with minimizing the attention entropy and value as the optimization goal to obtain an adjusted image recognition model.

[0119] The affinity matrix adjusted by the adjustment method described in this specification can more accurately compensate the category activation map, especially the higher-level category activation map. Under the premise of combining the affinity matrices of different levels for combined calculation, the higher-level category activation map can be greatly improved after being compensated by the adjusted affinity matrix. It should be noted that the attention entropy and value required for the final adjustment can also be replaced by the average value, maximum value, or other calculated values.

[0120] S106: Execute the task through the adjusted image recognition model.

[0121] After the terminal device adjusts the initial image recognition model, it can perform tasks through the adjusted image recognition model. For example, for the image classification model training task, if you want to train a model that can distinguish whether the animal contained in the image is a cat or a dog, you can use the adjusted image recognition model to annotate the training sample set, and then train the image classification model through the training sample set annotated with a higher level of accuracy to train a model with better results. Of course, it is entirely possible to directly perform image recognition tasks through the adjusted image recognition model. After the image is input into the image recognition model, the image recognition model can locate the object contained in the image and output the image containing the positioning result for subsequent execution of other tasks. In short, after adjusting the affinity matrix corresponding to each network layer in the image recognition model through this manual, whether it is directly executing the task through the adjusted image recognition model or indirectly executing the task, the execution efficiency of the task can be improved with the help of the function of the image recognition model that improves the recognition accuracy.

[0122] It can be seen from the above method that through the above-mentioned task execution training method of the image recognition model, the recognition result of the sample image by the initial image recognition model can be compensated with the corresponding affinity matrix, and the attention entropy value of each affinity matrix corresponding to each network layer in the image recognition model can be determined, thereby determining the attention entropy sum value of the affinity matrix corresponding to each network layer in the image recognition model, that is, the affinity matrices corresponding to each network layer in the initial image recognition model can be adjusted by minimizing the attention entropy sum value to improve the compensation ability of each affinity matrix to the category activation map. This makes it more efficient to directly or indirectly perform the target task according to the adjusted image recognition model.

[0123] Figure 3 A schematic diagram of a task execution device based on an image recognition model provided in an embodiment of this specification, the device comprising:

[0124] Acquisition module 301: used to acquire an initial image recognition model and a sample image;

[0125] Input module 302: used to input the sample image into the initial image recognition model to obtain a class activation map corresponding to the sample image, wherein the class activation map is used to characterize the region of interest of the initial image recognition model in the sample image;

[0126] Compensation module 303: used to compensate the class activation map according to the affinity matrix corresponding to each network layer included in the initial image recognition model to obtain a compensated matrix;

[0127] The first determination module 304 is used to determine, for each pixel in the sample image, a correlation weight matrix corresponding to the pixel according to the correlation between the pixel and the pixels around the pixel;

[0128] The second determination module 305 is used to determine, for each pixel pair in the sample image, a correlation label corresponding to the pixel pair according to the compensated matrix and the correlation weight matrices corresponding to the two pixels in the pixel pair;

[0129] Adjustment module 306: used to adjust the values ​​contained in the affinity matrix corresponding to each network layer according to the correlation label corresponding to each pixel pair in the sample image, so as to obtain an adjusted image recognition model;

[0130] Execution module 307: used to execute the task through the adjusted image recognition model.

[0131] Optionally, the compensation module 303 is specifically configured to:

[0132] The class activation map is reshaped to convert the class activation map into a one-dimensional sequence; the affinity matrix corresponding to each network layer is transposed, and the one-dimensional sequence is compensated by the transposed affinity matrix to obtain a compensated sequence; the compensated sequence is converted into a two-dimensional matrix to obtain the compensated matrix.

[0133] Optionally, the first determination module 304 is specifically used to determine, for each pixel point in the sample image, the correlation between the pixel point and the pixel points surrounding the pixel point based on the attribute information of the pixel point and the attribute information of the pixel points surrounding the pixel point, wherein, for any pixel point, the attribute information of the pixel point includes: the spatial position of the pixel point in the sample image and at least one of the pixel density corresponding to the pixel point; and determine the correlation weight matrix corresponding to the pixel point based on the correlation between the pixel point and the pixel points surrounding the pixel point.

[0134] Optionally, the second determining module 305 is specifically configured to:

[0135] For each pixel in the sample image, the predicted correlation label corresponding to the pixel is determined according to the value corresponding to the pixel in the compensated matrix and the correlation weight matrix corresponding to the pixel; the semantic label corresponding to the pixel is determined according to the numerical relationship between the predicted correlation label corresponding to the pixel and a preset threshold; for each pixel pair in the sample image, the correlation label corresponding to the pixel pair is determined according to the semantic labels corresponding to the two pixels in the pixel pair.

[0136] Optionally, the second determining module 305 is specifically configured to:

[0137] For each pixel in the sample image, the fusion matrix corresponding to the pixel is determined according to the value corresponding to the pixel in the compensated matrix and the correlation weight matrix corresponding to the pixel; the maximum value contained in the fusion matrix corresponding to the pixel is used as the predicted correlation label corresponding to the pixel.

[0138] Optionally, the preset threshold includes: a first threshold and a second threshold, wherein the first threshold is greater than 0 and less than the second threshold, and the second threshold is less than 1;

[0139] The second determining module 305 is specifically configured to:

[0140] When the predicted correlation label corresponding to the pixel point is determined to be less than the first threshold, the first specified value is used as the semantic label corresponding to the pixel point; when the predicted correlation label corresponding to the pixel point is determined to be greater than the second threshold, the correlation weight value corresponding to the pixel point is determined as the semantic label corresponding to the pixel point.

[0141] Optionally, the second determining module 305 is specifically configured to:

[0142] For each pixel pair in the sample image, when the semantic labels corresponding to the two pixels in the pixel pair are the same and are not the preset first specified semantic label, the second specified value is used as the correlation label corresponding to the pixel pair; when the semantic labels corresponding to the two pixels in the pixel pair are different and are not the first specified semantic label, the third specified value is determined as the correlation label corresponding to the pixel.

[0143] Optionally, the adjustment module 306 is specifically configured to:

[0144] For the affinity matrix corresponding to each network layer, the attention entropy value of the affinity matrix is ​​determined according to the correlation labels corresponding to each pixel pair in the sample image and the numerical values ​​corresponding to each pixel pair contained in the affinity matrix; according to the attention entropy value of the affinity matrix corresponding to each network layer, the attention entropy sum value of the affinity matrix corresponding to each network layer is determined; with minimizing the attention entropy sum value as the optimization goal, the numerical values ​​contained in the affinity matrix corresponding to each network layer are adjusted to obtain an adjusted image recognition model.

[0145] This specification also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, it can be used to perform the above Figure 1 A task method based on image recognition model is provided.

[0146] based on Figure 1 A task execution method based on an image recognition model is shown, and the embodiment of this specification also provides Figure 4 The structural diagram of the electronic device shown in FIG. Figure 4 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 A task execution method based on an image recognition model.

[0147] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0148] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with hardware entity modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0149] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.

[0150] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0151] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0152] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0153] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0154] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0155] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0156] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0157] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0158] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0159] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0160] It should be understood by those skilled in the art that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0161] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0162] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0163] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.

Claims

1. A task execution method based on an image recognition model, It is characterized in that include: Obtain an initial image recognition model and sample images; Inputting the sample image into the initial image recognition model to obtain a class activation map corresponding to the sample image, wherein the class activation map is used to characterize the region of interest of the initial image recognition model in the sample image; Compensating the class activation map according to affinity matrices corresponding to each network layer included in the initial image recognition model to obtain a compensated matrix; For each pixel in the sample image, determine a correlation weight matrix corresponding to the pixel according to the correlation between the pixel and the pixels around the pixel; Determine the predicted correlation label corresponding to the pixel point according to the value corresponding to the pixel point in the compensated matrix and the correlation weight matrix corresponding to the pixel point, and determine the semantic label corresponding to the pixel point according to the numerical relationship between the predicted correlation label corresponding to the pixel point and a preset threshold value; For each pixel pair in the sample image, determine a correlation label corresponding to the pixel pair according to the semantic labels corresponding to the two pixels in the pixel pair; According to the correlation labels corresponding to the pairs of pixels in the sample image, the values ​​contained in the affinity matrices corresponding to the network layers are adjusted to obtain an adjusted image recognition model; The task is performed using the adjusted image recognition model.

2. The method according to claim 1, It is characterized in that Compensating the class activation map according to the affinity matrix corresponding to each network layer included in the initial image recognition model to obtain a compensated matrix specifically includes: Performing a reshaping operation on the class activation map to convert the class activation map into a one-dimensional sequence; Transposing the affinity matrices corresponding to the network layers, and compensating the one-dimensional sequence by using the transposed affinity matrices to obtain a compensated sequence; The compensated sequence is converted into a two-dimensional matrix to obtain the compensated matrix.

3. The method according to claim 1, It is characterized in that For each pixel in the sample image, a correlation weight matrix corresponding to the pixel is determined according to the correlation between the pixel and the pixels around the pixel, specifically including: For each pixel in the sample image, determine the correlation between the pixel and the pixels around the pixel according to the attribute information of the pixel and the attribute information of the pixels around the pixel, wherein for any pixel, the attribute information of the pixel includes: at least one of the spatial position of the pixel in the sample image and the pixel density corresponding to the pixel; According to the correlation between the pixel point and the pixels around the pixel point, a correlation weight matrix corresponding to the pixel point is determined.

4. The method according to claim 1, It is characterized in that For each pixel in the sample image, according to the value corresponding to the pixel in the compensated matrix and the correlation weight matrix corresponding to the pixel, a predicted correlation label corresponding to the pixel is determined, specifically including: For each pixel in the sample image, determine a fusion matrix corresponding to the pixel according to a value corresponding to the pixel in the compensated matrix and a correlation weight matrix corresponding to the pixel; The maximum value contained in the fusion matrix corresponding to the pixel point is used as the predicted correlation label corresponding to the pixel point.

5. The method according to claim 1, It is characterized in that The preset threshold includes: a first threshold and a second threshold, wherein the first threshold is greater than 0 and less than the second threshold, and the second threshold is less than 1; Determine the semantic label corresponding to the pixel point according to the numerical relationship between the predicted correlation label corresponding to the pixel point and the preset threshold, specifically including: When the determined predicted correlation label corresponding to the pixel point is less than the first threshold, the first specified value is used as the semantic label corresponding to the pixel point; When the determined predicted correlation label corresponding to the pixel point is greater than the second threshold, the correlation weight value corresponding to the pixel point is determined as the semantic label corresponding to the pixel point.

6. The method according to claim 1, It is characterized in that For each pixel pair in the sample image, determining a correlation label corresponding to the pixel pair according to the semantic labels corresponding to the two pixels in the pixel pair, specifically includes: For each pixel pair in the sample image, when the semantic labels corresponding to the two pixels in the pixel pair are the same and neither is the preset first designated semantic label, the second designated value is used as the correlation label corresponding to the pixel pair; When the semantic labels corresponding to the two pixel points of the pixel point are different and neither of them is the first designated semantic label, the third designated value is determined as the correlation label corresponding to the pixel point.

7. The method according to claim 1, It is characterized in that According to the correlation labels corresponding to the pixel pairs in the sample image, the values ​​contained in the affinity matrices corresponding to the network layers are adjusted to obtain an adjusted image recognition model, specifically including: For the affinity matrix corresponding to each network layer, determine the attention entropy value of the affinity matrix according to the correlation labels corresponding to each pixel pair in the sample image and the values ​​corresponding to each pixel pair included in the affinity matrix; According to the attention entropy value of the affinity matrix corresponding to each network layer, determine the attention entropy sum value of the affinity matrix corresponding to each network layer; Taking minimizing the attention entropy and value as the optimization goal, the values ​​contained in the affinity matrix corresponding to each network layer are adjusted to obtain an adjusted image recognition model.

8. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 7 is implemented.

9. An electronic device comprising a processor and a computer program stored in a memory and operable on the processor, It is characterized in that When the processor executes the program, the method described in any one of claims 1 to 7 is implemented.