Monocrystal material surface defect intelligent identification method

By embedding an attention module and optimizing training parameters in the YOLOv5s model, the problem of high false positive and false negative rates of defects in single crystal material detection was solved. This enabled efficient multi-scale defect feature extraction and accurate classification on resource-constrained equipment, improving detection accuracy and real-time performance.

CN121999283APending Publication Date: 2026-05-08SHENYANG INST OF ENG
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610062153.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-17
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing technologies suffer from high false alarm and false negative rates in single crystal material inspection. Furthermore, traditional visual inspection models struggle to efficiently extract and accurately classify multi-scale defect features on resource-constrained embedded devices. In particular, there is a trade-off between model inference speed and detection accuracy in real-time video stream processing.

Method used

Based on the YOLOv5s model, an attention module (Squeeze-and-Excitation, SE) is embedded, feature channel weights are adjusted, and an early stopping mechanism is set in combination with a dynamic learning rate and optimizer. A lightweight network architecture is constructed, and the multi-scale path insertion of the attention module is optimized to suppress background interference and improve detection accuracy and real-time performance.

Benefits of technology

It significantly improves the accuracy and generalization ability of surface defect detection in single crystal materials, is suitable for resource-constrained equipment, ensures production quality and efficiency, and enables real-time and accurate identification of various defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121999283A_ABST
    Figure CN121999283A_ABST
Patent Text Reader

Abstract

The invention provides a single crystal material surface defect intelligent identification method, which comprises the following steps: acquiring image data of a plurality of single crystal materials with defects on the surfaces to obtain a single crystal material image data set; the method comprises the following steps: establishing an initial YOLOv5s model on the basis of a YOLOv5s model, embedding an attention module into the initial YOLOv5s model, and adjusting a feature channel weight in training set data to obtain a YOLOv5s-SE model; the method comprises the following steps: selecting a YOLOv5s-SE model, performing learning training on the YOLOv5s-SE model to obtain a target detection model, detecting a video stream on the surface of a to-be-detected single crystal material through the target detection model, identifying a defect type and determining a defect position, selecting a lightweight network architecture, embedding an attention module, and dynamically adjusting a feature weight; the capability of detecting small, medium and large targets is improved; a dynamic learning rate and an optimizer are set to be combined with an early stop mechanism training model, real-time video stream processing and result display and storage are achieved, the detection precision real-time performance and generalization ability are remarkably improved, the method is suitable for resource-limited equipment, and production quality and efficiency are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of single crystal material testing technology, and in particular to an intelligent method for identifying surface defects in single crystal materials. Background Technology

[0002] Currently, defect detection of strontium titanate single crystals mostly relies on traditional manual visual inspection. Quality control engineers need to conduct frequent visual screenings in environments with strong light. Due to the unique optical reflection and refraction properties of single crystal materials, the false alarm and false negative rates of defects increase significantly when using traditional visual inspection methods on single crystal rods. As a result, crystal defects are only discovered during later crystal slicing, leading to increased labor costs and waste of crystal materials.

[0003] Therefore, a model capable of identifying defects in single crystals is needed. However, a unique and obscure technical problem arises for defect identification in complex industrial environments: how to efficiently extract and accurately classify multi-scale defect features on resource-constrained embedded devices while balancing real-time performance and detection accuracy. Specifically, single crystal materials exhibit diverse surface defect types, including microcracks, fine scratches, and large-area inclusions, with a wide range of defect sizes and complex background noise. Embedded devices typically face strict limitations in computing power and memory resources. In this context, traditional target detection models often struggle to handle multi-scale features and small target detection tasks simultaneously on low-power devices, especially in real-time video stream processing, where the conflict between model inference speed and detection accuracy is particularly pronounced. Furthermore, industrial cameras capture images under varying lighting conditions, resulting in significant differences in defect morphology and spatial distribution. Dynamically adjusting feature weights to suppress background interference and focus on key defect areas under limited resources becomes a pressing challenge. Summary of the Invention

[0004] This invention provides a method for intelligent identification of surface defects in single-crystal materials. Mainly includes: Multiple images of single-crystal materials with surface defects were collected to obtain a single-crystal material image dataset; Defect regions in each single-crystal material image data are labeled and assigned defect category labels to obtain training set data. The defect category labels include: defect geometric shape features and spatial distribution data. An initial YOLOv5s model is built based on the YOLOv5s model, and an attention module is embedded in the initial YOLOv5s model. The feature channel weights in the training set data are adjusted to obtain the YOLOv5s-SE model. The YOLOv5s-SE model is trained by setting training parameters and training set data to obtain a target detection model. This model is then used to detect video streams on the surface of the single crystal material to be detected, identify defect types, and determine defect locations.

[0005] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects: This invention discloses a method for detecting surface defects in single-crystal materials, addressing the challenge of accurately identifying various defects such as cracks, scratches, and inclusions in real-time during industrial production. This problem stems from the logically related challenge of low detection accuracy and weak generalization ability due to the diversity and insufficient realism of defects in complex environments. This invention acquires a high-quality image dataset containing multiple defect types and proportionally divides it into training, validation, and test sets. Manually labeled bounding boxes and category labels ensure accurate and diverse data. A lightweight network architecture with an embedded attention module dynamically adjusts feature weights, improving the detection capability for small, medium, and large-sized targets. A dynamic learning rate and optimizer combined with an early stopping mechanism are used to train the model, enabling real-time video stream processing and result display and storage. A confusion matrix is ​​constructed to calculate precision, recall, and average precision, quantifying performance. Simultaneously, the dataset is adjusted to balance category distribution, and multi-scale paths are optimized by inserting an attention module to suppress interference. This invention significantly improves detection accuracy, real-time performance, and generalization ability, making it suitable for resource-constrained equipment and ensuring production quality and efficiency. Attached Figure Description

[0006] Figure 1 This is a flowchart of the intelligent identification method for surface defects of single crystal materials according to the present invention; Figure 2 This is a flowchart of the model detection process for the intelligent identification method for surface defects in single crystal materials according to the present invention. Figure 3 This is a schematic diagram of the intelligent identification method for surface defects in single crystal materials according to the present invention.

[0007] Figure 4 This is another schematic diagram of the intelligent identification method for surface defects of single crystal materials according to the present invention. Detailed Implementation

[0008] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0009] like Figure 1-4 This embodiment provides a method for intelligent identification of surface defects in single-crystal materials, which may specifically include: Step S101: Collect image data of multiple single crystal materials with surface defects to obtain a single crystal material image dataset; A dataset of images of the surface of single-crystal materials was acquired. The dataset contained images of various defect types. The images were acquired using industrial cameras and light sources, and combined with images of actual production defects to ensure diversity and authenticity.

[0010] Preferably, the present invention can further divide the dataset into a training set, a validation set, and a test set according to a preset ratio, wherein the training set is used for model learning, the validation set is used for parameter tuning, and the test set is used for performance evaluation.

[0011] Specifically, in one implementation, a dataset of images of the surface of a single-crystal material is first acquired. This dataset contains images of various defect types, such as cracks, impurity particles, and surface scratches. These images are acquired using industrial cameras and light sources. The industrial cameras employ high-resolution sensors to capture fine surface details, while the light sources use uniform illumination equipment to avoid shadow interference, thereby ensuring image clarity. Furthermore, images of actual production defects, such as real samples collected from semiconductor wafer production lines, are combined to enhance the diversity and realism of the dataset. This combination can include selecting images from different production batches to ensure coverage of defect behavior under various environmental conditions, thus providing a comprehensive data foundation for subsequent model training. This process helps simulate real industrial scenarios and improves the representativeness of the dataset.

[0012] Preferably, when acquiring images, the angle and intensity of the light source can be adjusted, for example, by using a ring-shaped LED light source to illuminate the surface of the monocrystalline silicon material to highlight the texture features of defects.

[0013] It should be noted that surface defects in single-crystal materials such as silicon or gallium arsenide often originate from the growth or processing stages. During image acquisition, camera parameters, such as exposure time, must be controlled within the range of 0.1 to 1 second to obtain high-contrast images. This approach ensures the diversity of the dataset, including image samples with varying defect densities, thus supporting the model's learning of multiple defect types. The dataset is divided into training, validation, and test sets according to a preset ratio, for example, an 8:1:1 ratio. The training set is used for the model to learn basic patterns, the validation set is used for parameter tuning to optimize performance, and the test set is used for final performance evaluation. This division ensures balanced model training and avoids overfitting.

[0014] Further preferably, the training set is segmented for the single crystal material surface image dataset to ensure that it contains diverse defect types in order to improve the model's generalization ability. The hyperparameters are adjusted during training using the validation set, and the final model performance is independently evaluated using the test set. The dataset segmentation is adjusted to balance the sample distribution of each defect category to address the class imbalance problem.

[0015] An initial sample distribution is obtained from the defect image set. Given the diversity of defect types, the degree of class imbalance is determined, resulting in an imbalanced class list. The training set segmentation is adjusted based on this list, and a synthetic minority class oversampling technique is used to increase the number of samples for a minority defect type, resulting in a balanced training set. A validation set is constructed using the balanced training set for adjustment. Iterative parameter values ​​are obtained for hyperparameter optimization, determining the optimal hyperparameter set. This optimized hyperparameter set is then applied to the test set for evaluation. Performance metrics are calculated independently to obtain the defect class distribution results.

[0016] Specifically, in one implementation, for the process of segmenting the dataset, video stream samples of surface defects of single crystal materials are first collected, for example, labeled image sequences obtained from a silicon wafer production line.

[0017] Specifically, this segmentation ensures the training set includes diverse defect types, such as cracks, scratches, and inclusions, to improve the model's generalization ability. By counting the number of samples for each defect type and prioritizing instances appearing under different lighting and angles in the training set, the model achieves robust identification of unknown defects. In the business scenario of single-crystal ceramic substrate inspection, this method involves manually or automatically labeling video frames to ensure the training set covers at least 80% of defect variations, thereby supporting the model's adaptability to actual production lines.

[0018] Understandably, this diversity selection is based on the statistical distribution of defect features to avoid bias in the model towards common types. Furthermore, a validation set is used to tune hyperparameters such as the learning rate and batch size during training.

[0019] Specifically, during training iterations, these parameters are progressively optimized by monitoring the loss function values ​​on the validation set to minimize the risk of overfitting. In the context of single-crystal diamond surface defect detection, the validation set, drawn from 20% of the total dataset and containing mixed defect samples, is used to adjust the model architecture parameters in real time. This adjustment process involves multiple training loops, evaluating the validation set performance after each loop, and modifying the hyperparameter values ​​based on the results to ensure model convergence and stability.

[0020] It should be noted that this independent verification helps to refine the model without touching the test set, making it suitable for resource-constrained industrial embedded systems.

[0021] Preferably, the performance of the final model is evaluated independently using a test set that is separated from the remaining data and does not participate in any training or tuning phases.

[0022] For example, in single-crystal silicon wafer video stream processing, the test set includes unseen defect instances used to calculate accuracy and F1 scores, thus objectively measuring the model's performance in real-world deployments. This independent evaluation confirms the model's reliability in complex contexts, supporting subsequent optimization decisions.

[0023] In one possible implementation, the dataset split is adjusted to address the class imbalance problem in order to balance the sample distribution of each defect category.

[0024] Specifically, if crack samples far outnumber inclusions, samples are redistributed to the training, validation, and test sets using either oversampling of the minority class or undersampling of the majority class. In the inspection of single-crystal materials such as photovoltaic silicon wafers, this adjustment involves calculating the sample proportion for each class and applying random resampling techniques to ensure that the distribution of each defect type in the training set is nearly uniform, thereby reducing the model's bias towards the majority class.

[0025] For example, in a production line monitoring scenario, the class ratio of the adjusted training set is controlled at approximately 1:1 to avoid a drop in recall for rare defects. This balancing process is extracted directly from the original video stream data, supporting the model's fair learning of all defects. Further, this adjustment method can be combined with weight allocation to assign higher weights to the minority class in the loss function. In an embodiment for defect identification in single-crystal ceramic materials, by analyzing the distribution statistics of the initial dataset, imbalanced classes are first identified, and then synthetic sample generation techniques such as SMOTE are applied to augment the minority class samples, ensuring that the segmented subsets remain balanced.

[0026] Understandably, this strategy enhances the model's generalization ability in multi-defect environments, enabling more comprehensive surface quality control in practical applications.

[0027] Step S102: Label the defect regions of each single crystal material image data, assign defect category labels, and obtain training set data; 2.1 Import the image of the single crystal material using the annotation tool; 2.2 Manually draw a rectangle to cover the defect area in the single crystal material image; 2.3. Based on the defect type, assign a corresponding defect category label to each rectangle, record the geometric shape characteristics and spatial distribution data of the defect, and generate a labeling file; Specifically, it includes: Manually draw rectangular boxes to cover the defect area, assign a corresponding defect category label to each rectangle, ensure accurate labeling, record the geometric shape and spatial distribution of the defects, and save the labeled data in a preset format for subsequent model training.

[0028] 2.4. Convert the annotation file into a preset format and store it in a specified path for the model to read during training.

[0029] In one possible implementation, the images are imported using an annotation tool, such as open-source annotation software like LabelImg, to batch import the acquired image files. Rectangular bounding boxes are manually drawn to cover the defect area; for example, for a crack defect, a rectangle is stretched from the start point to the end point to completely enclose its outline. Each rectangle is assigned a corresponding defect category label, such as "crack" or "impurity," to ensure accurate annotation. This process records the defect geometry, such as the length and width ratio of the crack, morphological features such as branching structures or irregular edges, and spatial distribution, such as whether the defect is concentrated in a region on the material surface or uniformly distributed. This recording allows for the generation of additional metadata files describing the coordinate location and distribution density of the defects, thus providing richer input information for the model.

[0030] Specifically, the defect category label includes: a basic defect type label, and metadata associated with the basic defect type label; the metadata includes: the defect's geometric shape parameters, morphological descriptors, and spatial distribution indicators; wherein, the geometric shape parameters include the aspect ratio of the defect's bounding rectangle; the morphological descriptors include the roundness or rectangularity of the defect region; and the spatial distribution indicators include the coordinates of the defect's center point in the image. Recording the geometric shape morphological features and spatial distribution data of defects involves a detailed analysis process. First, the geometric shape refers to the defect's shape parameters, such as the linear extension of a crack or the circular outline of an impurity, calculated by measuring the pixel dimensions within the bounding rectangle; for example, the length-to-width ratio is used to distinguish between slender cracks and blocky impurities. Morphological features examine the texture details of the defect, such as the depth of surface scratches or the roughness of particles, which are observed by magnifying the image and manually labeled. Spatial distribution analysis examines the positional relationship of defects throughout the image, such as calculating the distance and clustering degree between multiple defects; if defects are concentrated at the material edge, they are recorded as an edge distribution pattern; if they are uniformly scattered, they are labeled as a random distribution. This analysis process helps identify the causes of defects, such as edge cracks caused by stress concentration during the production process, thereby enhancing the practical value of the labeled data. In practice, annotators can use the tool's measurement function to quantify these features one by one, ensuring that the annotation time for each image is controlled within 5 minutes to improve efficiency. Detailed documentation of this step can provide accurate supervision signals for model training, achieving higher defect detection accuracy.

[0031] For example, when processing gallium arsenide single crystal materials, the annotation process can specifically record its unique defects such as lattice dislocations. Geometric features focus on the curvature of the dislocation lines, morphological characteristics include the appearance of crystal fractures, and spatial distribution analyzes the grid pattern of dislocations on crystal surfaces. This example demonstrates the versatility of the annotation method, applicable to different single crystal types. Furthermore, the annotated data is saved in a preset format, such as XML or JSON, storing the bounding box coordinates, category labels, and recorded feature information together. This format facilitates subsequent model training, for example, by directly importing it as input into deep learning frameworks. In another embodiment, for large-scale datasets, the segmentation ratio can be adjusted to 7:2:1 to adapt to scenarios with large data volumes, ensuring that the validation set has sufficient samples for parameter tuning.

[0032] Understandably, through the above steps, the entire dataset preparation process forms a complete chain, from acquisition to storage, supporting the development of defect detection models for single-crystal materials.

[0033] In one embodiment, when incorporating actual production images, samples can be collected from multiple factories to further enhance realism, such as including defect images from high-temperature growth environments.

[0034] Step S103: Based on the YOLOv5s model, an initial YOLOv5s model is established, and an attention module is embedded in the initial YOLOv5s model. The feature channel weights in the training set data are adjusted to obtain the YOLOv5s-SE model. Specifically, it includes: 2.1 Select the YOLOv5s model as the base layer structure and embed attention modules (Squeeze-and-Excitation, SE) in specific parts. Specifically, embedding the attention module in a specific part includes: The hierarchical positions are obtained from the multi-scale output path, processed by a convolutional neural network, and output position coordinates to determine the position of the medium target detection branch. An attention module is inserted into the medium-sized target detection branch to generate a medium-sized target representation; The attention module is inserted into the small target detection branch to enhance fine-grained feature focusing; The attention module is inserted into the large target detection branch to enhance the perception of targets over a wide area. The attention module is inserted into the backbone feature expression layer, and background interference is suppressed by dynamic weight adjustment, thereby improving the overall detection performance.

[0035] In the YOLOv5 architecture, the SE module is inserted into the three multi-scale output paths of the Neck section, specifically at the following locations: Layer 23: Corresponds to the medium-sized target detection branch (P4 path), which improves the ability to represent medium-sized targets.

[0036] Layer 19: Corresponds to the small object detection branch (P3 path), used to enhance the model's ability to focus on fine-grained features.

[0037] Layer 27: Corresponds to the large target detection branch (P5 path), which enhances the perception of large-scale targets.

[0038] Layer 14: Further enhances the feature representation capabilities of the model backbone, improving overall detection performance.

[0039] The attention module is inserted into the multi-scale output path, corresponding to different size target detection branches, to improve the processing ability of small-sized targets and complex backgrounds, optimize the structure of the basic network architecture, and make the attention mechanism enhance the target detection model's attention to key features and improve detection accuracy.

[0040] 2.2. Global average pooling is performed through the attention module to compress channel features into scalars. The channel features are then input into the fully connected layer to generate channel attention weights. The feature distribution is adjusted to enhance the response of important feature channels, thus obtaining the YOLOv5s-SE model.

[0041] The improved YOLOv5-SE model surpasses the original YOLOv5 model in all the aforementioned metrics. The performance improvement is particularly significant when detecting small targets and processing complex background images. This is mainly due to the inclusion of an attention mechanism. The SE module dynamically adjusts channel weights, enhancing the detector's ability to focus on key features. Furthermore, it strengthens the model's feature representation of target regions and effectively reduces false positives and false negatives.

[0042] The above steps obtain the basic layer structure from a preset lightweight network architecture, embed an attention module to adjust channel weights, and compress the two-dimensional spatial features of each channel into a scalar through global average pooling to obtain a channel-level global feature description. For the obtained global feature description, a nonlinear transformation is performed on the fully connected layer to generate channel attention weights. These weights are used to enhance the response of important feature channels, determining the adjusted feature distribution. Based on the determined adjusted feature distribution, an attention module is inserted into the multi-scale output path, corresponding to different size target detection branches, to obtain enhanced small-size target processing capabilities. Using the obtained enhanced small-size target processing capabilities, the basic network architecture structure is optimized, complex background adaptation attributes are fused, and if background interference exceeds a preset threshold, the branch weights are dynamically adjusted to obtain an optimized detection framework. Background interference is obtained by calculating the noise intensity of non-defect regions in the feature distribution. Key features are extracted from the obtained optimized detection framework, combined with detection accuracy optimization attributes, and defect location information for the surface of single-crystal materials is output, forming defect spatial distribution data.

[0043] Specifically, in one implementation, a lightweight basic network architecture is selected as the foundation of the object detection model, such as the MobileNet series. Its characteristic is the use of depthwise separable convolutions to reduce the number of parameters and computational complexity, making it suitable for real-time applications of single-crystal material surface defect detection. Based on this, attention modules are embedded in specific parts of the network. These modules dynamically adjust the feature channel weights to highlight defect-related features, for example, by inserting them after convolutional layers to capture texture information of defects such as scratches or bubbles. This embedding method ensures that the model prioritizes key channels when processing industrial images, avoiding interference from irrelevant backgrounds. Furthermore, global average pooling is used to compress the two-dimensional spatial features of each channel into scalars, forming a channel-level global feature description.

[0044] Specifically, global average pooling averages the feature map in the height and width dimensions, thereby converting the two-dimensional features of each channel into a scalar value. This process can be understood as summarizing the overall information of the channel. For example, in a single crystal material surface image, averaging the pixel values ​​of a channel yields a description representing the global intensity of that channel, thus providing a basis for subsequent weight calculations.

[0045] In one possible implementation, the compressed global feature description is input into a fully connected layer. After a non-linear transformation, channel attention weights are generated to adjust the importance distribution of each channel and enhance the response of important feature channels. The fully connected layer first maps scalar values ​​to a low-dimensional space, then applies the ReLU activation function for a non-linear transformation, maps back to the original channel dimension, and normalizes the weights using the Sigmoid function. These weights, ranging from 0 to 1, are used to multiply the original feature channels. For example, in defect detection, if a channel captures the edge information of a crack, its weight is amplified, thus strengthening the model's response to such features, while the weights of irrelevant channels are suppressed to optimize the overall feature representation.

[0046] Preferably, the attention module is inserted into the multi-scale output path, corresponding to different size target detection branches to improve the processing capability for small targets and complex backgrounds. In the target detection model, the multi-scale output path typically includes multiple detection heads, each responsible for targets within a specific scale range. For example, a low-resolution path detects large defects such as large-area contamination, while a high-resolution path detects small defects such as microbubbles. The attention module is inserted at the end of each path, adjusting channel weights to enhance robustness to complex backgrounds. For instance, on a single-crystal material production line, the background may contain variations in light and shadow; the module dynamically strengthens the defect channel to improve the detection accuracy of small targets.

[0047] In one embodiment, the structure of the basic network architecture is optimized so that the attention mechanism enhances the target detection model's focus on key features and improves detection accuracy. Specifically, the process includes adjusting the position of the attention module, for example, placing it between the middle and output layers of the network, and fine-tuning the weights using a gradient descent optimization algorithm. In the single-crystal material surface defect detection task, a pre-trained MobileNet model is first loaded, and then the attention module is embedded in the C3 and C4 stages of the backbone network. Weights are generated by calculating channel statistics and applied to the feature map. This optimization enables the model to more effectively focus on geometric shape and spatial distribution features when processing images containing multiple defect types. For example, for scratch defects, its linear texture channel response is enhanced, thereby achieving higher average accuracy on the test set while maintaining computational efficiency suitable for industrial deployment.

[0048] It should be noted that in practical applications, the parameters of the attention module can be adjusted according to the type of single crystal material. For example, for silicon-based materials, the weight preference for high-frequency texture channels can be increased to better handle microscopic defects in the crystal growth process.

[0049] Specifically, in another implementation, the multi-scale path is further optimized by taking into account the characteristics of the dataset. For example, a feature pyramid network is used as an extension, and attention modules are applied to each level of the pyramid to detect branches of different defect sizes, thereby ensuring that the model maintains stable performance in complex production environments.

[0050] Understandably, the embedding of this attention mechanism is not limited to a single network architecture. For example, it can be extended to the EfficientDet model, which also strengthens the attention to defects in single crystal surface images by generating weights through global average pooling and fully connected layers.

[0051] In one embodiment, the optimization effect is verified through simulation experiments. For example, the optimized model is applied to single-crystal images acquired in the laboratory, and an improvement in the detection recall rate for small-sized bubbles is observed without introducing additional computational overhead.

[0052] Step S104: Set training parameters, and train the YOLOv5s-SE model according to the training parameters and training set data to obtain a target detection model, so that the video stream on the surface of the single crystal material to be detected can be detected through the target detection model, the defect type can be identified and the defect location can be determined.

[0053] The training parameters include: learning rate, optimizer, and batch size.

[0054] The setting of training parameters specifically includes: 3.1 Set up a dynamic learning rate scheduling strategy and calculate the learning rate using the cosine annealing formula; The learning rate is one of the most important hyperparameters during training. An excessively high learning rate can lead to model oscillations or even divergence, while an excessively low learning rate can result in slow convergence or even getting stuck in local optima. This invention employs a cosine annealing formula for learning rate scheduling, as shown in Equation 1. A large initial learning rate (e.g., 0.01) is set at the beginning of training, and then gradually decays to a lower learning rate (e.g., 0.0001). This dynamic adjustment method can accelerate early convergence while improving the stability of later training stages.

[0055] The setting of the dynamic learning rate scheduling strategy, which calculates the learning rate using the cosine annealing formula, specifically includes: (1) in The learning rate is... The minimum learning rate is given by t, where t is the current round and T is the total number of rounds.

[0056] 3.2 Select an optimizer, combine the adaptive learning rate mechanism and weight decay strategy, determine the batch size, and calculate gradient updates; The optimizer determines how the model's parameters are updated. YOLOv5 uses the AdamW optimizer, which combines Adam's adaptive learning rate mechanism with a weight decay strategy to effectively prevent overfitting. This invention also uses the AdamW optimizer and sets the weight decay coefficient to 0.0005 to further suppress the model's overfitting tendency in complex contexts.

[0057] 3.3 Monitor the loss function, process the localization loss, classification loss and confidence loss, and adjust the training progress.

[0058] Batch size refers to the amount of data input to the model in each iteration. A larger batch size helps the model obtain more stable gradient updates, but requires more GPU memory resources, while a smaller batch size may lead to training instability. Considering the diversity of defective images and GPU memory limitations in this task, this invention sets the batch size to 16, which improves the model's ability to learn data distribution while ensuring training stability.

[0059] For the learning rate, the Adam optimizer is selected, combining an adaptive learning rate mechanism and a weight decay strategy. The weight decay coefficient is added to the loss function through a regularization term to determine the optimizer parameters. Based on the optimizer parameters, the batch size is determined to be a preset value, and batch samples are extracted from the training data to calculate gradient updates. Through the gradient updates, the loss function is monitored, including localization loss, classification loss, and confidence loss. The localization loss is calculated by the intersection-union ratio (IU) of the predicted bounding box and the ground truth bounding box. The classification loss measures the difference between the class labels using cross-entropy. The confidence loss is obtained by processing whether the predicted bounding box contains an object using binary cross-entropy to obtain the total loss value. If the total loss value does not improve within a preset number of consecutive rounds of validation set performance metrics, an early stopping mechanism is introduced to stop training and obtain training progress.

[0060] Specifically, in one implementation, when setting the dynamic learning rate scheduling strategy, the initial learning rate is first determined to be a relatively large preset value, such as 0.01, to ensure rapid updates of model parameters in the early stages of training. The minimum learning rate is then set to a relatively small preset value, such as 0.0001, for later stable convergence. The current epoch represents the training progress, and the total number of epochs represents the total training duration, for example, a total of 100 epochs. The learning rate is calculated using the cosine annealing formula, which simulates the smooth decay process from the initial value to the minimum value based on the cosine function.

[0061] Specifically, the cosine annealing mechanism utilizes the properties of the cosine curve to gradually decrease the learning rate during training, avoiding oscillations caused by sudden changes, thereby accelerating model convergence and improving training stability. In practical object detection model training, this strategy is applied to image processing tasks to help the model better adapt to changes in data distribution. Furthermore, when selecting an optimizer, an adaptive learning rate mechanism and a weight decay strategy are combined, such as using the Adam optimizer. This optimizer dynamically adjusts the learning rate of each parameter by calculating the first and second moments of the gradient. The adaptive mechanism ensures that different parameters obtain appropriate update step sizes based on their gradient history, while the weight decay strategy prevents excessive model weights from leading to overfitting by adding an L2 regularization term. A preset weight decay coefficient, such as 0.0005, is set and periodically applied to the loss function during training to balance the model's generalization ability. In object detection scenarios, this combined optimizer is used to handle complex image data and improve the model's sensitivity to object boundaries. A preset batch size, such as 32, is determined to balance the stability of gradient updates and memory consumption.

[0062] Specifically, a batch size that is too small may increase gradient noise, affecting convergence; while a batch size that is too large will consume excessive GPU memory, limiting model size. Through experimental adjustments, this value ensures efficient operation in a standard GPU environment and maintains training efficiency in image detection tasks. The monitoring loss function includes localization loss, classification loss, and confidence loss. The localization loss calculates the difference between the predicted bounding box and the ground truth bounding box. For example, it measures the positional deviation by calculating the mean square error of the bounding box coordinates. This process involves extracting the center point, width, and height of the predicted bounding box, comparing it with the labeled bounding box, and quantifying the offset to optimize boundary accuracy. The classification loss measures the difference between class labels, typically using a cross-entropy function to evaluate the difference between the predicted probability and the ground truth label, helping the model distinguish different object categories. The confidence loss handles whether the predicted bounding box contains an object. It calculates the difference between the confidence score and the true presence using binary cross-entropy, ensuring that the model accurately determines whether there is a target object within the bounding box. These loss functions are jointly optimized during object detection training. For example, when processing traffic monitoring images, the localization loss focuses on vehicle boundaries, the classification loss identifies vehicle models, and the confidence loss filters background noise, thereby improving overall detection accuracy. This multi-loss monitoring mechanism forms a total loss through weighted summation, which guides the gradient descent process and enables the model to be robust in complex scenarios.

[0063] Preferably, an early stopping mechanism is introduced, whereby training is stopped when the performance metrics of the validation set, such as average accuracy, do not improve within a preset number of consecutive rounds.

[0064] For example, a threshold of 5 consecutive rounds is set to monitor changes in metrics on the validation set; if no improvement is observed, the process terminates to avoid overfitting. In image detection applications, this mechanism ensures efficient resource utilization. In another implementation, for learning rate scheduling, the total number of rounds can be adjusted to 200, with an initial learning rate of 0.005 and a minimum of 0.00005. The cosine annealing formula further refines the decay period, for example, with a full cosine period every 50 rounds, to accommodate longer training processes. This variant enhances stability when handling large-scale datasets.

[0065] For example, the optimizer can be replaced with the AdamW variant, which further separates the weight decay from the adaptive mechanism, with a coefficient set to 0.001 to prevent weight explosion in high-resolution image detection.

[0066] It should be noted that the batch size can be adjusted to 64 depending on the hardware, enabling parallel processing in a multi-GPU environment and balancing the computational load.

[0067] Specifically, in loss function monitoring, the localization loss can be expanded into a smoothed L1 loss to reduce the impact of outliers. For example, when the difference is small, the squared error is used, and when it is large, it is converted to linear loss, which is suitable for outdoor detection scenarios with high noise.

[0068] Understandably, the early stopping mechanism, combined with a patience parameter set to 3 rounds, enables rapid response performance plateau in training on small datasets, thereby improving development efficiency.

[0069] In addition, the YOLOv5s-SE model is trained based on the training parameters and training set data to obtain a target detection model. This model is then used to detect video streams on the surface of the single crystal material to be inspected, identify defect types, and determine defect locations. Specifically, this includes: 4.1. Acquire a video stream of the surface of a single crystal material using a camera, extract the image to be detected from the video stream, and input it into the target detection model; A video stream is captured from the surface of a single-crystal material using a camera, and an image frame sequence is obtained from the video stream. The image frame sequence is processed using a YOLO model, where the YOLO model takes the image frame sequence as input and outputs defect type and defect location. The model identifies the defect type and determines the defect location, resulting in a defect classification result. Based on the defect classification result, cracks, scratches, and inclusions are further differentiated in complex environments to determine the severity of the defects. The severity of the defects is displayed in real-time through a user interface and transmitted to a storage device for subsequent analysis.

[0070] 4.2 The target detection model identifies and detects defective regions in the image to be detected; 4.3 After classifying defects in the defect area by type, identifying crack details, and recognizing scratches and inclusions, the defect classification results are determined. A video stream is captured from the surface of a single crystal material using a camera and transmitted to a detection system. The target detection model is then applied to process the images in the video stream to identify the defect type and determine the defect location. The processing is specifically designed for defects in complex environments, such as cracks, scratches, and inclusions. The identification results are displayed in real time on the user interface, and the detection results are stored in a storage device for subsequent analysis.

[0071] 4.4 The defect classification results are transmitted to the user interface for real-time display, and the defect classification results are stored in the storage device for subsequent analysis.

[0072] Specifically, in one implementation, video streaming of the single-crystal material surface is captured using an industrial camera mounted above the production line. This camera typically employs a high-resolution sensor to capture clear images of the surface, ensuring the accuracy of subsequent processing. The acquisition process is performed in real time; for example, a camera can be placed near the single-crystal growth furnace to monitor dynamic changes on the material surface. The acquired video stream is transmitted to a detection system via wired or wireless network, which can be a computer-based processing platform.

[0073] It should be noted that this transmission must ensure low latency to support real-time analysis and avoid data loss.

[0074] Specifically, the video stream resolution can be set to 1920x1080 pixels with a frame rate of 30 frames per second, thus adapting to the production environment of single-crystal materials. Furthermore, the application of an object detection model is central to the entire process. This model is a deep learning-based neural network framework, such as the YOLO series or Faster R-CNN architecture, used to process images in the video stream.

[0075] For example, the object detection model first preprocesses the input image, including denoising and contrast enhancement, to handle complex environments such as uneven lighting or dust interference. The model works by extracting image features through convolutional layers, which capture the edges, textures, and color differences of defects.

[0076] For example, for crack defects, the model learns the morphological features of their linear extension; for scratches, it focuses on the irregular linear traces on the surface; and for inclusions, it identifies the clustered distribution of heterogeneous particles. During the training phase, the model uses a labeled dataset containing defect samples from the surfaces of various single-crystal materials, and optimizes parameters through a backpropagation algorithm to improve recognition accuracy in noisy environments. This approach addresses defects in complex environments, ensuring the model can distinguish subtle differences, such as the boundary between cracks and natural textures.

[0077] In one embodiment, the model's output includes a bounding box and classification label for the defect. The defect location is determined by pixel coordinates, such as the start and end coordinates of a crack, thus achieving precise localization. The entire processing is executed in real time within the detection system, with the processing time per frame controlled within 50 milliseconds to match the frame rate of the video stream.

[0078] Preferably, the model employs a multi-scale feature fusion strategy when identifying defect types.

[0079] Specifically, the strategy involves merging convolutional features from different levels to capture defect details from macro to micro.

[0080] For example, in the surface inspection of single-crystal silicon materials, macroscopic features are used to identify large-area inclusions, while microscopic features are used to locate fine scratches. This fusion is achieved through upsampling and connection operations, improving the model's adaptability to complex environments.

[0081] Understandably, if the ambient lighting changes drastically, the model can integrate an attention mechanism to emphasize the features of key areas, thereby reducing the false detection rate.

[0082] In one possible implementation, for crack defect identification, the model first extracts edge features, calculates gradients using the Sobel operator, and then inputs the gradients into a classifier to determine the type. For scratches, depth information is considered, analyzed through shadow difference analysis. For inclusions, regional density is calculated to identify the foreign matter. This detailed process ensures the effective application of the model in the production of single-crystal materials such as photovoltaic silicon wafers. Based on the above model processing, the identification results are further displayed in real time on the user interface. The user interface can be a graphical software interface, such as a display panel developed based on the Qt framework, which renders a video stream in real time and overlays defect markers, such as marking the crack location with a red box. The display process is synchronized, ensuring that the user can instantly observe the defect type and location information.

[0083] For example, in the testing of single-crystal diamond materials, the interface displays the coordinates and severity labels of cracks. When storing test results, the identified data is saved to a local hard drive or cloud storage device. The storage format can be JSON, containing the defect type, location coordinates, and timestamp for subsequent analysis. This storage supports data backtracking, such as for defect statistics in quality control.

[0084] For example, in another embodiment, for a production line of single-crystal semiconductor materials, after the camera captures the video stream, the target detection model integrates a transfer learning strategy.

[0085] Specifically, this strategy transfers knowledge from a pre-trained model to adapt to the identification of specific defects such as minute inclusions. Through fine-tuning with a small number of samples, the model converges quickly, improving efficiency. In complex environments, such as detection inside a high-temperature furnace, the model adjusts the normalization parameters of the input image to counteract thermal radiation interference, thereby accurately determining the defect location. Further extending this approach, in one implementation, the model's defect location determination involves coordinate transformation.

[0086] For example, image coordinates can be converted into physical coordinates of the material surface, and the actual location, such as crack length in millimeters, can be calculated using camera calibration parameters. This transformation is achieved through a perspective projection matrix, ensuring the usability of the location information.

[0087] Preferably, the real-time display also includes an alarm function. When a serious defect such as a large crack is detected, a prompt appears on the interface, and the relevant frame image is automatically stored. This function enhances the interactivity of the system and helps to intervene in the production process in a timely manner, especially in single-crystal material processing scenarios. In subsequent analysis, the stored data can be used to statistically analyze defect distribution, such as calculating the frequency of occurrence of a certain inclusion, thereby optimizing the material preparation process.

[0088] It should be noted that this analysis does not involve real-time processing, but is executed offline to generate a report.

[0089] For example, in an embodiment for detecting single-crystal ceramic materials, the model is specifically optimized for scratch defects by increasing the number of scratch variations in the training samples to improve robustness. The processing includes feature enhancement steps, such as smoothing the image using Gaussian filtering, followed by model classification, and finally, storing the results to support long-term quality tracking. This approach demonstrates the versatility of the technical solution within the same field and can improve defect detection accuracy.

[0090] Preferably, the present invention can also construct a confusion matrix to summarize the distribution of the true category and the predicted category, wherein the rows of the confusion matrix represent the true values ​​and the columns represent the predicted values, the precision is calculated as the proportion of the model's predicted positive samples that are actually correct, the recall is the proportion of all positive samples that are correctly identified, and the average precision is calculated as the area under the precision-recall curves at different confidence thresholds, wherein the calculation interpolates the recall to obtain the accurate result, the average precision and recall of the model before and after the improvement are compared to quantify the performance improvement, and the number of parameters and inference speed are analyzed to confirm the applicability of the object detection model on resource-constrained devices.

[0091] Image frame sequences are acquired from a video stream and processed using a YOLO model. The YOLO model is a target detection model that takes the image frame sequences as input and outputs defect type and location. Based on these results, a confusion matrix is ​​constructed to summarize the distribution of true and predicted defect categories. Precision is determined as the proportion of correctly predicted positive samples, and recall is determined as the proportion of correctly identified positive samples. For precision and recall, the average precision is calculated by interpolating the recall curve using the area under the precision-recall curve at different confidence thresholds. A linear interpolation method is used to connect recall points to smooth the curve and obtain the precision result. The average precision and recall are obtained, and the performance improvement of the model before and after improvement is compared. Simultaneously, the number of parameters (total model weights) and inference speed (processing time per frame) are analyzed to confirm the applicability of the target detection model on resource-constrained devices.

[0092] Specifically, the rows of this matrix correspond to the true defect categories, such as cracks, scratches, and inclusions, while the columns represent the predicted categories by the model. The distribution can be summarized by statistically analyzing the true labels and predicted results for each image frame in the test dataset.

[0093] For example, in a monocrystalline silicon wafer production environment, using labeled video stream samples, a matrix displays the model's accuracy in predicting cracks, as well as the error rate that might misclassify scratches as inclusions. This construction helps identify classification biases in the model under complex lighting conditions, ensuring that subsequent optimizations are targeted at specific defect types. Furthermore, when calculating precision, for defect instances predicted as positive samples by the model, the proportion of those that are actually correct is determined. In the business scenario of monocrystalline photovoltaic material inspection, this means calculating the ratio of actual cracks to the total number of predictions for regions predicted as cracks.

[0094] It should be noted that the precision calculation is based on the true positive and false positive values ​​in the confusion matrix, obtained through a simple ratio, thereby evaluating the predictive reliability of the model under noise interference. For example.

[0095] In one possible implementation, a video stream of a single-crystal diamond surface is processed, and precision reflects the model's ability to avoid misclassifying normal textures as defects. Recall is calculated by focusing on the proportion of all true positive samples correctly identified by the model. In defect detection of single-crystal materials such as ceramic substrates, this involves statistically analyzing true positives and false negatives to quantify the completeness of the model's capture of actual defects.

[0096] Preferably, in production line monitoring, a high recall rate indicates that the model can effectively identify subtle inclusions and avoid potential production quality issues. Calculating average precision involves plotting a precision-recall curve and calculating the area under the curve, where the recall rate is interpolated to obtain the precise result. In the complex environment of single-crystal material surface detection, this curve reflects the performance variation of the model at different confidence thresholds.

[0097] For defect identification in single-crystal semiconductor materials, after processing the video stream, the average precision calculation reveals the performance bottleneck under dust interference. Interpolation avoids the bias of local fluctuations on the overall evaluation, thus providing a reliable basis for model iteration. Further, this calculation principle lies in balancing precision and recall; for example, recall increases but precision decreases when the threshold is lowered, and the area under the curve quantifies this tradeoff. This method is particularly useful in real-time detection during single-crystal growth because it can handle dynamically changing defect features, such as crack propagation morphology. Through multi-threshold sampling, the average precision not only evaluates a single category but can also be extended to the mean calculation of multiple defect types, ensuring comprehensiveness in industrial applications. Based on the above indicators, the average precision, accuracy, and recall of the models before and after improvement are compared to quantify the performance improvement. In single-crystal material inspection systems, the indicators of the benchmark model are first collected, and then the optimized new model, such as one with feature fusion, is applied for the same test.

[0098] Specifically, in the scenario of a single-crystal silicon wafer production line, the comparison shows that the average accuracy after the improvement increased from 0.75 to 0.85, and the precision and recall rates were improved accordingly. This quantification is expressed as a difference or percentage to support decision-making.

[0099] In one possible implementation, the total number of weights and biases in the statistical model is analyzed when determining the number of parameters to assess its complexity. In edge device deployments for defect detection in single-crystal materials, such as models using the YOLO architecture, the number of parameters is kept to the millions to ensure minimal memory consumption. Analysis of inference speed measures the time it takes for the model to process a single frame of image, typically in milliseconds. On resource-constrained devices such as industrial embedded systems, this involves testing the video stream frame rate matching capability.

Claims

1. A method for intelligent identification of surface defects in single-crystal materials, characterized in that, The method includes: Multiple images of single-crystal materials with surface defects were collected to obtain a single-crystal material image dataset; The defect regions of each single-crystal material image data are labeled and assigned defect category labels to obtain training set data; An initial YOLOv5s model was built based on the YOLOv5s model, and an attention module was embedded into the initial YOLOv5s model. The feature channel weights in the training set data were adjusted to obtain the YOLOv5s-SE model. The YOLOv5s-SE model is trained by setting training parameters and training set data to obtain a target detection model. This model is then used to detect video streams on the surface of the single crystal material to be detected, identify defect types, and determine defect locations.

2. The intelligent identification method for surface defects of single crystal materials according to claim 1, characterized in that, The process of labeling the defect regions in each single-crystal material image data and assigning defect category labels to obtain training set data specifically includes: Import the image of the single crystal material using the annotation tool; Manually draw a rectangle to cover the defect area in the single crystal material image; Based on the defect type, assign a corresponding defect category label to each rectangle, record the geometric shape and spatial distribution data of the defect, and generate a labeling file; The annotation file is converted into a preset format and stored in a specified path for the model to read during training.

3. The intelligent identification method for surface defects of single crystal materials according to claim 1, characterized in that, The process of building an initial YOLOv5s model based on the YOLOv5s model, embedding an attention module into the initial YOLOv5s model, and adjusting the feature channel weights in the training set data to obtain the YOLOv5s-SE model specifically includes: The YOLOv5s model is selected as the base layer structure, and attention modules are embedded in specific parts. The YOLOv5s-SE model is obtained by performing global average pooling through the attention module to compress channel features into scalars, and then inputting the channel features into the fully connected layer to generate channel attention weights. The feature distribution is adjusted to enhance the response of important feature channels.

4. The intelligent identification method for surface defects of single crystal materials according to claim 3, characterized in that, The embedding of the attention module in a specific part specifically includes: The hierarchical positions are obtained from the multi-scale output path, processed by a convolutional neural network, and output position coordinates to determine the position of the medium target detection branch. An attention module is inserted into the medium-sized target detection branch to generate a medium-sized target representation; The attention module is inserted into the small target detection branch to enhance fine-grained feature focusing; The attention module is inserted into the large target detection branch to enhance the perception of targets over a wide area. The attention module is inserted into the backbone feature expression layer, and background interference is suppressed by dynamic weight adjustment, thereby improving the overall detection performance.

5. The intelligent identification method for surface defects of single crystal materials according to claim 3, characterized in that, The process of performing global average pooling through an attention module to compress channel features into scalars, inputting these channel features into a fully connected layer to generate channel attention weights, adjusting feature distribution, and strengthening the responses of important feature channels specifically includes: By using global average pooling, the two-dimensional spatial features of each channel are compressed into a scalar, forming a channel-level global feature description, thereby extracting the most representative information. The compressed global feature description is input into the fully connected layer and, after nonlinear transformation, channel attention weights are generated to adjust the importance distribution of each channel and enhance the response of important feature channels.

6. The intelligent identification method for surface defects of single crystal materials according to claim 1, characterized in that, The training parameters include: learning rate, optimizer, and batch size.

7. The intelligent identification method for surface defects of single crystal materials according to claim 6, characterized in that, The setting of training parameters specifically includes: Set a dynamic learning rate scheduling strategy and calculate the learning rate using the cosine annealing formula; The optimizer is selected by combining an adaptive learning rate mechanism and a weight decay strategy to determine the batch size and calculate gradient updates. Monitor the loss function, process the localization loss, classification loss, and confidence loss, and adjust the training progress.

8. The intelligent identification method for surface defects of single crystal materials according to claim 7, characterized in that, The setting of the dynamic learning rate scheduling strategy, which calculates the learning rate using the cosine annealing formula, specifically includes: (1) in The learning rate is... The minimum learning rate is given by t, where t is the current round and T is the total number of rounds.

9. The intelligent identification method for surface defects of single crystal materials according to claim 1, characterized in that, The process of detecting the video stream on the surface of the single crystal material to be detected using a target detection model, identifying defect types, and determining defect locations specifically includes: A video stream of the surface of a single crystal material is acquired by a camera, and the image to be detected is extracted from the video stream and input into the target detection model. The target detection model identifies and detects defective regions in the image to be detected; After classifying defects in the defect area by type, refining cracks, and identifying scratches and inclusions, the defect classification results are determined. The defect classification results are transmitted to the user interface for real-time display, and simultaneously stored in a storage device for subsequent analysis.