Mask quality detection method, device, equipment and storage medium
By extracting and fusing features from student networks, the problems of cumbersome calculations and insufficient accuracy in mask quality detection in existing technologies are solved, achieving efficient and accurate mask quality detection.
Patent Information
- Application Number
- CN202611422083.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-14
- Publication Date
- 2026-11-27
AI Technical Summary
Among existing mask quality detection methods, the detection method based on explicit geometric rules is computationally cumbersome and resource-intensive, making it difficult to meet the needs of real-time detection. Although end-to-end binary classification networks simplify the process, they are difficult to learn mask geometric features, have weak cross-scene generalization ability, and insufficient detection accuracy, making it difficult to balance detection accuracy and efficiency.
A student network is adopted, including an image feature extraction layer, a shared embedding layer, a master measurement head, and an auxiliary structured output head. Through feature extraction, feature fusion, and bi-branch regression prediction, the quality detection results of the mask are obtained, taking into account both the overall geometric features and local details of the mask.
It improves the accuracy and efficiency of mask quality inspection, effectively balancing the two aspects of inspection accuracy and efficiency.
Smart Images

Figure CN123182267A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer graphics and discloses a mask quality detection method, apparatus, device, and storage medium. Background Technology
[0002] As the scale of smart aquaculture expands, the demand for vision-based automatic fish length measurement continues to increase. Mask quality inspection is a core prerequisite for ensuring measurement accuracy and operational efficiency. However, among the mainstream existing mask quality inspection methods, those based on explicit geometric rules are computationally cumbersome and resource-intensive, making it difficult to meet real-time detection requirements. While end-to-end binary classification networks simplify the process, they struggle to learn mask geometric features, have weak cross-scene generalization capabilities, and insufficient detection accuracy. None of these methods can balance detection accuracy and efficiency. Summary of the Invention
[0003] The main purpose of this application is to provide a mask quality detection method, apparatus, device and storage medium, which aims to solve the technical problems that current detection methods based on explicit geometric rules are computationally cumbersome and resource-intensive, making it difficult to meet real-time detection requirements; although end-to-end binary classification networks simplify the process, they are difficult to learn mask geometric features, have weak cross-scene generalization ability and insufficient detection accuracy. All of the above methods are unable to balance detection accuracy and efficiency.
[0004] To achieve the above objectives, this application provides a mask quality inspection method, the mask quality inspection method comprising: The mask to be detected is input into the student network, which includes an image feature extraction layer, a shared embedding layer, a master measurement head, and an auxiliary structured output head. Based on the image feature extraction layer, feature extraction is performed on the mask to be detected to obtain the backbone feature map; The backbone feature map and the mask to be detected are fused through the shared embedding layer to obtain fused features; The fusion features are detected using the main measuring head and the auxiliary structured output head to obtain the quality detection result of the mask to be detected.
[0005] Optionally, the step of detecting the fused features based on the main measuring head and the auxiliary structured output head to obtain the quality detection result of the mask to be detected includes: The initial measurement probability is obtained by predicting the fused features using the main measuring head. The fused features are predicted using the auxiliary structured output head to obtain prediction results; The measurement probability is determined based on the prediction result and the initial measurement probability; Based on the measurement probability and the preset threshold, the quality detection result of the mask to be detected is obtained.
[0006] Optionally, the prediction result includes Fourier contour similarity score, skeleton similarity score, and width similarity score. The step of predicting the fused features using the auxiliary structured output head to obtain the prediction result includes: The fused features are input into the auxiliary structured output head, which includes a contour frequency domain branch, a skeleton topology branch, and a width distribution branch. The fused features are morphologically matched by the contour frequency domain branch to obtain the Fourier contour similarity score. The fused features are structurally matched using the skeleton topology branches to obtain a skeleton similarity score; The width similarity score is obtained by performing distribution matching on the fused features through the width distribution branch.
[0007] Optionally, the step of fusing the backbone feature map and the mask to be detected through the shared embedding layer to obtain fused features includes: Global average pooling is performed on the backbone feature map to obtain a global shape representation; Global max pooling is performed on the backbone feature map to obtain local defect representations; The global shape representation, the local defect representation, and the mask to be detected are stitched together to obtain the stitched feature; The spliced features are fused through the shared embedding layer to obtain fused features.
[0008] Optionally, after detecting the fused features based on the main measuring head and the auxiliary structured output head to obtain the quality detection result of the mask to be detected, the method further includes: If the quality inspection result is a directly measured sample, then the length of the mask to be inspected corresponding to the directly measured sample is measured; If the quality inspection result is a gray area sample, the teacher network will verify the mask to be tested corresponding to the gray area sample, and the length of the mask to be tested that passes the verification will be measured.
[0009] Optionally, the step of verifying the mask to be detected corresponding to the gray area sample through the teacher network, and measuring the length of the mask to be detected that passes the verification, includes: The contour closure verification is performed on the mask to be detected corresponding to the gray area sample to obtain the contour closure verification result; Perform skeleton topology verification on the mask to be detected to obtain skeleton topology verification results; The width uniformity of the mask to be tested is verified to obtain the width uniformity verification result; The verification results are obtained based on the contour closure verification results, the skeleton topology verification results, and the width uniformity verification results; The length of the mask to be tested is measured if the verification result is passed.
[0010] Optionally, before inputting the mask to be detected into the student network, the method further includes: Perform coordinate verification on the initial mask to obtain the coordinate verification results of the initial mask; Perform a basic compliance check on the initial mask to obtain the compliance check results of the initial mask; Perform an edge contact check on the initial mask to obtain the edge contact check result of the initial mask; If the coordinate verification result, compliance check result, and edge contact check result of the initial mask are all passed, then the initial mask is used as a candidate mask. The candidate mask is processed based on a preset construction function to obtain the mask to be detected.
[0011] Furthermore, to achieve the above objectives, this application also proposes a mask quality detection device, which includes: A network input module is used to input the mask to be detected into a student network, which includes an image feature extraction layer, a shared embedding layer, a main measurement head, and an auxiliary structured output head. The feature extraction module is used to extract features from the mask to be detected based on the image feature extraction layer to obtain the backbone feature map; The feature fusion module is used to fuse the backbone feature map and the mask to be detected through the shared embedding layer to obtain fused features; The quality inspection module is used to inspect the fused features based on the main measuring head and the auxiliary structured output head to obtain the quality inspection result of the mask to be inspected.
[0012] In addition, to achieve the above objectives, this application also proposes a mask quality inspection device, characterized in that the mask quality inspection device includes: a memory, a processor, and a mask quality inspection program stored in the memory and executable on the processor, wherein the mask quality inspection program, when executed by the processor, implements the mask quality inspection method as described above.
[0013] In addition, to achieve the above objectives, this application also proposes a storage medium, characterized in that the storage medium stores a mask quality detection program, which, when executed by a processor, implements the mask quality detection method as described above.
[0014] One or more technical solutions proposed in this application have at least the following technical effects: This application discloses a method for responding to an input mask to be detected by inputting the mask into a student network. The student network includes an image feature extraction layer, a shared embedding layer, a master measurement head, and an auxiliary structured output head. Based on the image feature extraction layer, features of the mask to be detected are extracted to obtain a backbone feature map. The backbone feature map and the mask to be detected are fused through the shared embedding layer to obtain fused features. The fused features are then detected based on the master measurement head and the auxiliary structured output head to obtain the quality detection result of the mask to be detected. Since this application obtains the mask quality detection result by inputting the mask to be detected into the student network composed of the image feature extraction layer, the shared embedding layer, the master measurement head, and the auxiliary structured output head, and performing feature extraction, feature fusion, and bi-branch regression prediction, it takes into account both the overall geometric features and local details of the mask, effectively improving the accuracy and efficiency of mask quality detection. Attached Figure Description
[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating the first embodiment of the mask quality inspection method of this application; Figure 2 This is a flowchart illustrating the second embodiment of the mask quality inspection method of this application; Figure 3 This is a flowchart illustrating the third embodiment of the mask quality inspection method of this application; Figure 4 This is a schematic diagram of the module structure of the mask quality detection device according to an embodiment of this application; Figure 5 This is a schematic diagram of the hardware operating environment involved in the mask quality detection method in this application embodiment.
[0018] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0019] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0020] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0021] This application provides a mask quality detection method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the mask quality inspection method of this application.
[0022] In the first embodiment, the mask quality detection method includes: Step S10: Input the mask to be detected into the student network, which includes an image feature extraction layer, a shared embedding layer, a main measurement head, and an auxiliary structured output head.
[0023] It should be noted that the execution subject of this embodiment can be a server device with data processing, network communication and program running functions, such as a cloud server, edge computing server, etc., or other electronic devices that can achieve the same or similar functions. This embodiment does not limit this.
[0024] It should be understood that the image feature extraction layer can be the front-end backbone structure of the student network, composed of multiple convolutional modules stacked in a predetermined hierarchy. The shared embedding layer can be an intermediate layer structure in the student network located between the feature extraction structure and the output structure, composed of feature concatenation units and fully connected mapping units. The main measurement head can be the core output branch structure of the student network, containing fully connected operation units and activation operation units. The auxiliary structured output head can be multiple sets of output branch structures arranged in parallel with the main measurement head in the student network, each set of output branches containing independent fully connected operation units and activation operation units.
[0025] In the specific implementation, the original input data of the mask to be detected is received; the original input data of the mask to be detected is subjected to data format verification and input dimension adaptation processing, and basic preprocessing such as size normalization and numerical standardization is completed to obtain mask data that conforms to the input specifications of the student network; the preprocessed mask data to be detected is connected to the input end of the student network.
[0026] Furthermore, to enable the student network to simultaneously acquire the visual morphological information and numerical features of the mask, enriching the expressive dimensions of the input information, before step S10, the method further includes: performing coordinate verification on the initial mask to obtain the coordinate verification result of the initial mask; performing a basic compliance check on the initial mask to obtain the compliance check result of the initial mask; performing an edge contact check on the initial mask to obtain the edge contact check result of the initial mask; if the coordinate verification result, the compliance check result, and the edge contact check result of the initial mask are all passed, then the initial mask is used as a candidate mask; the candidate mask is processed based on a preset construction function to obtain the mask to be detected.
[0027] It should be understood that the preset construction function can be a unified input processing function used throughout the entire process of training, validation, and online inference.
[0028] In the specific implementation, the binary image data of the original mask to be detected is acquired, and a predefined preset construction function is called to start a unified input processing flow. Through the image processing branch of the construction function, the original mask to be detected is subjected to spatial size normalization, pixel value standardization, and channel dimension mapping processing in sequence, and the image tensor that matches the input dimension requirements of the student network is output. Through the geometric calculation branch of the construction function, basic morphological statistical operations are performed on the original mask to be detected to extract multi-dimensional manual geometric scalar features such as mask area, contour perimeter, aspect ratio of the bounding rectangle, and region density. The extracted scalar features are subjected to numerical normalization and dimension expansion processing to adapt the feature dimension format of the scalar features to the channel dimension of the image tensor. The adapted scalar features and the image tensor are spliced and fused along the corresponding feature dimensions to obtain the mask to be detected that simultaneously contains visual morphological information and numerical geometric information.
[0029] Step S20: Based on the image feature extraction layer, perform feature extraction on the mask to be detected to obtain the backbone feature map.
[0030] It should be understood that the backbone feature map can be the multi-channel two-dimensional feature mapping data output after the mask to be detected has undergone multi-layer convolution operation of the image feature extraction layer.
[0031] In the specific implementation, the mask to be detected is fed into the input end of the image feature extraction layer; along the forward computation path of the image feature extraction layer, feature extraction and dimensionality transformation are performed sequentially through each layer of convolution modules, and spatial downsampling and feature channel dimensionality enhancement are completed layer by layer; after the final layer output of the image feature extraction layer, the backbone feature map with the corresponding spatial resolution and number of channels is obtained.
[0032] Step S30: The backbone feature map and the mask to be detected are fused through the shared embedding layer to obtain fused features.
[0033] It should be understood that fused features can be a unified feature representation that combines deep visual features with the original input information.
[0034] In the specific implementation, global average pooling is performed on the backbone feature map along the spatial dimension to obtain a global shape representation that characterizes the overall shape distribution of the mask; global max pooling is performed on the backbone feature map along the spatial dimension to obtain a local defect representation that characterizes the local salient features of the mask; the global shape representation, the local defect representation, and the mask to be detected are concatenated along the channel dimension to obtain a concatenated feature that aggregates multi-source information; the concatenated feature is fused and dimension mapped through a fully connected layer in the shared embedding layer to output a fused feature with a fixed dimension.
[0035] Step S40: Detect the fusion features based on the main measuring head and the auxiliary structured output head to obtain the quality detection result of the mask to be detected.
[0036] In the specific implementation, the fused features are transmitted in parallel to the input terminals of the main measuring head and each auxiliary structured output head; the main measuring head performs regression operations on the fused features and outputs the initial measurement probability characterizing the overall measurability of the mask; each auxiliary structured output head performs regression operations on the fused features in the corresponding dimension and outputs the structured measurement probabilities corresponding to the contour, skeleton, and width in sequence; the confidence values of the main measuring head and the measurement probabilities of each auxiliary structured output head are summarized to form the quality inspection result of the mask to be inspected.
[0037] This embodiment inputs the mask to be detected into a student network consisting of an image feature extraction layer, a shared embedding layer, a main measurement head, and an auxiliary structured output head. Through feature extraction, feature fusion, and bi-branch regression prediction, the mask quality detection result is obtained, taking into account both the overall geometric features and local details of the mask, effectively improving the accuracy and efficiency of mask quality detection.
[0038] Reference Figure 2 , Figure 2 This is a flowchart illustrating the second embodiment of the mask quality inspection method of this application, based on the above. Figure 1 The first embodiment shown illustrates a second embodiment of the mask quality inspection method of this application.
[0039] In the second embodiment, step S40 includes: Step S401: Predict the fused features using the main measuring head to obtain the initial measurement probability.
[0040] In the specific implementation, the fused features are input into the fully connected operation unit of the main measuring head to perform linear transformation operation; the output of the linear transformation is passed to the activation operation unit for nonlinear mapping; after the activation operation unit outputs, the initial measurement probability of the corresponding mask to be detected is obtained.
[0041] For ease of understanding, the following examples are provided, but they are not intended to limit this application. In one example, The initial measurement probability is , It is the Sigmoid activation function. This is the weight matrix of the fully connected layer. The fusion features are the input. For the corresponding bias term, The calculation formula can be expressed as:
[0042] Step S402: Predict the fused features using the auxiliary structured output head to obtain the prediction result.
[0043] It should be understood that the prediction result may be a composite result including at least one of the Fourier contour similarity score, skeleton similarity score, and width similarity score.
[0044] In the specific implementation, the aforementioned generated fusion features are imported into the auxiliary structured output head. The auxiliary structured output head is equipped with three parallel functional branches, corresponding to the three evaluation dimensions of contour morphology, skeleton topology, and width distribution, respectively. Each functional branch performs matching operations on the fusion features at the corresponding level and outputs the corresponding similarity score.
[0045] Furthermore, to avoid the problem of overlooking defects due to a single evaluation dimension, and to enable each branch to focus on the evaluation of structural features at different levels, step S402 includes: inputting the fused features into the auxiliary structured output head, the auxiliary structured output head including a contour frequency domain branch, a skeleton topology branch, and a width distribution branch; performing morphological matching on the fused features through the contour frequency domain branch to obtain a Fourier contour similarity score; performing structural matching on the fused features through the skeleton topology branch to obtain a skeleton similarity score; and performing distribution matching on the fused features through the width distribution branch to obtain a width similarity score.
[0046] In the specific implementation: For the contour frequency domain branch, the fused features are contour extracted to obtain a mask boundary point sequence. The boundary point sequence is subjected to Fourier transform to obtain frequency domain coefficients. The frequency domain coefficients are compared with the frequency domain coefficients of a preset standard contour to calculate the similarity and obtain a Fourier contour similarity score. For the skeleton topology branch, the fused features are skeletonized to obtain a central skeleton. Based on the central skeleton, the skeleton nodes and branch connections are extracted. The skeleton nodes and branch connections are matched with a preset standard skeleton to obtain a skeleton similarity score. For the width distribution branch, the fused features are width sampled along the normal direction of the central skeleton to obtain a width distribution sequence along the body length direction. The width distribution sequence is compared with a preset standard width sequence to obtain a width similarity score.
[0047] For ease of understanding, the following examples are provided, but they are not intended to limit this application. In one example, Fourier contour similarity score The calculation formula is:
[0048] Skeleton similarity score The calculation formula is:
[0049] Width similarity score The calculation formula is:
[0050] In the calculation formula, and These are the weight matrices and bias vectors corresponding to the three auxiliary branches, respectively.
[0051] Step S403: Determine the measurement probability based on the prediction result and the initial measurement probability.
[0052] In the specific implementation, the calibration weights corresponding to the three similarity dimensions and the fusion weights of the main probabilities are preset; firstly, the three similarity scores are weighted and summed according to the corresponding calibration weights to obtain the comprehensive structured calibration score; then, the initial measurement probability and the comprehensive structured calibration score are weighted and fused according to the preset fusion weights, and the initial probability is calibrated and corrected in terms of the geometric quality dimension to obtain the measurement probability.
[0053] For ease of understanding, the following examples are provided, but they do not limit this application. In one example, the initial measurement probability... Measure probability p The fusion weights for the main measurement probability are preset hyperparameters with a value range of [value range missing]. Fourier contour similarity score Skeleton similarity score Width similarity score The formula for calculating the measurement probability p is: ,
[0054] Step S404: Obtain the quality detection result of the mask to be detected based on the measurement probability and the preset threshold.
[0055] It should be understood that the preset threshold can be the boundary value between qualified and unqualified quality (e.g., the first threshold and the second threshold); wherein the first threshold is the lower limit boundary value used to determine unqualified quality, the second threshold is the upper limit boundary value used to determine qualified quality, and the value of the second threshold is greater than the first threshold.
[0056] In the specific implementation, the measurement probability corresponding to the mask to be detected is compared with the preset first threshold and second threshold to determine the numerical range to which the measurement probability belongs; according to the numerical range, the mask to be detected is determined as a rejection sample, a gray area sample, or a direct measurement sample; the sample category obtained by the determination and the corresponding measurement probability information are integrated to generate the quality detection result of the mask to be detected.
[0057] Furthermore, in order to classify the quality inspection results, the length of the direct measurement samples with high confidence is directly measured to avoid unnecessary verification costs. Samples with confidence in the gray area are verified through a teacher network. After step S40, the method further includes: if the quality inspection result is a direct measurement sample, the length of the mask to be tested corresponding to the direct measurement sample is measured; if the quality inspection result is a gray area sample, the mask to be tested corresponding to the gray area sample is verified through a teacher network, and the length of the mask to be tested that passes the verification is measured.
[0058] It should be understood that directly measured samples can be masks with a measurable probability higher than the upper threshold, deemed of acceptable quality, and allowed to directly proceed to body length measurement. Gray area samples can be masks with a probability between two thresholds and insufficient student network confidence. Rejected samples can be masks with a measurable probability lower than the lower threshold and deemed of unacceptable quality, thus being directly removed.
[0059] In the specific implementation, the received quality inspection results are distributed and scheduled according to three categories: direct measurement samples, gray area samples, and rejection samples. For the masks to be inspected as direct measurement samples, the corresponding original mask data is retrieved according to the sample identifier. After pre-adaptation processing such as data format alignment and coordinate system matching according to the input specifications of the length measurement stage, it is directly input into the body length measurement stage. For the masks to be inspected as gray area samples, the corresponding original mask data is retrieved and sent to the teacher network processing queue, and three independent geometric checks are initiated in sequence: contour closure verification, skeleton topology verification, and width uniformity verification. The system verifies and outputs the verification results, including the verification conclusions and quantitative indicators for each item. A final judgment is made on the verification results. If the verification result is satisfactory, the mask to be tested is adapted and input into the body length measurement stage. If the verification result is unsatisfactory, the mask to be tested is marked as an unqualified sample, removed from the detection queue, and not included in the subsequent length measurement process. Simultaneously, the classification results of all samples, detailed data from the verification stage, the access status of the length measurement stage, and the corresponding sample identifier are associated and stored to form a complete full-process detection record, which is used for subsequent distillation training iterations of the student network and optimization updates of the dual threshold parameters.
[0060] Furthermore, to avoid the problem of gray area samples being easily misclassified under a single criterion, reduce the misclassification rate, and improve the reliability of mask quality detection results, the step involves verifying the mask to be tested corresponding to the gray area sample through a teacher network, and measuring the length of the mask to be tested that passes the verification. This includes: performing contour closure verification on the mask to be tested corresponding to the gray area sample to obtain contour closure verification results; performing skeleton topology verification on the mask to be tested to obtain skeleton topology verification results; performing width uniformity verification on the mask to be tested to obtain width uniformity verification results; obtaining a verification result based on the contour closure verification result, the skeleton topology verification result, and the width uniformity verification result; and measuring the length of the mask to be tested that passes the verification.
[0061] It should be understood that contour closure verification is a regularized verification oriented towards the integrity of the mask's outer contour, skeleton topology verification is a regularized verification oriented towards the rationality of the mask's internal skeleton structure, and width uniformity verification is a regularized verification oriented towards the regularity of the mask's size distribution.
[0062] In the specific implementation, the outer contour boundary point sequence of the mask to be detected corresponding to the gray area sample is extracted. The boundary point sequence is sampled, smoothed, and frequency domain transformed. The transformed frequency domain features are compared with the matching degree of a preset standard contour template. The number and maximum size of contour breaks and gaps are counted to generate a contour closure verification result. The central skeleton line of the mask to be detected is extracted. The number of endpoints, branches, and main skeleton direction of the skeleton line are identified. The skeleton topology features are compared with the preset standard skeleton topology to generate a skeleton topology verification result. Cross-sectional sampling is performed along the central skeleton line at a preset step size to obtain the mask width value corresponding to each sampling point. The coefficient of variation and local fluctuation amplitude of the width sequence are calculated. The width distribution features are compared with the preset standard width distribution law to generate a width uniformity verification result. The judgment conclusions of the three verifications are logically integrated. If all three verifications meet the preset qualification conditions, the verification result is passed. If any one of them fails to meet the qualification conditions, the verification result is failed. The mask to be detected with a passing verification result is input into the subsequent length measurement stage.
[0063] This embodiment outputs Fourier contour similarity scores, skeleton similarity scores, and width similarity scores through an auxiliary structured output head, and optimizes the initial measurement probability accordingly, so that the final measurable probability incorporates the geometric structure information of the mask, thereby improving the accuracy of quality detection.
[0064] Reference Figure 3 , Figure 3 This is a flowchart illustrating the third embodiment of the mask quality inspection method of this application. Based on the above embodiments, the third embodiment of the mask quality inspection method of this application is proposed.
[0065] In the third embodiment, step S30 includes: Step S301: Perform global average pooling on the backbone feature map to obtain a global shape representation.
[0066] It should be understood that global average pooling can be a pooling operation that performs mean aggregation on the entire spatial region of the feature map, calculating the average value of all spatial pixel values in each channel of the feature map, and outputting a one-dimensional vector with the same dimension as the number of channels.
[0067] In the specific implementation, the channel dimension and spatial dimension parameters of the backbone feature map are obtained, and feature values are collected by traversing all spatial positions of each channel. The mean aggregation operation is performed on all spatial feature values in each channel to obtain the single mean value corresponding to each channel. The mean values of each channel are arranged and combined in channel order to output a one-dimensional vector with the same dimension as the number of channels in the backbone feature map, which is the global shape representation.
[0068] Step S302: Perform global max pooling on the backbone feature map to obtain local defect representations.
[0069] It should be understood that global max pooling can be a pooling operation that aggregates the maximum value across the entire spatial region of the feature map. It calculates the maximum value of all spatial pixel values within each channel of the feature map and outputs a one-dimensional vector with the same dimension as the number of channels. In the specific implementation, the channel dimension and spatial dimension parameters of the backbone feature map are obtained, and feature values are collected by traversing all spatial positions of each channel. A maximum value aggregation operation is performed on all spatial feature values within each channel to obtain the single maximum value corresponding to each channel. The maximum values of each channel are arranged and combined in channel order, and a one-dimensional vector with the same dimension as the number of channels in the backbone feature map is output, which is the representation of local defects.
[0070] Step S303: The global shape representation, the local defect representation, and the mask to be detected are stitched together to obtain the stitched features.
[0071] It should be understood that spliced features can be aggregated feature data obtained by connecting and combining multiple sets of feature data from different sources with compatible dimensions along the channel dimension.
[0072] In the specific implementation, the dimensional parameters of the global shape representation, local defect representation, and the mask to be detected are obtained, and it is confirmed that the three are compatible in all dimensions except the channel dimension. The mask to be detected is subjected to global aggregation processing along the spatial dimension, which is converted into a one-dimensional feature vector with the same dimensional format as the global shape representation and local defect representation. The global shape representation, local defect representation, and the converted mask to be detected feature are concatenated end to end along the channel dimension direction to obtain the aggregated feature whose channel dimension is the sum of the channel dimensions of the three, which is the spliced feature.
[0073] For ease of understanding, the following examples are provided, but they are not intended to limit this application. In one example, The global shape is represented as a one-dimensional vector of dimension 256, and the local defect is represented as a one-dimensional vector of dimension 256. The mask to be detected is converted into a one-dimensional vector of dimension 128 after global aggregation. Connecting these three vectors sequentially along the channel dimensions yields a vector of dimension 128. The one-dimensional vector is the splicing feature, where the first 256 dimensions correspond to global shape information, the middle 256 dimensions correspond to local defect information, and the last 128 dimensions correspond to the basic shape information of the original mask.
[0074] Step S304: Perform feature fusion on the spliced features through the shared embedding layer to obtain fused features.
[0075] It should be understood that fused features can be fixed-dimensional feature vectors output after the spliced features undergo linear transformation and nonlinear mapping through a fully connected layer with a shared embedding layer.
[0076] In the specific implementation, the concatenated features are input into the fully connected layer of the shared embedding layer. First, the first fully connected unit performs a linear transformation operation of weight matrix multiplication and bias superposition to map the concatenated features to the intermediate feature dimension. The output of the linear transformation is passed to the batch normalization unit for numerical distribution normalization, and then input to the activation function to perform nonlinear mapping to enhance the nonlinear expressive power of the features. Subsequent fully connected units further perform feature fusion and dimensionality compression processing to map the intermediate features to the preset target output dimension. After the output of the fully connected layer, a feature vector with unified dimension and fusion of multi-source information is obtained, which is the fused feature.
[0077] Examples are provided below for ease of understanding, but they do not limit this application.
[0078] In one example, let the input concatenated features be a one-dimensional vector of dimension 640, denoted as... The fully connected layer with shared embedding layers maps it to a 256-dimensional output space, and the corresponding weight matrix is denoted as follows. (dimension is) The bias vector is denoted as (Dimension 256); The computation process of a fully connected layer can be represented as:
[0079] In the formula, For activation function, The output fusion feature has a dimension of 256.
[0080] This embodiment performs global average pooling and global max pooling on the backbone feature map along the spatial dimension, enabling the student network to simultaneously acquire the overall shape and contour of the mask and information on local abnormal regions. By fusing these features through a shared embedding layer, the information dimensions of the fused features are enriched, allowing subsequent predictions to comprehensively utilize multi-dimensional features.
[0081] This application also provides a mask quality detection device; please refer to [reference needed]. Figure 4 The mask quality detection device includes: Network input module 10 is used to input the mask to be detected into the student network, which includes an image feature extraction layer, a shared embedding layer, a main measurement head, and an auxiliary structured output head; Feature extraction module 20 is used to extract features from the mask to be detected based on the image feature extraction layer to obtain a backbone feature map; Feature fusion module 30 is used to fuse the backbone feature map and the mask to be detected through the shared embedding layer to obtain fused features; The quality inspection module 40 is used to inspect the fusion features based on the main measuring head and the auxiliary structured output head to obtain the quality inspection result of the mask to be inspected.
[0082] The mask quality detection device provided in this application, employing the mask quality detection method described in the above embodiments, can solve the problems of current detection methods based on explicit geometric rules being computationally cumbersome, resource-intensive, and unable to meet real-time detection requirements. While end-to-end binary classification networks simplify the process, they struggle to learn mask geometric features, have weak cross-scene generalization capabilities, and insufficient detection accuracy. All of the above methods fail to balance detection accuracy and efficiency. Compared to existing technologies, the beneficial effects of the mask quality detection device provided in this application are the same as those of the mask quality detection method provided in the above embodiments, and other technical features in the mask quality detection device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0083] This application provides a mask quality inspection device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the mask quality inspection method in the first embodiment described above.
[0084] The following is for reference. Figure 5 The diagram illustrates a structural schematic of a mask quality inspection device suitable for implementing embodiments of this application. The mask quality inspection device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), tablets, PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The mask quality inspection device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this application.
[0085] like Figure 5As shown, the mask quality inspection device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in ROM (Read Only Memory) 1002 or a program loaded from storage device 1003 into RAM (Random Access Memory) 1004. RAM 1004 also stores various programs and data required for the operation of the mask quality inspection device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. Input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, LCDs (Liquid Crystal Displays), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the mask quality inspection equipment to communicate wirelessly or wiredly with other devices to exchange data. Although mask quality inspection equipment with various systems is shown in the figures, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems can be implemented alternatively.
[0086] The mask quality detection device provided in this application, employing the mask quality detection method described in the above embodiments, can solve the problems of current detection methods based on explicit geometric rules being computationally cumbersome, resource-intensive, and unable to meet real-time detection requirements. While end-to-end binary classification networks simplify the process, they struggle to learn mask geometric features, have weak cross-scene generalization capabilities, and insufficient detection accuracy. All of the above methods fail to balance detection accuracy and efficiency. Compared to existing technologies, the beneficial effects of the mask quality detection device provided in this application are the same as those of the mask quality detection method provided in the above embodiments, and other technical features of this mask quality detection device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0087] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0088] The above description is merely a specific embodiment 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.
[0089] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the mask quality detection method in the above embodiments.
[0090] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, RAM (Random Access Memory), ROM (Read Only Memory), EPROM (Erasable Programmable Read Only Memory), or flash memory, optical fiber, CD-ROM (CD-Read Only Memory), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0091] The aforementioned computer-readable storage medium may be included in the mask quality inspection equipment; or it may exist independently and not assembled into the mask quality inspection equipment.
[0092] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by the mask quality inspection device, cause the mask quality inspection device to perform the aforementioned mask quality inspection method.
[0093] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including LAN (Local Area Network) or WAN (Wide Area Network)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0094] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0095] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0096] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described mask quality detection method. This addresses the current problems where detection methods based on explicit geometric rules are computationally cumbersome, resource-intensive, and unable to meet real-time detection requirements; while end-to-end binary classification networks simplify the process, they struggle to learn mask geometric features, have weak cross-scene generalization capabilities, and insufficient detection accuracy. All of these methods fail to balance detection accuracy and efficiency. Compared to existing technologies, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the mask quality detection method provided in the above embodiments, and will not be elaborated upon here.
[0097] The above description is only a part of the embodiments of this application and does not limit the scope of this application. All equivalent structural transformations made under the technical concept of this application and using the content of this application specification and drawings, or direct / indirect applications in other related technical fields, are included within the protection scope of this application.
[0098] It should be noted that the data collection, tag management, rule setting, and push decision-making processes involved in this application are designed to work with other technical features to solve technical problems. They do not involve or support any illegal activities. Any data processing that may violate laws and regulations (such as unauthorized collection of privacy data, generation of discriminatory tags, setting unfair rules, or pushing illegal information) is not within the scope of protection of this application's technical solution. Of course, the user data in this application will be encrypted, anonymized, or de-identified before storage to ensure user data security.
Claims
1. A method for detecting mask quality, characterized in that, The mask quality detection method includes: The mask to be detected is input into the student network, which includes an image feature extraction layer, a shared embedding layer, a master measurement head, and an auxiliary structured output head. Based on the image feature extraction layer, feature extraction is performed on the mask to be detected to obtain the backbone feature map; The backbone feature map and the mask to be detected are fused through the shared embedding layer to obtain fused features; The fusion features are detected using the main measuring head and the auxiliary structured output head to obtain the quality detection result of the mask to be detected.
2. The mask quality detection method as described in claim 1, characterized in that, The step of detecting the fused features based on the main measuring head and the auxiliary structured output head to obtain the quality detection result of the mask to be detected includes: The initial measurement probability is obtained by predicting the fused features using the main measuring head. The fused features are predicted using the auxiliary structured output head to obtain prediction results; The measurement probability is determined based on the prediction result and the initial measurement probability; Based on the measurement probability and the preset threshold, the quality detection result of the mask to be detected is obtained.
3. The mask quality detection method as described in claim 2, characterized in that, The prediction results include Fourier contour similarity scores, skeleton similarity scores, and width similarity scores. The prediction of the fused features using the auxiliary structured output head to obtain the prediction results includes: The fused features are input into the auxiliary structured output head, which includes a contour frequency domain branch, a skeleton topology branch, and a width distribution branch. The fused features are morphologically matched by the contour frequency domain branch to obtain the Fourier contour similarity score. The fused features are structurally matched using the skeleton topology branches to obtain a skeleton similarity score; The width similarity score is obtained by performing distribution matching on the fused features through the width distribution branch.
4. The mask quality detection method according to any one of claims 1 to 3, characterized in that, The step of fusing the backbone feature map and the mask to be detected through the shared embedding layer to obtain fused features includes: Global average pooling is performed on the backbone feature map to obtain a global shape representation; Global max pooling is performed on the backbone feature map to obtain local defect representations; The global shape representation, the local defect representation, and the mask to be detected are stitched together to obtain the stitched feature; The spliced features are fused through the shared embedding layer to obtain fused features.
5. The mask quality detection method according to any one of claims 1 to 3, characterized in that, After obtaining the quality detection result of the mask to be detected by detecting the fused features based on the main measuring head and the auxiliary structured output head, the method further includes: If the quality inspection result is a directly measured sample, then the length of the mask to be inspected corresponding to the directly measured sample is measured; If the quality inspection result is a gray area sample, the teacher network will verify the mask to be tested corresponding to the gray area sample, and the length of the mask to be tested that passes the verification will be measured.
6. The mask quality detection method as described in claim 5, characterized in that, The step of verifying the mask to be detected corresponding to the gray area sample through the teacher network, and measuring the length of the mask to be detected that passes the verification, includes: The contour closure of the mask to be detected corresponding to the gray area sample is verified to obtain the contour closure verification result. Perform skeleton topology verification on the mask to be detected to obtain skeleton topology verification results; The width uniformity of the mask to be tested is verified to obtain the width uniformity verification result; The verification results are obtained based on the contour closure verification results, the skeleton topology verification results, and the width uniformity verification results; The length of the mask to be tested is measured if the verification result is passed.
7. The mask quality detection method according to any one of claims 1 to 3, characterized in that, Before inputting the mask to be detected into the student network, the process also includes: Perform coordinate verification on the initial mask to obtain the coordinate verification results of the initial mask; Perform a basic compliance check on the initial mask to obtain the compliance check results of the initial mask; Perform an edge contact check on the initial mask to obtain the edge contact check result of the initial mask; If the coordinate verification result, compliance check result, and edge contact check result of the initial mask are all passed, then the initial mask is used as a candidate mask. The candidate mask is processed based on a preset construction function to obtain the mask to be detected.
8. A mask quality detection device, characterized in that, The mask quality detection device includes: A network input module is used to input the mask to be detected into a student network, which includes an image feature extraction layer, a shared embedding layer, a main measurement head, and an auxiliary structured output head. The feature extraction module is used to extract features from the mask to be detected based on the image feature extraction layer to obtain the backbone feature map; The feature fusion module is used to fuse the backbone feature map and the mask to be detected through the shared embedding layer to obtain fused features; The quality inspection module is used to inspect the fused features based on the main measuring head and the auxiliary structured output head to obtain the quality inspection result of the mask to be inspected.
9. A mask quality inspection device, characterized in that, The mask quality inspection device includes: a memory, a processor, and a mask quality inspection program stored in the memory and executable on the processor. When the mask quality inspection program is executed by the processor, it implements the mask quality inspection method as described in any one of claims 1 to 7.
10. A storage medium, characterized in that, The storage medium stores a mask quality detection program, which, when executed by a processor, implements the mask quality detection method as described in any one of claims 1 to 7.
