An image detection method and its application for interpretable analysis target detection models
By performing superpixel segmentation and Shapley value algorithm processing on the image, an importance heatmap and binary mask matrix are generated. Adversarial example training is then conducted, which solves the problems of wasted computing resources and prolonged recognition in existing technologies. This enables rapid identification and localization of key regions in the image, improving the robustness and efficiency of the model.
Patent Information
- Application Number
- CN202511439843.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-10
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2045-10-10
AI Technical Summary
Existing image detection methods analyze and calculate all pixels in an image, which leads to a waste of computing resources and a prolonged computing process, affecting the robustness and generalization of rapid image recognition and localization.
By inputting the image to be detected into the trained target detection model, an importance heatmap is generated using superpixel segmentation, dimensionality reduction, and Shapley value algorithms. Combined with the perturbation boundary matrix and the fusion sensitivity matrix, binarization segmentation and mask constraint adversarial training are performed to construct adversarial sample data and update the initial detection model.
It enables rapid identification and localization of key regions in images, improves computational efficiency and model robustness, and ensures the logic and reliability of detection results.
Smart Images

Figure CN120894545B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, and in particular to an image detection method and its application for interpretable analysis target detection models. Background Technology
[0002] In the field of computer vision, acquired image data needs to be processed to extract key regions for subsequent analysis and recognition. This is particularly important for moving object recognition in security monitoring and defective product recognition in industrial quality inspection.
[0003] In existing technologies, image detection methods analyze and calculate all pixels in an image. On the one hand, this leads to a large amount of computer resources being consumed on parts of the image that have little impact on key areas. On the other hand, processing all pixels prolongs the computer vision process, resulting in an explosive increase in computing resources and a vicious imbalance between robustness and generalization, which is not conducive to subsequent rapid image recognition and localization. Summary of the Invention
[0004] This invention provides an image detection method and application for interpretable analysis target detection models, which solves the technical problem in the prior art that image detection methods analyze and calculate all pixels in the image. The method trains the target detection model to identify key regions, thereby achieving rapid recognition and localization of the image to be detected.
[0005] To address the aforementioned technical problems, embodiments of the present invention provide an image detection method for an interpretable analysis target detection model, the method comprising:
[0006] The image to be detected is input into a trained object detection model for processing to obtain the detection result. The training process of the object detection model includes:
[0007] The acquired sample images are input into the initial detection model for forward propagation processing. Based on the obtained image classification score decision information, the perturbation boundary matrix of the sample images is determined.
[0008] The sample image is sequentially subjected to superpixel segmentation and dimensionality reduction processing to obtain superpixel feature vectors;
[0009] The superpixel feature vector is processed based on the Shapley value algorithm to obtain the importance heatmap of the sample image;
[0010] Based on the perturbation boundary matrix and the importance heatmap, the fusion sensitivity matrix of the sample image is obtained, and the fusion sensitivity matrix is subjected to binarization segmentation processing to obtain a binary mask matrix corresponding to the target region in the sample image.
[0011] The binary mask matrix and the sample image are subjected to mask constraint adversarial training to obtain adversarial sample data, wherein the adversarial sample data is constructed from the information of the target region in the sample image;
[0012] The initial detection model is updated based on the training results of the adversarial sample data to obtain the target detection model.
[0013] As one preferred embodiment, the perturbation boundary matrix of the sample image is determined based on the obtained image classification score decision information, including:
[0014] The true class score and the maximum competing class score are determined based on the image classification score decision information;
[0015] The decision gap value is obtained by performing a difference processing on the true category score and the maximum competing category score;
[0016] Based on the dual-path gradient calculation mechanism, a first gradient corresponding to the true class score and a second gradient corresponding to the maximum competing class score are determined; based on the first gradient and the second gradient, the distribution of the decision gap change rate is determined.
[0017] The perturbation boundary matrix is determined by mapping the decision gap value to the decision gap change rate distribution.
[0018] As one preferred embodiment, the step of sequentially performing superpixel segmentation and dimensionality reduction processing on the sample image to obtain a superpixel feature vector includes:
[0019] The sample image is divided into superpixels using an image superpixel segmentation algorithm to obtain a number of superpixels.
[0020] The dimensionality of several superpixels is reduced to obtain several superpixel feature vectors.
[0021] As one preferred embodiment, the process of processing the superpixel feature vector based on the Shapley value algorithm to obtain the importance heatmap of the sample image includes:
[0022] Marginal contribution processing is performed on several superpixel feature vectors to obtain the Shapley value of each superpixel feature vector;
[0023] The importance heatmap is generated by performing bilinear interpolation on the Shapley values of several superpixel feature vectors.
[0024] As one preferred embodiment, the step of performing binarization segmentation on the fusion sensitivity matrix to obtain a binary mask matrix corresponding to the target region in the sample image includes:
[0025] Based on the preset threshold, the fusion sensitivity matrix is binarized and segmented to obtain an initial mask matrix;
[0026] The initial mask matrix is then smoothed and padded sequentially to obtain a binary mask matrix corresponding to the target region in the sample image.
[0027] As one preferred embodiment, the step of performing mask-constrained adversarial training on the binary mask matrix and the sample image to obtain adversarial sample data includes:
[0028] By performing forward propagation masking on the binary mask matrix and the sample image, a mask region is obtained; by performing backpropagation gradient filtering on the mask region, the gradient value of the mask region is obtained.
[0029] The gradient values of the masked region are updated by sign gradient perturbation to obtain perturbation data;
[0030] Based on the perturbation data and the sample images, adversarial sample data is determined.
[0031] As a preferred embodiment, after obtaining the target detection model, the image detection method oriented towards an interpretable target detection model further includes:
[0032] The Monte Carlo sampling method is used to randomly combine several superpixel feature vectors to obtain Shapley values for different feature combinations;
[0033] The detection results of the target detection model are verified based on the Shapley values of different feature combinations.
[0034] Another embodiment of the present invention provides an image detection apparatus for an interpretable analysis target detection model, applied to the image detection method for an interpretable analysis target detection model as described above, comprising: inputting the image to be detected into a trained target detection model for processing to obtain a detection result, wherein the training module of the target detection model includes:
[0035] The processing module is used to input the acquired sample image into the initial detection model for forward propagation processing, and determine the perturbation boundary matrix of the sample image based on the obtained image classification score decision information;
[0036] The dimension reduction module is used to sequentially perform superpixel segmentation and dimension reduction processing on the sample image to obtain superpixel feature vectors.
[0037] The generation module is used to process the superpixel feature vector based on the Shapley value algorithm to obtain the importance heatmap of the sample image;
[0038] The segmentation module is used to obtain the fusion sensitivity matrix of the sample image based on the perturbation boundary matrix and the importance heatmap, and to perform binarization segmentation processing on the fusion sensitivity matrix to obtain a binary mask matrix corresponding to the target region in the sample image.
[0039] An adversarial module is used to perform mask-constrained adversarial training on the binary mask matrix and the sample image to obtain adversarial sample data, wherein the adversarial sample data is constructed from information of the target region in the sample image;
[0040] The update module is used to update the initial detection model based on the training results of the initial detection model using the adversarial sample data, so as to obtain the target detection model.
[0041] Another embodiment of the present invention provides an image detection device for an interpretable analysis target detection model, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the image detection method for an interpretable analysis target detection model as described above.
[0042] In another embodiment of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, wherein when the device containing the computer-readable storage medium executes the computer program, it implements the image detection method for an interpretable analysis target detection model as described above.
[0043] Compared with the prior art, the beneficial effects of the embodiments of the present invention are at least one of the following:
[0044] This invention obtains detection results by inputting the image to be detected into a trained target detection model. The training process of the target detection model includes: inputting the acquired sample image into an initial detection model for forward propagation; determining the perturbation boundary matrix of the sample image based on the obtained image classification score decision information; sequentially performing superpixel segmentation and dimensionality reduction on the sample image to obtain superpixel feature vectors; processing the superpixel feature vectors based on the Shapley value algorithm to obtain an importance heatmap of the sample image; obtaining a fusion sensitivity matrix of the sample image based on the perturbation boundary matrix and the importance heatmap, and performing binarization segmentation on the fusion sensitivity matrix to obtain a binary mask matrix corresponding to the target region in the sample image; performing mask-constrained adversarial training on the binary mask matrix and the sample image to obtain adversarial sample data, wherein the adversarial sample data is constructed from information about the target region in the sample image; and updating the initial detection model based on the training results of the adversarial sample data to obtain the target detection model.
[0045] Compared with existing technologies, this invention decomposes sample images into regional units through superpixel segmentation and extracts feature vectors. It uses the Shapley value algorithm to generate a heatmap that quantifies the contribution of each region to the model's decision. Combined with the perturbation boundary matrix obtained from the initial model classification decision information, a sensitivity matrix is formed. After binarization segmentation, a binary mask matrix marking key target regions is obtained. Subsequently, based on this mask matrix, adversarial examples are constructed using only key region information for model training, enabling the model to focus on key region feature learning. Finally, through the rapid matching of key regions by the target detection model, the rapid identification and localization of the image to be detected is achieved. Attached Figure Description
[0046] Figure 1 This is a flowchart illustrating the training process in an image detection method for an interpretable analysis target detection model, according to one embodiment of the present invention.
[0047] Figure 2 This is a schematic diagram of the training module in an image detection device for an interpretable analysis target detection model, according to one embodiment of the present invention.
[0048] Figure 3 This is a schematic diagram of the structure of an image detection device for an interpretable analysis target detection model according to one embodiment of the present invention;
[0049] Figure label:
[0050] Among them, 11 is the processing module; 12 is the dimensionality reduction module; 13 is the generation module; 14 is the segmentation module; 15 is the adversarial module; 16 is the update module; 21 is the processor; and 22 is the memory. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0052] In the description of this invention, the terms "first," "second," "third," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first," "second," "third," etc., may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0053] In the description of this invention, it should be noted that, unless otherwise defined, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this specification is for the purpose of describing specific embodiments only and is not intended to limit the invention. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0054] One embodiment of the present invention provides an image detection method for interpretable analysis target detection models. For details, please refer to [link to relevant documentation]. Figure 1 , Figure 1 The diagram illustrates the training process of an image detection method for an interpretable analysis target detection model, as shown in one embodiment of the present invention. The method includes inputting the image to be detected into a trained target detection model for processing to obtain a detection result. Specifically, the training process of the target detection model includes:
[0055] S1: Input the acquired sample image into the initial detection model for forward propagation processing, and determine the perturbation boundary matrix of the sample image based on the obtained image classification score decision information;
[0056] S2: Perform superpixel segmentation and dimensionality reduction processing on the sample image in sequence to obtain superpixel feature vectors;
[0057] S3: Process the superpixel feature vector based on the Shapley value algorithm to obtain the importance heatmap of the sample image;
[0058] S4: Based on the perturbation boundary matrix and the importance heatmap, obtain the fusion sensitivity matrix of the sample image, and perform binarization segmentation processing on the fusion sensitivity matrix to obtain a binary mask matrix corresponding to the target region in the sample image;
[0059] S5: Perform mask constraint adversarial training on the binary mask matrix and the sample image to obtain adversarial sample data, wherein the adversarial sample data is constructed from the information of the target region in the sample image;
[0060] S6: Update the initial detection model based on the training results of the adversarial sample data to obtain the target detection model.
[0061] In the field of testing, "Explainable Analysis" (XA) refers to methods and techniques for analyzing and explaining the output results, decision-making processes, or model behavior of a testing system in a clear, transparent, and easily understandable manner. Its core objective is to solve the "black box" problem and ensure that the logic, basis, and reliability of the testing results can be understood and trusted by users (such as operators, regulators, and decision-makers).
[0062] Specifically, in step S3, an importance heatmap is generated based on the Shapley Value algorithm. Essentially, this is an interpretability method. The Shapley Value originates from game theory and generates a heatmap by quantifying the contribution of each superpixel feature (i.e., local region of the image) to the final classification result. It can accurately answer the question, "Which image regions have the greatest impact on the model's judgment result?"
[0063] Specifically, the training process S1 of the object detection model includes: inputting the acquired sample image into the initial detection model for forward propagation processing; determining the perturbation boundary matrix of the sample image based on the obtained image classification score decision information; specifically, inputting the acquired sample image into the initial detection model for forward propagation processing to obtain image classification score decision information; determining the true class score and the maximum competing class score based on the image classification score decision information; performing difference processing on the true class score and the maximum competing class score to obtain the decision gap value; determining the first gradient corresponding to the true class score and the second gradient corresponding to the maximum competing class score based on the dual-path gradient calculation mechanism; determining the decision gap change rate distribution based on the first gradient and the second gradient; and mapping the decision gap value to the decision gap change rate distribution to determine the perturbation boundary matrix.
[0064] Specifically, in one embodiment, the sample image to be processed is input into an initial detection model constructed by a convolutional neural network, and forward propagation calculation is performed. Forward propagation refers to the process where image data is extracted and transformed sequentially from the model input layer through various hidden layers, such as convolutional layers, pooling layers, and fully connected layers, and finally, the output layer generates the predicted score of the image belonging to each category, i.e., the classification score. These classification scores together constitute the image classification score decision information.
[0065] From the image classification score decision information, two key scores are selected: the true class score and the maximum competing class score. The true class score is the predicted score of the actual class to which the sample image belongs, and the maximum competing class score is the score of the class with the highest predicted score other than the true class, i.e., the score of the class most likely to be confused with the true class. The difference between the true class score and the maximum competing class score is used to obtain the decision gap value, which is used to quantify the model's ability to distinguish between the true class and the most likely confused class. The larger the decision gap value, the more reliable the model's judgment of the true class is and the less easily affected by interfering classes; conversely, the smaller the decision gap value, the weaker the model's decision stability.
[0066] The dual-path gradient calculation mechanism is then activated. The first path calculates the gradient of the true class score with respect to the input image, reflecting how image perturbations affect the true class score. The second path calculates the gradient of the maximum competing class score with respect to the input image, reflecting how image perturbations affect the maximum competing class score. The gradient results of the two paths are subtracted to obtain the decision gap change rate distribution, which reflects the impact of a unit intensity change at each pixel location on the decision gap.
[0067] Based on the first-order stability condition of provable robustness theory, the absolute value of the decision gap is mapped to the rate of change distribution. For each pixel location in the image, the corresponding rate of change value is extracted. Through a stability transformation operation, the decision gap value is divided by the rate of change distribution at each pixel location, as shown in the following formula:
[0068]
[0069] in, It is the decision gap value. This is the decision gap change rate distribution, which reflects the impact of a unit intensity change at each pixel location on the decision gap. To prevent tiny protection constants from division-to-zero errors, this formula establishes a quantitative mapping relationship between the absolute value of the decision gap and pixel sensitivity, ultimately generating a perturbation boundary matrix with the same resolution as the input image. .
[0070] Each element of this matrix represents the maximum perturbation intensity that the corresponding pixel can withstand while maintaining the correct classification of the model. The theoretical guarantee is that when the perturbation amplitude of any pixel does not exceed the boundary value at that position, it can be rigorously proven through linear approximation that the model decision result will not be reversed.
[0071] The sample image is sequentially subjected to superpixel segmentation and dimensionality reduction processing to obtain superpixel feature vectors. Specifically, this includes: performing superpixel segmentation processing on the sample image using an image superpixel segmentation algorithm to obtain several superpixels; and performing dimensionality reduction processing on the several superpixels to obtain several superpixel feature vectors.
[0072] A superpixel feature vector is a feature representation extracted from each region after an image is segmented into several regions (superpixels) with similar visual features.
[0073] Specifically, the sample image is first divided into several superpixels using the SLIC (Simple LinearIterative Clustering) superpixel segmentation algorithm. Each superpixel serves as an independent feature unit. Then, the high-dimensional image data is reduced to superpixel feature vectors, preserving the semantic structure of the image while reducing computational complexity. For example, in the under-clothing detection model for power grid systems, the image region containing people is divided into 100-200 superpixels, with each superpixel corresponding to a local area of the human body, such as the head, torso, or background region.
[0074] The importance heatmap of the sample image is obtained by processing the superpixel feature vectors based on the Shapley value algorithm, including: performing marginal contribution processing on several superpixel feature vectors to obtain the Shapley value of each superpixel feature vector; and performing bilinear interpolation processing on the Shapley values of several superpixel feature vectors to generate the importance heatmap.
[0075] Marginal contribution processing refers to calculating, for each superpixel, the improvement in model decision results, such as classification accuracy and prediction confidence, when the superpixel is changed from "not included" to "included" across all possible feature subset combinations. The Shapley value, on the other hand, averages the marginal contribution of the superpixel across all subset combinations, quantifying its overall importance to the model's decision.
[0076] The Shapley Point Algorithm (SHAP) calculates the marginal contribution of each superpixel to the model's prediction across all possible feature combinations, deriving its importance score, or Shapley value. This superpixel SHAP value is then mapped back to the sample image space, and bilinear interpolation expands the discrete superpixel scores into continuous pixel-level scores, generating an importance heatmap. Brighter areas in the heatmap correspond to higher SHAP values, indicating a greater contribution to the model's target detection decision; darker areas contribute less. For example, in unclothed detection, the heatmap highlights key body parts of a person, while background areas are displayed as darker areas with low contribution.
[0077] Based on the perturbation boundary matrix and the importance heatmap, a fusion sensitivity matrix of the sample image is obtained, and the fusion sensitivity matrix is subjected to binarization segmentation processing to obtain a binary mask matrix corresponding to the target region in the sample image. Specifically, this includes: performing weighted fusion of the perturbation boundary matrix and the importance heatmap to obtain the fusion sensitivity matrix of the sample image; performing binarization segmentation processing on the fusion sensitivity matrix based on a preset threshold to obtain an initial mask matrix; and sequentially performing smoothing and masking processing on the initial mask matrix to obtain a binary mask matrix corresponding to the target region in the sample image.
[0078] First, define the fusion sensitivity matrix. Perturbation boundary matrix Heatmap of Importance Linear combination:
[0079]
[0080] in, These are the weighting coefficients of the perturbation boundary matrix; These are the weighting coefficients in the importance heatmap, used to balance the semantic contribution of pixels to the detection decision; they can be adjusted... , It can flexibly adapt to different scenario requirements.
[0081] A preset threshold is used to perform binarization segmentation on the fusion sensitivity matrix. This threshold is determined by optimization on the validation set through grid search to ensure that only highly sensitive regions that have a significant impact on model decisions are retained. During the segmentation process, the fusion value is compared with the threshold pixel by pixel. When the fusion value exceeds the threshold, it is marked as a key pixel and assigned a value of 1. Otherwise, it is marked as a non-key region and assigned a value of 0, thus generating an initial mask matrix with discretized features.
[0082] To address the fragmentation issue in the initial mask, optimization is performed sequentially. First, a two-dimensional Gaussian filter with a standard deviation of 1.5 is used to smooth the initial mask matrix. Then, a weighted average of neighboring pixel values is applied using a 3×3 convolution kernel to effectively suppress isolated noise caused by threshold segmentation. Second, morphological operations are performed using circular structuring elements with a radius of 2 pixels. First, dilation is performed to fill the mask hole areas, and then erosion is performed to restore the original boundary shape. Finally, a binary mask of key regions with physical connectivity and smooth edges is output, i.e., a binary mask matrix.
[0083] The adversarial sample data is obtained by performing mask-constrained adversarial training on the binary mask matrix and the sample image, including: performing forward propagation masking on the binary mask matrix and the sample image to obtain a mask region; performing backpropagation gradient filtering on the mask region to obtain the gradient value of the mask region; updating the gradient value of the mask region with signed gradient perturbation to obtain perturbation data; and determining adversarial sample data based on the perturbation data and the sample image.
[0084] Forward propagation masking involves multiplying a binary mask matrix pixel-by-pixel with the sample image. Regions with a mask value of 1 retain the sample image information, while regions with a mask value of 0 are masked, resulting in a "masked region" containing only the target region information. In this process, mask constraints limit the scope of adversarial perturbations, preventing perturbations from being applied to irrelevant regions (such as the background). This ensures that perturbations only affect regions crucial to the model's decision-making, enhancing the specificity and concealment of adversarial examples.
[0085] Backpropagation gradient filtering refers to a process where, when the model calculates the gradient of the loss function with respect to the input image, only the gradient information of the masked region is retained, while the gradients of regions outside the mask are filtered out. Specifically, by multiplying the mask matrix and the gradient matrix, the gradient values of non-masked regions are set to 0, retaining only the gradient of the target region. This focuses gradient calculation on key regions, avoiding interference from gradients in irrelevant areas, and ensuring that subsequent perturbation updates are based only on the gradients of regions that affect the model's decisions.
[0086] The obtained perturbation data is superimposed on the original sample image, with perturbation only applied to the masked areas, while the non-masked areas retain the original image information, generating the final adversarial example data. It is important to ensure that the perturbation amplitude does not exceed a preset threshold during the superposition process to avoid excessive distortion, while also ensuring that the adversarial examples remain within the visual distribution range of the sample image. By combining the sample image with targeted perturbations, adversarial examples that can effectively deceive the model but are visually similar to the original image are generated for adversarial training of the model, improving the model's robustness to malicious perturbations.
[0087] It should be noted that the adversarial sample data is constructed from information about the target region in the sample image.
[0088] The initial detection model is updated based on the training results of the adversarial sample data to obtain the target detection model.
[0089] The generated adversarial example data is used as new training data and input into the initial detection model for iterative training. During training, the model calculates a loss function based on the prediction error of the adversarial examples, i.e., the degree to which the model misclassifies adversarial examples, and adjusts model parameters, such as convolutional kernel weights and fully connected layer coefficients, through the backpropagation algorithm to reduce the misclassification rate of adversarial examples. This process is repeated multiple times until the model's overall performance on both adversarial and original samples reaches a preset standard, such as a stable high level of classification accuracy and a significantly improved tolerance to adversarial perturbations. The model obtained at this point is the object detection model.
[0090] After obtaining the target detection model, the image detection method for interpretable target detection model further includes: randomly combining several superpixel feature vectors using Monte Carlo sampling to obtain Shapley values for different feature combinations; and verifying the detection results of the target detection model based on the Shapley values of different feature combinations.
[0091] In this step, a large number of different feature subsets are randomly generated from all superpixel feature vectors; that is, random combinations of superpixel feature vectors. For each random feature subset, the Shapley value of each superpixel feature vector is calculated. Since the total number of superpixel feature vectors may be large, enumerating all possible feature combinations to calculate the Shapley value would lead to extremely high computational costs. Monte Carlo sampling, by randomly sampling some combinations, can significantly reduce the computational cost while maintaining a certain level of accuracy, and efficiently obtain approximate Shapley values for different feature combinations.
[0092] The correlation between the Shapley values of different feature combinations and the detection results of the target detection model was analyzed. The core verification logic included consistency verification, stability verification, and robustness verification.
[0093] Among these, consistency verification checks whether the model's detection results for samples are consistent with the feature attributes of high-Shapley-value superpixels. For example, if the model detects an image as a "cat," then key superpixels such as the "cat's head and torso" should have high Shapley values in most feature combinations. Stability verification observes whether the model's detection results change significantly after removing high-Shapley-value superpixels. If the model's performance deteriorates significantly after removing high-Shapley-value superpixels, it indicates that the model's decision-making relies on key features. Robustness verification determines whether changes in low-Shapley-value superpixels interfere with the model's detection results. If random perturbations of low-Shapley-value superpixels have minimal impact on the detection results, it indicates that the model's decision-making is not affected by irrelevant features and has good robustness.
[0094] By conducting multi-combinatorial analysis of Shapley values, it can be determined whether the model makes decisions based on "key features relevant to the true class" rather than relying on irrelevant features such as noise and background, thereby confirming the validity of the detection results. If the validation process finds that the model's decisions are inconsistent with the Shapley values of the key features, it indicates that the model may have biases and needs further optimization.
[0095] Another embodiment of the present invention provides an image detection device for an interpretable analysis target detection model. For details, please refer to [link to relevant documentation]. Figure 2 , Figure 2 The diagram illustrates the structure of a training module in an image detection apparatus for an interpretable analysis-oriented target detection model, as shown in one embodiment of the present invention. The apparatus is applied to the image detection method for an interpretable analysis-oriented target detection model as described above, and includes: inputting the image to be detected into a trained target detection model for processing to obtain a detection result. The training module of the target detection model includes:
[0096] Processing module 11 is used to input the acquired sample image into the initial detection model for forward propagation processing, and determine the perturbation boundary matrix of the sample image based on the obtained image classification score decision information;
[0097] Dimensionality reduction module 12 is used to sequentially perform superpixel segmentation and dimensionality reduction processing on the sample image to obtain superpixel feature vectors;
[0098] The generation module 13 is used to process the superpixel feature vector based on the Shapley value algorithm to obtain the importance heatmap of the sample image;
[0099] The segmentation module 14 is used to obtain the fusion sensitivity matrix of the sample image based on the perturbation boundary matrix and the importance heatmap, and to perform binarization segmentation processing on the fusion sensitivity matrix to obtain a binary mask matrix corresponding to the target region in the sample image.
[0100] The adversarial module 15 is used to perform mask-constrained adversarial training on the binary mask matrix and the sample image to obtain adversarial sample data, wherein the adversarial sample data is constructed from the information of the target region in the sample image;
[0101] The update module 16 is used to update the initial detection model based on the training results of the initial detection model using the adversarial sample data, so as to obtain the target detection model.
[0102] See Figure 3 This is a schematic diagram of the structure of an image detection device oriented towards an interpretable analysis target detection model provided in an embodiment of the present invention. The image detection device 20 oriented towards an interpretable analysis target detection model provided in this embodiment includes a processor 21, a memory 22, and a computer program stored in the memory 22 and configured to be executed by the processor 21. When the processor 21 executes the computer program, it implements the steps as described in the above embodiment of the image detection method for an interpretable analysis target detection model, for example... Figure 1 The steps S1 to S6 described above; or, when the processor 21 executes the computer program, it implements the functions of each module in the above-described device embodiments, such as the processing module 11.
[0103] For example, the computer program can be divided into one or more modules, which are stored in the memory 22 and executed by the processor 21 to complete the present invention. The one or more modules can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the image detection device 20 for interpretable analysis target detection models. For example, the computer program can be divided into a processing module 11, a dimensionality reduction module 12, a generation module 13, etc., with the specific functions of each module as follows:
[0104] Processing module 11 is used to input the acquired sample image into the initial detection model for forward propagation processing, and determine the perturbation boundary matrix of the sample image based on the obtained image classification score decision information;
[0105] Dimensionality reduction module 12 is used to sequentially perform superpixel segmentation and dimensionality reduction processing on the sample image to obtain superpixel feature vectors;
[0106] The generation module 13 is used to process the superpixel feature vector based on the Shapley value algorithm to obtain the importance heatmap of the sample image;
[0107] The segmentation module 14 is used to obtain the fusion sensitivity matrix of the sample image based on the perturbation boundary matrix and the importance heatmap, and to perform binarization segmentation processing on the fusion sensitivity matrix to obtain a binary mask matrix corresponding to the target region in the sample image.
[0108] The adversarial module 15 is used to perform mask-constrained adversarial training on the binary mask matrix and the sample image to obtain adversarial sample data, wherein the adversarial sample data is constructed from the information of the target region in the sample image;
[0109] The update module 16 is used to update the initial detection model based on the training results of the initial detection model using the adversarial sample data, so as to obtain the target detection model.
[0110] The image detection device 20 for interpretable analysis target detection models may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art will understand that the schematic diagram is merely an example of an image detection device for interpretable analysis target detection models and does not constitute a limitation on the image detection device 20 for interpretable analysis target detection models. It may include more or fewer components than illustrated, or combine certain components, or use different components. For example, the image detection device 20 for interpretable analysis target detection models may also include input / output devices, network access devices, buses, etc.
[0111] The processor 21 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor 21 is the control center of the image detection device 20 for interpretable analysis target detection models, connecting all parts of the image detection device 20 using various interfaces and lines.
[0112] The memory 22 can be used to store the computer programs and / or modules. The processor 21 implements various functions of the image detection device 20 for interpretable analysis target detection models by running or executing the computer programs and / or modules stored in the memory 22 and calling the data stored in the memory 22. The memory 22 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0113] The modules integrated into the image detection device 20 for interpretable target detection models, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0114] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0115] Accordingly, embodiments of the present invention provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the steps in the image detection method for an interpretable analysis target detection model as described above.
[0116] Compared with the prior art, the beneficial effects of the embodiments of the present invention are at least one of the following:
[0117] This invention obtains detection results by inputting the image to be detected into a trained target detection model. The training process of the target detection model includes: inputting the acquired sample image into an initial detection model for forward propagation; determining the perturbation boundary matrix of the sample image based on the obtained image classification score decision information; sequentially performing superpixel segmentation and dimensionality reduction on the sample image to obtain superpixel feature vectors; processing the superpixel feature vectors based on the Shapley value algorithm to obtain an importance heatmap of the sample image; obtaining a fusion sensitivity matrix of the sample image based on the perturbation boundary matrix and the importance heatmap, and performing binarization segmentation on the fusion sensitivity matrix to obtain a binary mask matrix corresponding to the target region in the sample image; performing mask-constrained adversarial training on the binary mask matrix and the sample image to obtain adversarial sample data, wherein the adversarial sample data is constructed from information about the target region in the sample image; and updating the initial detection model based on the training results of the adversarial sample data to obtain the target detection model.
[0118] Compared with existing technologies, this invention decomposes sample images into region-level units through superpixel segmentation and extracts feature vectors. It uses the Shapley algorithm to generate a heatmap quantifying the contribution of each region to the model's decision-making. This heatmap, combined with the perturbation boundary matrix obtained from the initial model's classification decision information, forms a sensitivity matrix. Binary segmentation is then used to obtain a binary mask matrix marking key target regions. Subsequently, based on this mask matrix, adversarial examples are constructed using only key region information for model training, allowing the model to focus on key region feature learning. Finally, the target detection model achieves rapid identification and localization of the image to be detected through rapid matching of key regions. The above embodiments only illustrate several implementation methods of this invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of this invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of this invention, and these all fall within the protection scope of this invention. Therefore, the protection scope of this invention should be determined by the appended claims.
Claims
1. An image detection method for an interpretable analysis target detection model, characterized by, The method comprises the following steps: The image to be detected is input into the trained target detection model for processing to obtain a detection result, wherein the training process of the target detection model comprises the following steps: The obtained sample image is input into the initial detection model for forward propagation processing, and a perturbation boundary matrix of the sample image is determined according to obtained image classification score decision information, comprising: determining a real class score and a maximum competitive class score based on the image classification score decision information; performing difference processing on the real class score and the maximum competitive class score to obtain a decision gap value; determining a first gradient corresponding to the real class score and a second gradient corresponding to the maximum competitive class score based on a double-path gradient calculation mechanism; determining a decision gap change rate distribution based on the first gradient and the second gradient; and mapping the decision gap value and the decision gap change rate distribution to determine the perturbation boundary matrix; The sample image is sequentially subjected to superpixel division processing and dimension reduction processing to obtain a superpixel feature vector; The superpixel feature vector is processed based on a Shapley value algorithm to obtain an importance heat map of the sample image; According to the perturbation boundary matrix and the importance heat map, a fusion sensitivity matrix of the sample image is obtained, including: performing weighted fusion on the perturbation boundary matrix and the importance heat map to obtain the fusion sensitivity matrix of the sample image, wherein the fusion sensitivity matrix is a linear combination of the perturbation boundary matrix and the importance heat map . wherein, is a weight coefficient of the perturbation boundary matrix; is a weight coefficient of the importance heat map, used to balance the semantic contribution of pixels to the detection decision and to binarize the fusion sensitivity matrix to obtain a binary mask matrix corresponding to the target region in the sample image; The binary mask matrix and the sample image are subjected to mask constraint adversarial training to obtain adversarial sample data, wherein the adversarial sample data is constructed from information of a target region in the sample image; The initial detection model is updated according to the training result of the initial detection model based on the adversarial sample data to obtain the target detection model. 2.The image detection method of claim 1, wherein, The sample image is sequentially subjected to superpixel division processing and dimension reduction processing to obtain a superpixel feature vector, comprising: The sample image is subjected to superpixel division processing using an image superpixel segmentation algorithm to obtain a plurality of superpixels; The plurality of superpixels are subjected to dimension reduction processing to obtain a plurality of superpixel feature vectors. 3.The image detection method of claim 1, wherein The superpixel feature vector is processed based on a Shapley value algorithm to obtain an importance heat map of the sample image, comprising: The plurality of superpixel feature vectors are subjected to marginal contribution processing to obtain a Shapley value of each superpixel feature vector; The Shapley values of the plurality of superpixel feature vectors are subjected to bilinear interpolation processing to generate the importance heat map. 4.The image detection method of claim 1, wherein, The fusion sensitivity matrix is subjected to binary segmentation processing to obtain a binary mask matrix corresponding to a target region in the sample image, comprising: The fusion sensitivity matrix is subjected to binary segmentation processing based on a preset threshold to obtain an initial mask matrix; The initial mask matrix is sequentially subjected to smoothing processing and padding mask processing to obtain a binary mask matrix corresponding to a target region in the sample image. 5.The image detection method of claim 1, wherein, The binary mask matrix and the sample image are subjected to mask constraint adversarial training to obtain adversarial sample data, comprising: A mask region is obtained by performing forward propagation mask processing on the binary mask matrix and the sample image, and a gradient value of the mask region is obtained by performing reverse propagation gradient filtering processing on the mask region; The gradient value of the mask region is subjected to sign gradient perturbation updating to obtain perturbation data; Based on the perturbation data and the sample image, determine the adversarial sample data. 6.The image detection method of claim 1, wherein, After obtaining the target detection model, the image detection method for the target detection model facing the explainable analysis further includes: Using the Monte Carlo sampling method to randomly combine a plurality of superpixel feature vectors to obtain Shapley values of different feature combinations; Based on the Shapley values of different feature combinations, verify the detection results of the target detection model.
7. An image detection apparatus for an interpretable analysis target detection model, characterized by, In the image detection method for the target detection model facing the explainable analysis, the training module of the target detection model includes: The processing module is configured to input the obtained sample image into the initial detection model for forward propagation processing, determine the perturbation boundary matrix of the sample image according to the obtained image classification score decision information, including: determining the real class score and the maximum competitive class score based on the image classification score decision information; performing difference processing on the real class score and the maximum competitive class score to obtain a decision gap value; determining a first gradient corresponding to the real class score and a second gradient corresponding to the maximum competitive class score based on a double-path gradient calculation mechanism; determining a decision gap change rate distribution based on the first gradient and the second gradient; and mapping the decision gap value and the decision gap change rate distribution to determine the perturbation boundary matrix; The dimension reduction module is configured to sequentially perform superpixel division processing and dimension reduction processing on the sample image to obtain a superpixel feature vector; The generation module is configured to process the superpixel feature vector based on a Shapley value algorithm to obtain an importance heat map of the sample image; The segmentation module is configured to obtain a fusion sensitivity matrix of the sample image according to the perturbation boundary matrix and the importance heat map, and the method comprises: performing weighted fusion on the perturbation boundary matrix and the importance heat map to obtain the fusion sensitivity matrix of the sample image, wherein the fusion sensitivity matrix is a linear combination of the perturbation boundary matrix and the importance heat map. The perturbation boundary matrix and the importance heat map is a linear combination of the perturbation boundary matrix and the importance heat map. wherein, is a weight coefficient of the perturbation boundary matrix; is a weight coefficient of the importance heat map, used to balance the semantic contribution of pixels to the detection decision and to binarize the segmentation of the fusion sensitivity matrix to obtain a binary mask matrix corresponding to the target region in the sample image; The adversarial module is configured to perform mask constraint adversarial training on the binary mask matrix and the sample image to obtain adversarial sample data, wherein the adversarial sample data is constructed from information of a target region in the sample image; The update module is configured to update the initial detection model based on the training result of the initial detection model according to the adversarial sample data to obtain the target detection model.
8. An image detection device for an interpretable analysis target detection model, characterized by, The computer readable storage medium stores a computer program, wherein when the device where the computer readable storage medium is located executes the computer program, the image detection method for the target detection model facing the explainable analysis is implemented.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, wherein when the device where the computer readable storage medium is located executes the computer program, the image detection method for the target detection model facing the explainable analysis is implemented.
Citation Information
Patent Citations
Multi-mode and adversarial learning-based multi-task target detection and identification method and device
CN114821014A
Reversible anti-interference method and device for shot image, equipment and medium
CN119888414A