A surface defect detection method based on differentiable neural architecture search

By using a differentiable neural network structure search technique to generate the optimal sub-network architecture and train it, the problem of insufficient training samples in surface defect detection is solved, and the applicability and feature learning ability of the model are improved.

CN117173091BActive Publication Date: 2025-12-12HUNAN UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310733957.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-20
Publication Date
2025-12-12
Estimated Expiration
2043-06-20

AI Technical Summary

Technical Problem

In existing technologies, the network structure design of surface defect detection models is difficult to adapt to different detection scenarios, and the lack of training samples leads to insufficient feature learning capabilities.

Method used

We employ a differentiable neural network architecture search technique. By constructing a supernetwork and using gradient descent to jointly optimize the architecture parameters and network weights, we generate the optimal subnetwork architecture, stack them into a network for training and evaluation, and adjust the search space and algorithm to optimize the model.

Benefits of technology

It solves the problem of training sample shortage, improves feature learning ability, and is better applicable to different defect detection scenarios, thereby improving the detection performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117173091B_ABST
    Figure CN117173091B_ABST
Patent Text Reader

Abstract

The application discloses a surface defect detection method based on a differential neural architecture search, and the method comprises the following steps: collecting a plurality of neural network architecture basic components to obtain a search space, and generating a super network by sharing weights of all neural network architecture basic components in the search space; constructing a surface defect dataset; adopting a gradient descent method to jointly optimize architecture parameters and network internal weights to search an optimal subnetwork architecture cell from the super network; stacking the optimal subnetwork architecture cell into a network, training and evaluating the network by using the defect dataset, obtaining an optimal model, and completing a surface defect detection task in a specific scene; and the application uses a differential search technology to complete a key model design task in surface defect detection, thereby solving a key problem of a training sample shortage in the field of surface defect detection, and simultaneously having a stronger feature learning capability, and being better applicable to different defect detection scenes.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of surface defect detection in machine vision, and particularly relates to a surface defect detection method based on differentiable neural architecture search. BACKGROUND

[0002] Surface defect detection is a very important research content in the field of machine vision, which is a technology that uses machine vision equipment to acquire images to determine whether defects exist in the collected images, thereby replacing manual visual detection. In recent years, with the successful application of deep learning models represented by convolutional neural networks in many computer vision fields, many defect detection methods based on deep learning have been widely used in various industrial scenarios. Therefore, surface defect detection methods based on deep learning have very broad market application prospects and have become a research hotspot in the field of machine vision.

[0003] Neural network architecture search is a branch of deep learning, which is used to reduce the trial and error cost of manually designing network architecture, and automatically search for network architecture with better performance. Search space, search strategy and performance evaluation strategy are the most important three directions of neural network architecture search technology. Among them, the search space defines the basic unit or operation method of the network architecture, and the search strategy defines the specific implementation method of searching a complete sub-architecture from the search space. Finally, the evaluation strategy is responsible for scoring the final performance of the searched sub-architecture, and returns the score result to the search strategy to guide the next search process. Neural network architecture search technology has very broad application value and research significance, and has received extensive attention from researchers in recent years and has made certain research progress.

[0004] Around how to improve the search efficiency and how to find better structures, neural network architecture search can be divided into three methods: reinforcement learning, evolutionary algorithm and differentiable method. Because each structure needs to be retrained, the first two methods require extremely huge search resources, so the mainstream search algorithm at present is the differentiable method. The differentiable method needs to use the weight sharing mechanism to integrate all the structures in the search space, and then optimize the weight and structure parameters based on the gradient, and finally select the structure through the structure parameters.

[0005] Gradient-based optimization is the mainstream method used to solve the NAS problem in recent years, and its principle aims to change a discrete search target space into a continuous search target space, so that the objective function is differentiable, which can be searched and trained through gradient optimization. Google scholars proposed the DARTS method, which first used gradient optimization algorithm to solve the NAS problem, searched the cells in the repeatable block based on the cell search space, and then freely iterated to form a complete network structure.

[0006] In the current deep learning-based surface defect detection field, network structure design is a key problem. Different network structures are needed for different defect detection scenarios. These network structures are manually designed, and the process of designing and adjusting each layer of the model is long. Such networks are not necessarily optimal, and only these manually designed networks can roughly meet the needs of the current defect detection dataset. Similar to traditional manually designed defect detection features, the defect classification effect is much worse than the features learned by the convolutional neural network itself. At the same time, the small sample problem in surface defect detection also depends on reasonable network structure design. Through reasonable network structure design, the sample requirement can be greatly reduced. SUMMARY

[0007] The present application aims to overcome the shortcomings of the prior art and provide a surface defect detection method based on differentiable neural network structure search. The search of the key model in surface defect detection is completed using the differentiable neural network structure search technology, the problem of shortage of training samples is solved, and the method has stronger feature learning ability and can be better applied to different defect detection scenarios.

[0008] The purpose of the present application is achieved by the following technical solutions:

[0009] A surface defect detection method based on neural network structure search technology, comprising the following steps:

[0010] Step 1: Obtain a search space by assembling a plurality of neural network architecture basic components, and generate a super network from all neural network architecture basic components in the search space by weight sharing.

[0011] Step 2: Construct a surface defect dataset, train the super network in step 1 using the defect dataset, and jointly optimize the architecture parameters and network internal weights to generate the optimal subnetwork architecture cell from the super network using the gradient descent method.

[0012] Step 3: Stack the optimal subnetwork architecture cell searched in step 2 into a network, train and evaluate the network using the defect dataset. If the performance of the model is not as expected, the search space and search algorithm need to be adjusted and searched again. Finally, the model is used to complete the surface defect detection task in a specific scenario.

[0013] Specifically, step 1 specifically comprises the following substeps:

[0014] Step 11: The neural network architecture basic components to be searched include the topology between neural network nodes and the operation set between neural network nodes.

[0015] Step 12: Generate a super network by weight sharing of all neural network architecture basic components in the search space: in the traditional method, in order to find the best operation in the candidate operation set , a heuristic algorithm such as reinforcement learning or evolutionary algorithm is used to take a certain operation, that is, this selection is a discrete operation of this or that. This results in a large amount of calculation. The discrete operation is not easy to derive, so the concept of continuous relaxation is introduced to achieve the effect of weight sharing, so that the search space is differentiable, and the gradient descent method can be used for search.

[0016] Specifically, the step 11 includes the following steps:

[0017] Step 111: Topology between neural network nodes: the final network structure is stacked by the searched two different cells (normal cell and reduction cell) in a certain order. Each cell is a directed acyclic graph containing 7 nodes, each node represents a feature map x (i) in the convolutional network, and each edge e (i,j) represents the operation O (i,j) of transforming the feature map x (i) to the feature map x (j) , as follows:

[0018] x (j) =∑ i<j O (i,j) (x (i) )

[0019] Among the seven nodes, there are two input nodes (output from the previous cell), one output node, and four intermediate nodes, and the output node is connected by the four intermediate nodes, as shown in the attached drawing (3).

[0020] Step 112: Operation between neural network nodes refers to the calculation operation of connecting different layers in the neural network, and its purpose is to pass the input data from one layer to the next layer, and then complete the feature extraction and prediction task of the input data. Common neural network operations include convolution, pooling, full connection, activation function, etc.

[0021] Specifically, the step 12 includes the following steps:

[0022] Step 121: Specifically, in the search process, each operation of the candidate operation set actually processes the feature map of each node. Then, the weighted sum of the results obtained by all operations is calculated, that is,

[0023]

[0024] Wherein The meaning is: the operation O between the i-th feature map and the j-th feature map. (i,j) The weights, i.e., the architecture parameters that need to be searched later, for example, the weight of a certain operation. Therefore, it can be assumed that this operation is completely unnecessary for the entire network structure.

[0025] Step 122: To ensure that the output of all nodes is roughly stable, a Softmax operation is performed on the architectural parameters (i.e., the weights of the operations) between every two nodes.

[0026]

[0027] Therefore, if the weight of each operation is determined, then the final network architecture is also determined (by selecting the operation with the largest weight), so α can be called the network structure itself.

[0028] Specifically, step two includes the following sub-steps:

[0029] Step 21: Construct a surface defect dataset.

[0030] Step 22: Train the supernetwork using the defect dataset. Similar to the activation function based on reinforcement learning methods or the population fitness based on evolutionary algorithms, the optimization objective using gradient descent based on a differentiable search space is also a loss function on the validation set. Let the training loss and validation loss on the surface defect dataset be respectively... and The network's internal weights are ω, and the superscript * indicates that they are optimal. Therefore, our goal is to find a weight that, after training on the training set, is optimal (ω). * The architecture with the minimum loss on the validation set (α) * )

[0031] Step 23: Before judging the quality of each architecture, it must first converge on the training set, that is... The optimal internal weights of the network are inherently correlated with the architecture; changes in the architecture will lead to changes in the corresponding weights. This is essentially a two-level joint optimization problem with architecture α as the higher-level variable and weights ω as lower-level variables.

[0032]

[0033]

[0034] Specifically, step 21 includes the following steps:

[0035] Step 211: Determine the defect type: First, it is necessary to determine which defect types are included in the surface defect dataset to be constructed, such as cracks, bubbles, scratches, dents, etc.

[0036] Step 212: Collect sample images: Collect multiple images of surfaces containing defects, which can be taken using cameras, microscopes, etc. to ensure clear images and sufficient defects.

[0037] Step 213: Label defects: Use labeling tools to label defects in each image, which can be labeled using bounding boxes, polygons, etc.

[0038] Step 214: Defect segmentation: For some applications that require pixel-level analysis, such as defect area, defect perimeter, etc., the image needs to be segmented to separate the defect area.

[0039] Step 215: Data cleaning: For samples with inaccurate labeling or poor image quality, they need to be screened or relabeled to ensure the quality of the dataset.

[0040] Step 216: Data augmentation: Use data augmentation techniques such as rotation, flipping, scaling, etc. to generate more samples to increase the diversity and quantity of the dataset.

[0041] Step 217: Divide the dataset: Divide the dataset into training set, validation set and test set to train, validate and test the model.

[0042] Specifically, the step three includes the following sub-steps:

[0043] Step 31: Stack the cell structure searched in step two into a network.

[0044] Step 32: Model evaluation: Evaluate the stacked network model using the validation set and test set. Evaluation indicators can be accuracy, recall, precision, etc. If the performance of the model is not as expected, the search space and search algorithm need to be adjusted and searched again.

[0045] Step 33: Optimization and iteration: Adjust the search space according to the evaluation results of the model and search the cell structure again. This process may need to be iterated several times until the best model performance is obtained. During the search process, we can try different search algorithms, hyperparameter combinations and search strategies to obtain the best cell structure to stack into the optimal network model.

[0046] Specifically, the step 32 includes the following steps:

[0047] Step 321: Divide the training set into training set and validation set, with a ratio of 70% training set and 30% validation set.

[0048] Step 322: Train the stacked model on the training set and validate the model using the validation set. Calculate the loss function and metrics such as accuracy, recall, etc. of the model on the validation set.

[0049] Step 323: Adjust the search space and search algorithm based on the performance of the model on the validation set. For example, you can increase the size of the search space, modify the hyperparameters of the search algorithm, etc.

[0050] Step 324: Evaluate the final model using the test set. The test set is a dataset independent of the training set and validation set. Calculate the performance metrics of the model on the test set, such as accuracy, recall, etc. to evaluate the performance of the model in actual situations.

[0051] Step 325: If the performance of the model is not good, you can adjust the search space and search algorithm again based on the results of the test set, and search again. This process needs to be iterated several times until the best model performance is obtained.

[0052] Advantages of the present application:

[0053] A surface defect detection method based on differentiable neural network structure search is proposed, which uses differentiable search technology to complete the task of key model design in surface defect detection, thereby solving the key problem of shortage of training samples in the field of surface defect detection, and at the same time has stronger feature learning ability, which can be better applied to different defect detection scenes. BRIEF DESCRIPTION OF DRAWINGS

[0054] Figure 1 is an algorithm diagram of a neural network architecture search method of an embodiment of the present application;

[0055] Figure 2 is a topology structure diagram between nodes of an embodiment of the present application;

[0056] Figure 3 is a schematic diagram of stacking cells into a network of an embodiment of the present application;

[0057] Figure 4 is a schematic diagram of the overall framework of the present application. CONCRETE IMPLEMENTATION METHOD

[0058] In order to have a clearer understanding of the technical features, objectives and beneficial effects of the present application, the technical solutions of the present application are selected for the following detailed description. Obviously, the described embodiments are part of the embodiments of the present application, not all embodiments, and cannot be understood as limiting the scope of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0059] Embodiment one:

[0060] In this embodiment, as shown in the figure, a surface defect detection method based on differentiable neural architecture search includes the following steps: Figure 1

[0061] Step one: obtain a search space by collecting a plurality of neural network architecture basic components to be searched, and generate a super network by weight sharing of all neural network architecture basic components in the search space.

[0062] Step two: construct a surface defect dataset, train the super network in step one using the defect dataset, and jointly optimize the architecture parameters and network internal weights to generate the optimal subnetwork architecture from the super network using the gradient descent method.

[0063] Step three: stack the optimal subnetwork architecture cell searched in step two into a network, train and evaluate it using the defect dataset. If the performance of the model is not as expected, the search space and search algorithm need to be adjusted and searched again. Finally, use the model to complete the surface defect detection task in a specific scenario.

[0064] Specifically, step one specifically includes the following sub-steps:

[0065] Step 11: the neural network architecture basic components to be searched include the topology between neural network nodes and the operation set between neural network nodes.

[0066] Step 12: generate a super network by weight sharing of all neural network architecture basic components in the search space: in the traditional method, in order to find the best operation in the candidate operation set , a heuristic algorithm such as reinforcement learning or evolutionary algorithm is used to select a certain operation, that is, this selection is a discrete operation of this or that. This results in a large amount of calculation. Discrete operation is not easy to derive, so the concept of continuous relaxation is introduced to achieve the effect of weight sharing, so that the search space is differentiable, and the gradient descent method can be used for search.

[0067] Specifically, step 11 includes the following steps:

[0068] Step 111: topology between neural network nodes: the final network structure is stacked according to a certain order by searching two different cells (normal cell and reduction cell). Each cell is a directed acyclic graph containing 7 nodes, each node represents a feature map x (i) in the convolutional network, and each edge e (i,j) represents the feature map x (i) ​Transform to feature map x (j) Operation O (i,j) As shown below:

[0069] x (j) =∑ i<j O (i,j) (x (i) )

[0070] Of the seven nodes, there are two input nodes (from the output of the previous cell), one output node, and four intermediate nodes. The output node is formed by connecting the four intermediate nodes through channels, as shown in Figure (3).

[0071] Step 112: Operations between neural network nodes refer to the computational operations that connect different layers in a neural network. Their purpose is to pass input data from one layer to the next, thereby completing the feature extraction and prediction tasks. Common neural network operations include convolution, pooling, fully connected layers, activation functions, etc. In this embodiment, the set of operations between neural network nodes is as follows:

[0072] 1) None: There are no connections between nodes.

[0073] 2) Identity, skip connection;

[0074] From 3)Max_pool_3×3, 3×3 max pooling;

[0075] 4) Avg_pool_3×3, 3×3 average pooling;

[0076] 5) Sep_conv_3×3, a 3×3 depth separable convolution;

[0077] 6) Dil_conv_3×3, 3×3 dilated convolution;

[0078] 7) Sep_conv_5×5, 5×5 depthwise separable convolution;

[0079] 8) Dil_conv_5×5, 5×5 dilated convolution.

[0080] Specifically, step 12 includes the following steps:

[0081] Step 121: Specifically, during the search process, each operation in the candidate operation set processes the feature map of each node. Then, the results from all operations are weighted and summed, i.e.

[0082]

[0083] in The meaning is: the operation O between the i-th feature map and the j-th feature map.(i,j) the weights of the operations, i.e. the architecture parameters that need to be searched later, for example, if the weight of an operation Then it can be considered that this operation is completely unnecessary for the entire network structure.

[0084] Step 122: In order to ensure that the outputs of all nodes are roughly stable, a Softmax operation is performed on the architecture parameters between each two nodes (i.e. the weights of the operations), i.e.

[0085]

[0086] As can be seen, if the weights of each operation are determined, then the final network architecture is also determined (select the operation with the maximum weight), so α can be called the network structure itself.

[0087] Specifically, the step two specifically includes the following sub-steps:

[0088] Step 21: Constructing a surface defect data set.

[0089] Step 22: Training the super network using the defect data set. Like the fitness of the population based on the reinforcement learning method or the evolutionary algorithm, the optimization target based on the differentiable search space using the gradient descent method is also the loss function on the validation set. We let the training loss and validation loss on the surface defect data set be and The network internal weight is ω, and the upper index indicates that it is optimal, so our goal is to find an architecture (α * ) that can be trained well on the training set (optimal weight ω * )

[0090] Step 23: Before judging whether the architecture is good or not each time, first, it needs to be converged on the training set, i.e. And the optimal network internal weight itself must correspond to the architecture, and the corresponding weight will also change with the change of the architecture. That is, a two-level joint optimization problem with architecture α as the upper variable and weight ω as the lower variable:

[0091]

[0092]

[0093] Specifically, the step 21 includes the following steps:

[0094] Step 211: Determine the defect type: first, it is necessary to clarify which defect types are included in the surface defect data set to be constructed, such as cracks, bubbles, scratches, and depressions.

[0095] Step 212: Collect sample images: Collect multiple images of surfaces containing defects, which can be taken using cameras, microscopes, and other devices to ensure that the images are clear and contain enough defects.

[0096] Step 213: Label defects: Use labeling tools to label the defects in each image, which can be done using bounding boxes, polygons, and other methods.

[0097] Step 214: Segment defects: For some applications that require pixel-level analysis, such as defect area and defect perimeter, the image needs to be segmented to separate the defect area.

[0098] Step 215: Data cleaning: For samples with inaccurate labeling or poor image quality, they need to be screened or relabeled to ensure the quality of the dataset.

[0099] Step 216: Data augmentation: Use data augmentation techniques such as rotation, flipping, scaling, etc. to generate more samples to increase the diversity and quantity of the dataset.

[0100] Step 217: Divide the dataset: Divide the dataset into training set, validation set and test set to train, validate and test the model.

[0101] Specifically, the step three includes the following sub-steps:

[0102] Step 31: Stack the cell structure searched in step two into a network.

[0103] Step 32: Model evaluation: Evaluate the stacked network model using the validation set and test set. The evaluation indicators can be accuracy, recall rate, precision, etc. If the performance of the model is not as expected, the search space and search algorithm need to be adjusted and searched again.

[0104] Step 33: Optimization and iteration: Adjust the search space according to the evaluation results of the model and search the cell structure again. This process may need to be iterated several times until the best model performance is obtained. During the search process, we can try different search algorithms, hyperparameter combinations and search strategies to obtain the best cell structure to stack into the optimal network model.

[0105] Specifically, in this embodiment, the specific implementation of step 31 is as follows: Figure 3The two different numbers of cells are stacked in depth, the input of the kth cell is set as the output of the h-1th and k-2th cells, in order to reduce the size of the whole network, the 1 / 3 and 2 / 3 positions of the network are set as reduction cells, the remaining positions are blocks containing N normal cells, in the network search stage, N=2, at this time the network is composed of 8 cells, in the network evaluation stage, N=6, at this time the network is composed of 20 cells, and the reason for using fewer cells in the search stage is that only relatively good networks need to be found in this stage, and using fewer cells can greatly improve the search speed.

[0106] Specifically, the step 32 includes the following steps:

[0107] Step 321: divide the training set into a training set and a validation set, with a division ratio of 70% training set and 30% validation set.

[0108] Step 322: train the stacked model on the training set and validate the model using the validation set. Calculate the loss function and indicators of the model on the validation set, such as accuracy, recall, etc.

[0109] Step 323: adjust the search space and search algorithm according to the performance of the model on the validation set. For example, you can increase the size of the search space, modify the hyperparameters of the search algorithm, etc.

[0110] Step 324: evaluate the final model using the test set. The test set is a data set independent of the training set and the validation set. Calculate the performance indicators of the model on the test set, such as accuracy, recall, etc., to evaluate the performance of the model in actual situations.

[0111] Step 325: If the performance of the model is not good, you can adjust the search space and search algorithm again according to the results of the test set, and search again. This process needs to be iterated several times until the best model performance is obtained.

[0112] This embodiment obtains a search space by aggregating several basic components of a neural network architecture. All these components are then used to generate a supernetwork through weight sharing. A surface defect dataset is constructed, and gradient descent is employed to jointly optimize the architecture parameters and network weights, searching for the optimal sub-network architecture cell from the supernetwork. This optimal sub-network architecture cell is then stacked into a network, trained and evaluated using the defect dataset to obtain the optimal model for surface defect detection in a specific scenario. This invention utilizes differentiable search technology to complete the key model design task in surface defect detection, thereby solving the critical problem of training sample shortage in the field of surface defect detection. It also possesses stronger feature learning capabilities, making it better applicable to different defect detection scenarios.

[0113] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. A surface defect detection method based on differentiable neural architecture search, characterized in that, Includes the following steps: Step 1: Obtain the search space by aggregating the basic components of the neural network architecture, and generate a supernetwork by sharing the weights of all the basic components of the neural network architecture in the search space; Step 2: Construct a surface defect dataset, use the defect dataset to train the supernetwork from Step 1, adopt the gradient descent method, and jointly optimize the architecture parameters and the internal weights of the network to generate the optimal subnetwork architecture cell from the supernetwork. Step 3: Stack the optimal sub-network architecture cells found in Step 2 into a network, train and evaluate it using the defect dataset; if the network model's performance is not optimal, adjust the search space and search algorithm, and search again; finally, use the network model to complete the surface defect detection task. Step one specifically includes: Step 11: The basic components of the neural network architecture to be searched include the topology between neural network nodes and the set of operations between neural network nodes; The topology of the neural network nodes: The network structure consists of two different types of cells, Normal cells and Reduction cells, stacked in a specific order; each cell is a directed acyclic graph containing 7 nodes, and each node represents a feature map x in the convolutional network. (i) Each edge e (i,j) The representative will use the feature map x (i) Transform to feature map x (j) Operation O (i,j) As shown below: Of the seven nodes, there are two input nodes, one output node, and four intermediate nodes. The output node is formed by connecting the four intermediate nodes through a channel. The operation between neural network nodes refers to the computational operation that connects different layers in a neural network, passing input data from one layer to the next, and completing the task of feature extraction and prediction of the input data. Step 12: Generate a supernetwork by sharing weights from all basic components of the neural network architecture in the search space, specifically including: Step 121: For each operation in the candidate operation set, process the feature map of each node, and then sum the results of all operations using a weighted summation, i.e. in The meaning is: the operation O between the i-th feature map and the j-th feature map. (i,j) The weight of an operation, if the weight of a certain operation Therefore, it is assumed that this operation is not needed for the entire network structure; Step 122: Perform a Softmax operation on the operation weights between every two nodes, i.e. Step two specifically includes: Step 21: Construct a surface defect dataset; Step 22: Train the hypernetwork using the defect dataset, and let the training loss and validation loss on the surface defect dataset be respectively... and The network has internal weights ω, and the optimal weights ω are used. * and the architecture α that minimizes the loss on the validation set. * To achieve the objective, we use gradient descent to optimize based on a differentiable search space. Step 23: Using architecture α as the upper-level variable and weight ω as the lower-level variable, construct a two-level joint optimization problem: Step three specifically includes: Step 31: Stack the cell structures found in Step 2 into a network; Step 32: Evaluate the stacked network model using the validation and test sets; the evaluation metrics include at least one of accuracy, recall, and precision; if the model's performance is not optimal, the search space and search algorithm need to be adjusted, and the search should be performed again; Step 33: Adjust the search space based on the model evaluation results and search for cell structures again; iterate until the best model performance is obtained; Step 32 specifically includes the following sub-steps: Step 321: Divide the training set into a training set and a validation set; Step 322: Train the stacked model on the training set and validate the model using the validation set; calculate the model's loss function and accuracy and / or recall on the validation set; Step 323: Adjust the search space and search algorithm based on the model's performance on the validation set; including increasing the size of the search space and / or modifying the hyperparameters of the search algorithm; Step 324: Evaluate the model using the test set; calculate the model's accuracy and / or recall on the test set; Step 325: If the model's performance is poor, adjust the search space and search algorithm again based on the test set results, and search again until the optimal model performance is obtained.

2. The surface defect detection method based on differentiable neural architecture search according to claim 1, characterized in that, Step 21 specifically includes: Step 211: Determine the types of defects included in the surface defect dataset to be constructed, including at least one of cracks, bubbles, scratches, and dents; Step 212: Take multiple images of the surface containing defects using a camera or microscope; Step 213: Label the defects in each image using bounding boxes or polygons; Step 214: Divide the defect area or defect perimeter to separate the defect region; Step 215: For samples with inaccurate labeling or poor image quality, filter or relabel them; Step 216: Perform data augmentation using at least one of the following: rotation, flip, or scaling; Step 217: Divide the dataset into training, validation and test sets, and train, validate and test the model.

3. The surface defect detection method based on differentiable neural architecture search according to claim 1, characterized in that, Neural network operations include convolution, pooling, fully connected layers, and activation functions.

4. The surface defect detection method based on differentiable neural architecture search according to claim 1, characterized in that, The training set is divided into a training set and a validation set, with a ratio of 70% training set and 30% validation set.