Image Detection Method Based on Error Correction and Region Weight-Guided Knowledge Distillation
By introducing deformable convolution and region weight loss function into image detection, the problems of teacher network error propagation and foreground-background imbalance are solved, thereby improving detection accuracy and speed.
Patent Information
- Application Number
- CN202310769987.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-27
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-06-27
AI Technical Summary
In existing image detection methods based on knowledge distillation, errors from the teacher network propagate to the student network, leading to decreased detection accuracy and an imbalance in the foreground-to-background ratio, which affects detection efficiency and accuracy.
By constructing teacher and student networks, deformable convolution is used to correct the prediction error of the teacher network, and a region weight loss function is used to guide the student network to learn the foreground region, suppressing background noise and improving distillation performance.
It effectively prevents the propagation of errors in teacher networks, improves the detection accuracy and speed of student networks, balances the foreground and background ratio, and enhances detection results.
Smart Images

Figure CN116824336B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of artificial intelligence and medical image technology, specifically to an image detection method based on error correction and region weight-guided knowledge distillation. Background Technology
[0002] CT imaging is currently one of the most important diagnostic methods. In clinical treatment, doctors use information from abdominal images to develop treatment plans for patients. However, this method has limitations and is inefficient due to subjective factors. With the development of science and technology, convolutional neural networks (CNNs), which automatically fit data characteristics using a large number of parameters, are increasingly being applied to the task of detecting lesions in imaging. CNN-based lesion detection methods can largely compensate for the shortcomings of manual diagnosis; however, the improvement in detection accuracy comes at the cost of a huge number of parameters and a complex network structure, resulting in slow operation when this method is implemented in practice.
[0003] To improve the computational efficiency of algorithms and meet the performance requirements of accuracy and speed, existing methods often use knowledge distillation to obtain lightweight networks. Knowledge distillation transfers prior knowledge from the teacher network to the student network by using the output of a large teacher network as a label and guiding a lightweight student network to imitate that output. However, traditional knowledge distillation methods have two problems when applied to anomaly detection tasks in images: first, errors in the teacher network can also be transmitted to the student network, causing the student network to generate side samples and reduce accuracy; second, target detection suffers from an imbalance between foreground and background, and the student network's imitation of background noise during distillation may negatively impact its accuracy. Summary of the Invention
[0004] To overcome at least one deficiency in the prior art, this application provides an image detection method based on error correction and region weight-guided knowledge distillation.
[0005] Firstly, a method for constructing an image detection network is provided, including:
[0006] Construct a dataset; the dataset includes multiple labeled image samples;
[0007] Build teacher and student networks;
[0008] The teacher network is trained based on the dataset to obtain the trained teacher network;
[0009] Image samples are input into the trained teacher and student networks to obtain teacher and student features;
[0010] Determine the prediction loss of the trained teacher network, and obtain the reliable features of the teacher features based on the prediction loss of the trained teacher network and the size of the set threshold.
[0011] Calculate distillation loss based on reliability and student characteristics;
[0012] The prediction loss of the student network is determined, and the prediction loss and distillation loss of the student network constitute the training loss of the student network.
[0013] The training loss of the student network is backpropagated and trained iteratively multiple times until the training loss converges, resulting in the trained student network, which is the image detection network.
[0014] In one embodiment, the teacher network is trained based on a dataset to obtain the trained teacher network, including:
[0015] The teacher network consists of a ResNet101 network, a Feature Pyramid Network (FPN), and convolutional layers;
[0016] The image samples in the dataset are input into the ResNet101 network and the Feature Pyramid Network (FPN) to output teacher features.
[0017] After the teacher features are processed by the convolutional layer, the abnormal region localization result is output. The abnormal region localization result is then classified using softmax to obtain the abnormal classification result. The abnormal region localization result and the abnormal classification result constitute the abnormal region detection result.
[0018] The predictive loss of the teacher network is calculated based on the detection results of abnormal regions and the bounding boxes of image samples.
[0019] The predicted loss of the teacher network is backpropagated and trained iteratively multiple times until the predicted loss converges, resulting in the trained teacher network.
[0020] In one embodiment, reliable features of the teacher characteristics are obtained based on the prediction loss of the trained teacher network and the magnitude of a set threshold, including:
[0021] The image samples are input into the trained teacher network, and the prediction loss G of the trained teacher network is calculated.
[0022] If the prediction loss G of the trained teacher network is greater than the set threshold T, then a self-correction mechanism based on deformable convolution is used to correct the teacher features, resulting in corrected teacher features, which are reliable features.
[0023] If the prediction loss G of the trained teacher network is less than or equal to the set threshold T, then the teacher features are considered reliable features.
[0024] In one embodiment, a self-correcting mechanism based on deformable convolution is used to correct the teacher features, resulting in corrected teacher features, including:
[0025] The image samples are input into the trained teacher network, and the resulting abnormal region localization results include predicted bounding boxes.
[0026] Determine the coordinate offset matrix based on the predicted bounding box and the labeled bounding boxes in the image sample;
[0027] Teacher features are obtained by bilinear interpolation based on the coordinate offset matrix.
[0028] The teacher features obtained by bilinear interpolation are added together and then convolved to obtain the corrected teacher features.
[0029] In one embodiment, determining the coordinate offset matrix based on the predicted bounding box and the labeled bounding boxes in the image sample includes:
[0030] Determine the initial coordinate offset matrix P, wherein the i-th element of the initial coordinate offset matrix P is represented by P. i It means that P i =(P ix ,P iy ), P ix Let P be the offset of the i-th element in the x-direction. iy P represents the offset of the i-th element in the y-direction, where i = 1, 2, 3, 4; ix and P iy Calculate using the following formula:
[0031] P 1x =x-x',P 1y =yy'
[0032] P 2x =x + w - x' - w', P 2y =yy'
[0033] P 3x =x-x',P 3y =y+h-y'-h'
[0034] P 4x =x + w - x' - w', P 4y =y+hyh'
[0035] Where x and y represent the x-coordinate and y-coordinate of the top left corner of the bounding box, respectively; x' and y' represent the x-coordinate and y-coordinate of the top left corner of the prediction box, respectively; w' and h' represent the width and height of the prediction box, respectively; and w and h represent the width and height of the bounding box, respectively.
[0036] Normalize each element in the initial coordinate offset matrix P to obtain the final coordinate offset matrix P′:
[0037] P i ′=k×(P i -min(P))-a
[0038]
[0039] Among them, P i ′ is the i-th element in the coordinate offset matrix P′, k is the intermediate value of the offset, min(P) is the minimum value of the element in the initial coordinate offset matrix P, max(P) is the maximum value of the element in the initial coordinate offset matrix P, and a is the maximum range of the offset.
[0040] In one embodiment, calculating the distillation loss based on the credibility feature and the student feature includes:
[0041] The trusted features and student features are concatenated and then input into the pathGAN network to output the evaluation matrix;
[0042] The distillation loss is calculated based on the evaluation matrix and weight matrix using the following formula:
[0043] L d =MSE(P s (×weights,ones)
[0044] Among them, L d For distillation losses, P s The evaluation matrix is defined as follows: weights is the weight matrix, ones is a matrix of all ones with the same size as the student features, and MSE represents the mean squared error function.
[0045] In one embodiment, determining the predicted loss of the student network includes:
[0046] The student network consists of a ResNet50 network, a Feature Pyramid Network (FPN), and convolutional layers;
[0047] The image samples in the dataset are input into the ResNet50 network and the Feature Pyramid Network (FPN) to output student features.
[0048] After the student features are processed by the convolutional layer, the abnormal region localization result is output. The abnormal region localization result is then classified using softmax to obtain the abnormal classification result. The abnormal region localization result and the abnormal classification result constitute the abnormal region detection result.
[0049] The predicted loss of the student network is calculated based on the detection results of abnormal regions and the bounding boxes of image samples.
[0050] Secondly, an image detection method based on error correction and region weight-guided knowledge distillation is provided, including:
[0051] The image to be detected is input into the image detection network to obtain the detection results of abnormal areas; the image detection network is obtained according to the image detection network construction method described above.
[0052] Thirdly, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the aforementioned image detection method based on error correction and region weight-guided knowledge distillation.
[0053] Fourthly, a computer program product includes a computer program / instruction that, when executed by a processor, implements the aforementioned image detection method based on error correction and region weight-guided knowledge distillation.
[0054] Compared with existing technologies, this application has the following advantages: This application overcomes the problems of teacher network error propagation and foreground-background imbalance in image detection based on knowledge distillation. It corrects the prediction error of the teacher network through deformable convolution, ensuring that the student network can learn the correct feature representation during the distillation process, preventing the generation of negative samples and the decline in detection accuracy. In addition, it enhances the student network's focus on learning the foreground region through the region weight loss function, suppressing the negative impact of background noise on the student network's distillation. It improves the performance of distillation based on traditional knowledge distillation methods, balancing the accuracy of the network and the inference speed. Attached Figure Description
[0055] This application can be better understood by referring to the description given below in conjunction with the accompanying drawings, which, together with the detailed description below, are incorporated in and form part of this specification. In the drawings:
[0056] Figure 1 A schematic diagram illustrating the training process of an image detection network according to an embodiment of this application is shown. Detailed Implementation
[0057] Exemplary embodiments of the present application will be described below with reference to the accompanying drawings. For clarity and brevity, not all features of the actual embodiments are described in the specification. However, it should be understood that many embodiment-specific decisions can be made in the development of any such actual embodiment to achieve the developer’s specific objectives, and these decisions may vary as the embodiments differ.
[0058] It should also be noted that, in order to avoid obscuring this application with unnecessary details, only the device structure closely related to the solution according to this application is shown in the accompanying drawings, while other details that are not closely related to this application are omitted.
[0059] It should be understood that this application is not limited to the described embodiments by virtue of the following description with reference to the accompanying drawings. In this document, embodiments may be combined with each other, features may be substituted or borrowed between different embodiments, and one or more features may be omitted in one embodiment, where feasible.
[0060] This application relates to an image detection method based on error correction and region weight-guided knowledge distillation. First, a teacher network and a student network are designed, both using the same detection algorithm. However, in the backbone network portion, the teacher network uses a large-scale model, while the student network uses a lightweight model. After determining the network structure, the teacher network is trained. After training, the parameters of the teacher network are fixed, and it participates in the training of the student network. Specifically, for each image in the training set, it is simultaneously input into both the trained teacher model and the untrained student network. The feature maps output by the teacher model and the student network are compared, and the distillation loss is calculated. Backpropagation of the distillation loss guides the student network to learn the feature representation of the teacher network. During this process, to prevent errors in the teacher model's feature maps, after the image is input into the teacher model, each round of prediction is evaluated: if the prediction loss is greater than a set threshold, the correct annotations are used to post-process the teacher model features for that round, and the post-processed features are used to calculate the distillation loss; if the prediction loss is less than the set threshold, the teacher model features are directly compared with the student network features, and the distillation loss is calculated. In addition, to balance the foreground and background ratios, the pathGAN network outputs an evaluation matrix of student features during the distillation loss calculation process. This matrix is then multiplied by the weight matrix, assigning high weights to elements in the central region and low weights to elements in the boundary region. This enables the student network to focus on learning the foreground region and suppress noise in the background region.
[0061] This application provides an image detection network construction method, including the following steps:
[0062] Step S1: Construct the dataset; the dataset includes multiple labeled image samples. Here, the acquired image samples can be abdominal images, and the images have been labeled by professional doctors. The labels can be set with realistic bounding boxes for the targets. Furthermore, all DICOM format images need to be uniformly converted to JPG images through grayscale mapping and then normalized to the same size (length: 512 pixels, width: 512 pixels). The conversion method between the HU value of the DICOM file and the grayscale value of the JPG image during grayscale mapping is as follows:
[0063]
[0064]
[0065] Where maxData and minData represent the maximum and minimum HU values in the DICOM file, respectively, srcData represents the HU value of the pixel, Range represents the grayscale range of the JPG image (255), RescaleSlope is the scaling slope, and normalizedData is the value after format conversion. All preprocessed JPG images are divided into training and test sets in an 8:2 ratio.
[0066] Step S2: Construct the teacher network and the student network. Figure 1 A schematic diagram illustrating the training process of an image detection network according to an embodiment of this application is shown.
[0067] Step S3: Train the teacher network based on the dataset to obtain the trained teacher network; save the trained teacher network for knowledge distillation.
[0068] Step S4: Input the image samples into the trained teacher network and student network to obtain teacher features and student features;
[0069] Step S5: Determine the prediction loss of the trained teacher network, and obtain the reliable features of the teacher features based on the prediction loss of the trained teacher network and the set threshold.
[0070] Step S6: Calculate the distillation loss based on the credibility features and student features;
[0071] Step S7: Determine the prediction loss of the student network. The prediction loss and distillation loss of the student network constitute the training loss of the student network.
[0072] Step S8: Backpropagate the training loss of the student network and iterate the training multiple times until the training loss converges to obtain the trained student network, which is the image detection network.
[0073] In one embodiment, step S3 involves training the teacher network based on the dataset to obtain the trained teacher network, including:
[0074] The teacher network consists of a ResNet101 network, a Feature Pyramid Network (FPN), and convolutional layers;
[0075] First, the image samples in the dataset are input into the ResNet101 network and the Feature Pyramid Network (FPN) to output teacher features. Here, the ResNet101 network is the backbone network of the teacher network. The backbone network is used to extract features from the image samples to obtain features from each layer. Then, the features extracted from each layer by the backbone network are fused through the Feature Pyramid Network (FPN) to obtain the teacher features. The teacher features contain detailed information and semantic information.
[0076] Then, the teacher features are processed by convolutional layers to output the abnormal region localization results. Softmax is used to classify the abnormal region localization results to obtain the abnormal classification results. The abnormal region localization results and the abnormal classification results constitute the abnormal region detection results.
[0077] Then, the prediction loss of the teacher network is calculated based on the detection results of the abnormal regions and the bounding boxes of the image samples; here, the prediction loss of the teacher network includes classification loss and localization loss, which are FocalLoss loss and SmoothL1 loss respectively.
[0078] Finally, the predicted loss of the teacher network is backpropagated and trained iteratively until the predicted loss converges, resulting in the trained teacher network. Here, 26 iterations can be performed. After iterative training, the loss of the teacher network gradually converges, and the parameters are gradually optimized. The trained teacher network (i.e., the teacher model) is then saved for knowledge distillation.
[0079] In one embodiment, the student network has a largely similar structure to the teacher network, with the main difference being that the student network uses ResNet50 as its backbone while the teacher network uses ResNet101. ResNet50 has fewer convolutional layers, resulting in fewer parameters and less computation, leading to higher prediction efficiency in practical applications. After the student network is constructed, its parameters are initialized using Xavier initialization.
[0080] In one embodiment, reliable features of the teacher characteristics are obtained based on the prediction loss of the trained teacher network and the magnitude of a set threshold, including:
[0081] First, the image samples are input into the trained teacher network, and the prediction loss G of the trained teacher network is calculated.
[0082] Then, if the prediction loss G of the trained teacher network is greater than the set threshold T, a self-correction mechanism based on deformable convolution is used to correct the teacher features, resulting in corrected teacher features, which are reliable features.
[0083] Finally, if the prediction loss G of the trained teacher network is less than or equal to the set threshold T, then the teacher features are considered reliable features.
[0084] In this embodiment, if G>T, then the teacher features F output by the teacher network for the image will be... t Considered as error feature F w The distillation loss needs to be calculated after processing it using a self-correcting mechanism based on deformable convolution; otherwise, the F... t For reliable feature F c It allows for direct calculation of distillation losses.
[0085] Specifically, a self-correcting mechanism based on deformable convolution is used to correct the teacher features, resulting in corrected teacher features that may include:
[0086] First, the image samples are input into the trained teacher network, and the resulting abnormal region localization results include predicted bounding boxes.
[0087] Based on the predicted bounding box and the labeled bounding boxes in the image sample, determine the coordinate offset matrix; specifically including:
[0088] Determine the initial coordinate offset matrix P. The i-th element of the initial coordinate offset matrix P is represented by P. i It means that P i =(P ix ,P iy ), P ix Let P be the offset of the i-th element in the x-direction. iy P represents the offset of the i-th element in the y-direction, where i = 1, 2, 3, 4; ix and P iy Calculate using the following formula:
[0089] P 1x =x-x',P 1y =yy'
[0090] P 2x =x + w - x' - w', P 2y =yy'
[0091] P 3x =x-x',P 3y =y+h-y'-h'
[0092] P 4x =x + w - x' - w', P 4y=y+hyh'
[0093] Where x and y represent the x-coordinate and y-coordinate of the top left corner of the bounding box, respectively; x' and y' represent the x-coordinate and y-coordinate of the top left corner of the prediction box, respectively; w' and h' represent the width and height of the prediction box, respectively; and w and h represent the width and height of the bounding box, respectively.
[0094] Normalize each element in the initial coordinate offset matrix P to obtain the final coordinate offset matrix P′:
[0095] P i ′=k×(P i -min(P))-a
[0096]
[0097] Among them, P i ′ is the i-th element in the coordinate offset matrix P′, k is the intermediate value of the offset, min(P) is the minimum value of the element in the initial coordinate offset matrix P, max(P) is the maximum value of the element in the initial coordinate offset matrix P, and a is the maximum range of the offset, which can be set to 3.
[0098] Then, based on the coordinate offset matrix, the teacher features F w Perform bilinear interpolation to obtain the bilinearly interpolated teacher features B(F). w Here, after obtaining the coordinate offset matrix P′, the coordinate offset matrix P′ is used for the original teacher features F. w Correction for F. w For each pixel in P′, with that pixel as the origin, calculate the coordinates represented by the four offsets in P′. After bilinear interpolation of the pixel values at these four coordinates, reassign the interpolation result to that pixel. Calculate the bilinearly interpolated teacher feature B(F) using the following formula. w ):
[0099]
[0100]
[0101]
[0102] Where f(a, b) is the gray value corresponding to pixel (a, b) in the teacher feature after bilinear interpolation, and P' ix With P' iy Let f(a, b1) and f(a, b2) represent the offsets of the i-th element in P′ in the x and y directions, respectively, and f(a, b2) are intermediate values for grayscale calculation.
[0103] Then, the bilinearly interpolated teacher features B(F) w) and teacher characteristics F w The sums are then convolved to obtain the corrected teacher features F. w '.
[0104] F w =Conv2d(F w +B(F w ))
[0105] In one embodiment, step S6, calculating the distillation loss based on the credibility feature and the student feature, includes:
[0106] Trustworthy feature F c Student characteristics F s After concatenation, the data is input into the pathGAN network, which outputs an evaluation matrix P. s ;
[0107] According to the evaluation matrix P s And the weight matrix weights, calculate the distillation loss L d The region weight loss function is expressed by the following formula:
[0108] L d =MSE(P s (×weights,ones)
[0109] Among them, L d For distillation losses, P s The evaluation matrix is defined as follows: weights is the weight matrix, ones is a matrix of all ones with the same size as the student features, and MSE represents the mean squared error function.
[0110] In this embodiment, the pathGAN network performs two-dimensional convolution on the concatenated features and outputs an n×n matrix P. s F s With an n×n matrix P s Correspondingly, it is also regarded as an image composed of n×n image blocks, P s The value of the element in the middle is the student characteristic F. s The image patch at this location and the reliable feature F c The similarity measure is denoted by a value of 1, indicating similarity, and 0, indicating dissimilarity. Since distillation loss is used to distill features from the teacher network into the student network, and the distillation goal is to make student features as similar as possible to teacher features, the evaluation matrix output by pathGAN is compared with the all-ones matrix during loss calculation. This aims to maximize the similarity of student features during training. s Gradually approaching the credible feature F cFurthermore, the weights matrix can be used to assign different weights to different locations in an image patch. By reducing the weight of the background region and increasing the weight of the foreground region, noise can be suppressed and the student network can be made to focus on positive samples.
[0111] In one embodiment, determining the predicted loss of the student network includes:
[0112] The student network consists of a ResNet50 network, a Feature Pyramid Network (FPN), and convolutional layers;
[0113] The image samples in the dataset are input into the ResNet50 network and the Feature Pyramid Network (FPN) to output student features.
[0114] After the student features are processed by the convolutional layer, the abnormal region localization result is output. The abnormal region localization result is then classified using softmax to obtain the abnormal classification result. The abnormal region localization result and the abnormal classification result constitute the abnormal region detection result.
[0115] The prediction loss of the student network is calculated based on the detection results of the abnormal regions and the bounding boxes of the image samples. Here, the prediction loss consists of Focal Loss (classification loss) and Smooth L1 localization loss. The final training loss of the student network includes the prediction loss L... p With distillation loss L d Two parts: Loss = L p +L d During training, the loss is backpropagated, and through training, the loss converges and the student network parameters are optimized, ultimately yielding the trained student network.
[0116] This application also provides an image detection method based on error correction and region weight-guided knowledge distillation, including:
[0117] The image to be detected is input into the image detection network to obtain the detection results of abnormal areas; the image detection network is obtained according to the image detection network construction method described above.
[0118] Here, the confidence level of the results can be calculated based on the detection results of the abnormal regions. By setting a threshold for the confidence level, results with higher confidence levels can be filtered out, and results with low confidence levels can be removed using the non-maximum suppression method. Finally, the results are plotted on the input image.
[0119] This application provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the above-described image detection method based on error correction and region weight-guided knowledge distillation.
[0120] This application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the above-described image detection method based on error correction and region weight-guided knowledge distillation.
[0121] To further verify the effectiveness of the proposed method, quantitative analysis experiments were conducted. The programming language used was Python, and the deep learning framework PyTorch was selected to implement the image detection method based on error correction and region weight-guided knowledge distillation. The experimental data consisted of 337 plain abdominal images labeled by physicians. Of these, 271 images were augmented to 2168 images for the training set, and the remaining 66 images were used as the test set. The evaluation metric used in the experiment was AP (Average Per Second). 0.5 AP 0.75 AP is the area enclosed by the Precision-Recall curve. Precision represents the proportion of truly abnormal regions identified by the model, while Recall represents the proportion of truly abnormal regions that are correctly identified. The accuracy of a prediction is determined by the Intersection of Union (IoU) between the model's predicted bounding boxes and the actual labeled bounding boxes provided by the doctor. A correct prediction is considered successful if the IoU is greater than a set threshold. The AP obtained when the threshold is set to 0.5 is the AP value. 0.5 When the value is set to 0.75, the resulting AP is AP. 0.75 To verify the performance of the method in this application, the proposed image detection method based on error correction and region weight-guided knowledge distillation is compared with a detection method (baseline) using ResNet50 as the backbone network. Table 1 shows the quantitative analysis experimental results of the embodiments. As can be seen from the data in Table 1, the method of this application can effectively improve the accuracy of the detection results while compressing the model.
[0122] Table 1
[0123]
[0124]
[0125] In summary, this application has the following technical effects:
[0126] 1. The knowledge distillation method can effectively transfer the feature extraction capabilities of complex networks to simple networks. During training, the student network learns valuable feature distributions from the data by imitating the feature maps extracted by the teacher network, thereby improving its feature extraction capabilities and ultimately obtaining a lightweight and highly accurate detection model.
[0127] 2. Introducing a self-correction mechanism based on deformable convolution into the knowledge distillation network enables timely screening and correction of error features in the teacher network, preventing their propagation to the student network, reducing the number of negative samples during training, and improving the detection accuracy of the student network.
[0128] 3. The knowledge distillation method uses a region weight loss function based on pathGAN, which can calculate the loss of the feature map by region, enhance the student network's feature learning of the foreground region (i.e., the target region) and suppress invalid noise interference from the background region, thus enhancing the distillation effect.
[0129] The above descriptions are merely various embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for constructing an image detection network, characterized in that, include: Construct a dataset; the dataset includes multiple labeled image samples; Build teacher and student networks; The teacher network is trained based on the dataset to obtain the trained teacher network; The image samples are input into the trained teacher network and student network to obtain teacher features and student features; Determine the prediction loss of the trained teacher network, and obtain the reliable features of the teacher features based on the prediction loss of the trained teacher network and the size of a set threshold. Calculate the distillation loss based on the credibility features and the student features; The prediction loss of the student network is determined, and the prediction loss of the student network and the distillation loss constitute the training loss of the student network. The training loss of the student network is backpropagated and trained iteratively multiple times until the training loss converges, resulting in the trained student network, which is the image detection network. The reliable features of the teacher features are obtained based on the prediction loss of the trained teacher network and the value of a set threshold, including: The image samples are input into the trained teacher network, and the prediction loss G of the trained teacher network is calculated. If the prediction loss G of the trained teacher network is greater than the set threshold T, then a self-correction mechanism based on deformable convolution is used to correct the teacher features to obtain the corrected teacher features, i.e., the reliable features. If the prediction loss G of the trained teacher network is less than or equal to a set threshold T, then the teacher feature is taken as the reliable feature. The calculation of distillation loss based on the reliable features and the student features includes: The trusted features and the student features are concatenated and then input into the pathGAN network to output an evaluation matrix; The distillation loss is calculated based on the evaluation matrix and weight matrix using the following formula: in, For distillation losses, P s For the evaluation matrix, This is the weight matrix. It is a matrix of all ones with the same size as the student features. This represents the mean square error function.
2. The method as described in claim 1, characterized in that, in, The teacher network is trained based on the dataset to obtain the trained teacher network, including: The teacher network includes a ResNet101 network, a Feature Pyramid Network (FPN), and convolutional layers. The image samples in the dataset are input into the ResNet101 network and the Feature Pyramid Network (FPN) to output teacher features. After the teacher features are processed by the convolutional layer, the abnormal region localization result is output. The abnormal region localization result is then classified using softmax to obtain the abnormal classification result. The abnormal region localization result and the abnormal classification result constitute the abnormal region detection result. The prediction loss of the teacher network is calculated based on the detection results of the abnormal regions and the bounding boxes of the image samples. The predicted loss of the teacher network is backpropagated and trained iteratively multiple times until the predicted loss converges, thus obtaining the trained teacher network.
3. The method as described in claim 1, characterized in that, in, The teacher features are corrected using a self-correcting mechanism based on deformable convolution to obtain the corrected teacher features, including: The image samples are input into the trained teacher network, and the resulting abnormal region localization results include prediction boxes. Determine the coordinate offset matrix based on the predicted bounding box and the labeled bounding boxes in the image sample; Based on the coordinate offset matrix, bilinear interpolation is performed on the teacher features to obtain the bilinearly interpolated teacher features; The teacher features obtained by bilinear interpolation are added together with the teacher features, and then convolution is performed to obtain the corrected teacher features.
4. The method as described in claim 3, characterized in that, in, Based on the predicted bounding box and the labeled bounding boxes in the image sample, the coordinate offset matrix is determined, including: Determine the initial coordinate offset matrix P, wherein the first element in the initial coordinate offset matrix P is... Each element is used express, , For the first The elements are in Offset in direction For the first The elements are in Offset in direction ; and Calculate using the following formula: in, and These represent the x and y coordinates of the top left corner of the annotation box, respectively. and These represent the x and y coordinates of the top-left corner of the prediction box, respectively. and These represent the width and height of the prediction box, respectively. and These represent the width and height of the annotation box, respectively. Normalize each element in the initial coordinate offset matrix P to obtain the final coordinate offset matrix. : in, Coordinate offset matrix The Middle One element, This is the offset from the middle value. Let P be the minimum value of the elements in the initial coordinate offset matrix P. The maximum value of the elements in the initial coordinate offset matrix P. This represents the maximum range of the offset.
5. The method as described in claim 1, characterized in that, in, Determining the predicted loss of the student network includes: The student network includes a ResNet50 network, a Feature Pyramid Network (FPN), and convolutional layers. The image samples in the dataset are input into the ResNet50 network and the Feature Pyramid Network (FPN) to output student features. After the student features are processed by the convolutional layer, the abnormal region localization result is output. The abnormal region localization result is then classified using softmax to obtain the abnormal classification result. The abnormal region localization result and the abnormal classification result constitute the abnormal region detection result. The prediction loss of the student network is calculated based on the detection results of the abnormal regions and the bounding boxes of the image samples.
6. An image detection method based on error correction and region weight-guided knowledge distillation, characterized in that, include: The image to be detected is input into the image detection network to obtain the detection results of abnormal areas; the image detection network is obtained by the image detection network construction method according to any one of claims 1-5.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the image detection method based on error correction and region weight-guided knowledge distillation as described in claim 6.
8. A computer program product, characterized in that, It includes a computer program / instruction that, when executed by a processor, implements the image detection method based on error correction and region weight-guided knowledge distillation as described in claim 6.
Citation Information
Patent Citations
Mobile terminal medical protection shielding face recognition method, device and system and server
CN112418190A
Compact deep learning defogging method based on comparative learning
CN113689346A