Method for establishing a defect detection model and electronic device
By employing a two-stage model training and comparative learning approach, a defect detection model was established, which solved the problems of high omission rates and inconsistent standards caused by manual judgment, and achieved highly accurate automated defect detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WISTRON CORP
- Filing Date
- 2021-10-09
- Publication Date
- 2026-04-10
AI Technical Summary
In existing technologies, the quality inspection of sound-generating components relies on manual judgment, resulting in a high rate of omissions and inconsistent standards, making it difficult to establish an accurate defect detection model.
A two-stage model building method is adopted. The first classification model is trained by comparative learning and outlier samples are screened to build a second classification model to improve detection accuracy.
It significantly reduces the miss rate, improves the accuracy of defect detection, enables automated detection, and reduces labor costs.
Smart Images

Figure CN115730242B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a model training mechanism, and particularly relates to a method for establishing a defect detection model for quality control and an electronic device. BACKGROUND
[0002] Currently, in the product quality detection process of the production line process, due to the different standards of quality control and the lack of systematic processing, the product quality detection is often affected by human factors, resulting in an increase in the operating cost of the incoming quality control (IQC) of the downstream production line.
[0003] In the existing assembly process of the sound generating element, the sound generating element is first determined by an acoustic expert (commonly known as a golden ear), and then determined by a machine, so that the leak rate is below 0.1%. That is, after the sound generating element is assembled, the detection personnel detects the product sound of all sound generating elements in a soundproof room (or soundproof room) using the human ear. Generally, the leak rate of the human ear for identification is about 1-1.5%. The calculation method of the leak rate is the number of defective elements / total number of elements x 100%. After the human ear detection is completed, the machine is used to detect the soundprint, the frequency response curve of the sound pressure level (SPL), the impedance (IMP), and other indicators. Therefore, the current product assembly process needs to consume two checkpoints of human ear detection and machine.
[0004] However, the golden ear training is not easy, and the standards for marking by the production line personnel are inconsistent, and the detection quality caused by fatigue is not the same. In addition, the standard of data marking is not aligned, causing difficulties in verifying the correct rate of the recognition model. The current marking process of the factory acoustic data is triggered by the device to emit sound, and then marked by the human ear. However, this method will cause the position, angle and triggering force of the sound generating element to be inconsistent, even if the hearing level is maintained, there is still a chance of marking error (different). In addition, the golden ear expert training is not easy, and the standards for marking by the production line personnel are inconsistent, and the detection quality caused by fatigue is not the same. Moreover, the golden ear expert cannot listen to digital audio files for marking or re-determination. SUMMARY
[0005] The present application provides a method for establishing a defect detection model and an electronic device, which adopts a two-stage model establishment to improve the accuracy of the final model output.
[0006] The method for establishing the flaw detection model of the present application comprises: establishing a first classification model based on a training sample set, wherein the training sample set comprises a plurality of training samples; inputting the training samples into the first classification model respectively to obtain respective classification results of the training samples; obtaining a plurality of outlier samples with classification errors from the training samples based on the classification results; deleting part of the outlier samples with classification errors from the training samples, and taking the remaining training samples as an optimal sample set; and establishing a second classification model based on the optimal sample set, so as to perform flaw detection through the second classification model.
[0007] In an embodiment of the present application, each of the training samples is labeled with a positive sample label or a negative sample label, and the classification result comprises a first score corresponding to the positive sample label and a second score corresponding to the negative sample label. The step of obtaining outlier samples with classification errors from the training samples based on the classification results comprises: judging whether each training sample has classification errors based on the classification results; determining a training sample labeled with a positive sample label and having a second score greater than a first score in the classification result as an outlier sample with classification errors; and determining a training sample labeled with a negative sample label and having a first score greater than a second score in the classification result as an outlier sample with classification errors.
[0008] In an embodiment of the present application, after judging whether each training sample has classification errors, the method further comprises: classifying a training sample labeled with a positive sample label and having a second score greater than a first score in the classification result into a first error group; and classifying a training sample labeled with a negative sample label and having a first score greater than a second score in the classification result into a second error group. The step of deleting part of the outlier samples with classification errors from the training samples comprises: sorting the outlier samples included in the first error group based on the second score, and deleting a specified proportion of the outlier samples from the sorted first error group from high to low; and sorting the outlier samples included in the second error group based on the first score, and deleting a specified proportion of the outlier samples from the sorted second error group from high to low.
[0009] In an embodiment of the present application, each of the training samples is labeled with a positive sample label or a negative sample label, and the classification result comprises a first score corresponding to the positive sample label and a second score corresponding to the negative sample label. The step of deleting part of the outlier samples with classification errors from the training samples comprises: deleting an outlier sample labeled with a positive sample label and having a second score greater than a preset threshold value; and deleting an outlier sample labeled with a negative sample label and having a first score greater than a preset threshold value.
[0010] In an embodiment of the present application, the step of establishing the first classification model based on the training sample set comprises: training the first classification model by contrastive learning, wherein the contrastive learning comprises the following steps: (a1) randomly taking out training samples labeled with positive sample labels and training samples labeled with negative sample labels from the training sample set; (a2) performing similarity comparison on the training samples taken out in step (a1), thereby adjusting the parameters of the first classification model; and (a3) repeating the above steps (a1), (a2) until the accuracy of the first classification model in classifying the training samples is higher than a specified value.
[0011] In an embodiment of the present application, the number of training samples labeled with positive sample labels in step (a1) is 1 or 2, and the number of training samples labeled with negative sample labels is 1.
[0012] In an embodiment of the present application, the step of establishing the second classification model based on the optimal sample set comprises: training the second classification model by contrastive learning, wherein the contrastive learning comprises the following steps: (b1) randomly taking out training samples labeled with positive sample labels and training samples labeled with negative sample labels from the optimal sample set; (b2) performing similarity comparison on the training samples taken out in step (b1), thereby adjusting the parameters of the second classification model; and (b3) repeating the above steps (b1), (b2) until the loss rate of the second classification model in classifying the training samples is less than or equal to a specified ratio (for example, 0.1).
[0013] In an embodiment of the present application, the number of training samples labeled with positive sample labels in step (b1) is 1 or 2, and the number of training samples labeled with negative sample labels is 1.
[0014] In an embodiment of the present application, each training sample is a spectrogram, and the method for establishing the flaw detection model further comprises: collecting a plurality of audio signals, wherein each audio signal has been labeled with a positive sample label or a negative sample label; performing Fourier transform on each audio signal; and converting the audio signal after Fourier transform into a spectrogram, and adding the spectrogram and its corresponding positive sample label or negative sample label to the training sample set.
[0015] In an embodiment of the present application, the method for establishing the flaw detection model further comprises: performing data enhancement processing on each spectrogram in the training sample set.
[0016] In an embodiment of the present application, after the second classification model is established, further comprising: receiving a recorded audio file; converting the recorded audio file into a spectrogram; inputting the spectrogram into the second classification model to obtain a prediction result, thereby determining whether the recorded audio file has an abnormal sound; and outputting a report based on the prediction result to a user interface.
[0017] The electronic device of the present application comprises a storage device comprising a training sample set and a plurality of modules, wherein the training sample set comprises a plurality of training samples; and a processor coupled to the storage device and configured to execute the modules to perform the following actions: establishing a first classification model based on the training sample set; inputting the training samples into the first classification model respectively to obtain respective classification results of the training samples; obtaining a plurality of outlier samples with classification errors from the training samples based on the classification results; deleting part of the outlier samples with classification errors from the training samples, and taking the remaining training samples as an optimal sample set; and establishing a second classification model based on the optimal sample set to perform a defect detection through the second classification model.
[0018] Based on the above, the present application adopts a two-stage training to delete outlier data, thereby improving the accuracy of the second classification model in performing defect detection. BRIEF DESCRIPTION OF DRAWINGS
[0019] Figure 1 is a block diagram of an electronic device according to an embodiment of the present application.
[0020] Figure 2 is a flowchart of a method for establishing a defect detection model according to an embodiment of the present application.
[0021] Figure 3 is a schematic diagram of a two-stage model establishment according to an embodiment of the present application.
[0022] Figure 4 is a flowchart of a contrastive learning according to an embodiment of the present application.
[0023] Figure 5 is a schematic diagram of a machine according to an embodiment of the present application.
[0024] In the drawings, the reference signs are explained as follows:
[0025] 100: electronic device
[0026] 110: processor
[0027] 120: storage device
[0028] 121: training sample set
[0029] 122: data conversion module
[0030] 123: first training module
[0031] 124: screening module
[0032] 125: second training module
[0033] 310: first classification model
[0034] 320: second classification model
[0035] 330: best sample set
[0036] 340: partial outlier sample
[0037] 500: machine
[0038] 510: recording device
[0039] S205-S225: steps of model building method
[0040] S405-S430: steps of contrastive learning DETAILED DESCRIPTION
[0041] Figure 1 is a block diagram of an electronic device according to an embodiment of the present disclosure. Referring to Figure 1 The electronic device 100 includes a processor 110 and a storage device 120. The processor 110 is coupled to the storage device 120. Here, the electronic device 100 is configured to build a classification model to classify recorded audio files.
[0042] The processor 110 is, for example, a central processing unit (CPU), a graphics processing unit (GPU), or other programmable microprocessor, digital signal processor (DSP), programmable controller, application specific integrated circuit (ASIC), programmable logic device (PLD), or other similar device.
[0043] The storage device 120 is, for example, any type of fixed or removable random access memory, read only memory, flash memory, secure digital card, hard disk, or other similar device or combination of these devices. The storage device 120 includes a training sample set 121, a data conversion module 122, a first training module 123, a screening module 124, and a second training module 125. The training sample set 121 includes a plurality of training samples each labeled with a positive sample label or a negative sample label. The data conversion module 122, the first training module 123, the screening module 124, and the second training module 125 are, for example, composed of one or more program segments that are executed by the processor 110 to implement the actions of the modules after being installed.
[0044] The data conversion module 122 is configured to convert the collected data into proper training samples. The first training module 123 is configured to establish a first classification model using the training sample set 121. The screening module 124 screens the training sample set 121 based on the classification result of the trained first classification model, thereby deleting part of the outlier samples to obtain an optimal sample set. The second training module 125 is configured to establish a second classification model using the optimal sample set, so that the second classification model is used as a final defect detection model for defect detection.
[0045] Since the conventional machine learning algorithm is prone to cause the loss of too many feature values and the overfitting of the classification model when performing feature conversion, the classification effect is not good. For example, the Mel-Frequency Cepstrum (MFC) loses too many features of the sound in the process of converting data, which has a negative impact on the subsequent execution of the machine learning classifier. In the case of losing too many feature values, the learning effect of the Support Vector Machine (SVM) is not good. Therefore, in the present embodiment, a contrastive learning is used to establish the first classification model and the second classification model.
[0046] Figure 2 FIG. 1 is a flowchart of a method for establishing a defect detection model according to an embodiment of the present application. Figure 3 FIG. 2 is a schematic diagram of a two-stage model establishment according to an embodiment of the present application. Please refer to FIG. 2, first, in step S205, a first classification model 310 is established by the first training module 123 based on the training sample set 121. Figures 1 to 3
[0047] Here, the training sample set 121 includes a plurality of training samples, such as spectrograms. Before performing the two-stage model training, a plurality of audio signals are collected in advance. Each of the collected audio signals is labeled with a positive sample label or a negative sample label. The positive sample label indicates that the audio signal is normal (without noise / abnormal sound), and the negative sample label indicates that the audio signal is abnormal (e.g., with noise / abnormal sound). For example, the collected audio signals can be judged by human ears to determine whether they are normal or abnormal, and each audio signal is labeled with a positive sample label or a negative sample label. Alternatively, a plurality of audio signals emitted by a plurality of good sound emitting elements (without noise) are labeled with a positive sample label, and a plurality of audio signals emitted by a plurality of bad sound emitting elements (with noise) are labeled with a negative sample label.
[0048] In practice, it is found that if the criteria of the training samples are inconsistent, the model established will not achieve the expected effect. Therefore, in the data labeling process, the step of adding data alignment criteria is added. The labeling results of the same sound-emitting element are jointly determined by two gold-ear experts, and it is verified whether the labeling results are consistent. If they are not the same, the two gold-ear experts jointly determine whether the sound data should be labeled as a positive sample label or a negative sample label again. Then, the sound file data after alignment is used to train the model.
[0049] After obtaining the audio signals with labels (positive sample labels or negative sample labels), the processor 110 performs a multi-Fourier transform on each audio signal through the data conversion module 122, and converts the audio signal after the Fourier transform into a time spectrum. Then, the time spectrum is added to the training sample set as a training sample together with the corresponding positive sample label or negative sample label. Compared with the problem of losing too many sound features in the process of converting data by using mel-frequency cepstrum, the method of converting the audio signal into a time spectrum can retain more sound features.
[0050] After being converted into a time spectrum, the data conversion module 122 can further perform data enhancement processing on the time spectrum. Data enhancement processing refers to randomly changing the training samples (time spectrum) before the model is trained, thereby increasing the diversity of the training samples. A picture is processed by rotation, cutting, adjustment, etc. to change its size, proportion, or offset or flip, change brightness or color temperature, etc. After processing, a completely different new image is obtained. For example, randomly translating the picture will make the target in the picture constantly move in the training process; randomly scaling the picture will make it constantly enlarge or reduce. Through data enhancement processing, the existing picture can be modified and deformed, so that the important features of the picture can still be learned in the data set.
[0051] Data enhancement can increase the variants of the data set, but not too much. If the noise is much more than the information, it will be harmful to training. Regardless of how the time spectrum is enhanced, the time spectrum that has been labeled as a positive sample label or a negative sample label will not change its labeled label state, and the additional benefit of data enhancement is to increase the number of training samples.
[0052] In this embodiment, the first classification model 310 is trained by contrastive learning. The contrastive learning includes the following steps: (a1) randomly taking out training samples labeled with positive sample labels and training samples labeled with negative sample labels from the training sample set 121; (a2) performing similarity comparison on the training samples taken out in step (a1), thereby adjusting the parameters of the first classification model 310; and (a3) repeating steps (a1) and (a2) until the accuracy of the first classification model 310 in classifying the training samples is higher than a specified value (for example, 80%). The step (a2) is to make the difference between the training samples labeled as positive sample labels and the training samples labeled as negative sample labels larger.
[0053] After the first classification model 310 is trained, in step S210, the plurality of training samples are respectively input to the first classification model 310 to obtain the classification results of each training sample. The classification results include a first score corresponding to the positive sample label and a second score corresponding to the negative sample label. The first score and the second score respectively represent the probability value of being classified into the positive sample label and the negative sample label, and the sum of the first score and the second score is equal to 1. If the first score is higher than the second score, it means that the corresponding training sample is classified as a positive sample label by the first classification model 310. If the second score is higher than the first score, it means that the corresponding training sample is classified as a negative sample label by the first classification model 310.
[0054] Then, in step S215, a plurality of outlier samples classified incorrectly are obtained from the training samples based on the classification results. The screening module 124 determines whether each training sample is classified incorrectly based on the classification results, so that the training samples classified incorrectly by the first classification model 310 are regarded as outlier samples. The training samples labeled with positive sample labels and having the second score greater than the first score in the classification results are determined as outlier samples classified incorrectly by the screening module 124. Moreover, the training samples labeled with negative sample labels and having the first score greater than the second score in the classification results are determined as outlier samples classified incorrectly by the screening module 124.
[0055] Afterwards, in step S220, part of the outlier samples 340 are deleted from the training samples, and the remaining training samples are taken as the best sample set 330. In an embodiment, the screening module 124 can delete part of the outlier samples 340 according to a specified proportion. Specifically, after judging whether each training sample is misclassified, the screening module 124 classifies the training samples marked with the positive sample label and having the second score greater than the first score in the classification result into a first error group, and classifies the training samples marked with the negative sample label and having the first score greater than the second score in the classification result into a second error group. Then, the screening module 124 sorts the outlier samples included in the first error group based on the second score, and deletes a specified proportion of the outlier samples from the sorted first error group from high to low. Also, the screening module 124 sorts the outlier samples included in the second error group based on the first score, and deletes a specified proportion of the outlier samples from the sorted second error group from high to low.
[0056] For example, assuming that the specified proportion is 10%, the positive sample label is "OK", the negative sample label is "NG", the outlier samples marked as "OK" and misclassified as "NG" are sorted from high to low according to the second score corresponding to "NG", and then the first 10% of the outlier samples are deleted; and the outlier samples marked as "NG" and misclassified as "OK" are sorted from high to low according to the first score corresponding to "OK", and then the first 10% of the outlier samples are deleted.
[0057] In another embodiment, the screening module 124 can also delete part of the outlier samples 340 according to a preset threshold value. Specifically, the screening module 124 deletes the outlier samples marked with the positive sample label and having the second score greater than the preset threshold value, and deletes the outlier samples marked with the negative sample label and having the first score greater than the preset threshold value. Here, the preset threshold value is set to be greater than 0.5 and less than 1.
[0058] After the optimal sample set 330 is obtained, in step S225, the second training module 125 establishes a second classification model 320 based on the optimal sample set 330, so that subsequent defect detection is performed by the second classification model 320. The second classification model 320 is the final defect detection model. In this embodiment, the second classification model 320 is trained by using a contrastive learning method. The contrastive learning includes the following steps: (b1) randomly taking out training samples labeled with positive sample labels and training samples labeled with negative sample labels from the optimal sample set 330; (b2) performing similarity comparison on the training samples taken out in step (b1), thereby adjusting the parameters of the second classification model 320; and (b3) repeatedly performing steps (b1) and (b2) until the loss rate of the classification training samples of the second classification model 320 is less than or equal to a specified ratio (for example, 0.1). The step (b2) is to make the difference between the training samples labeled with positive sample labels and the training samples labeled with negative sample labels larger.
[0059] Figure 4 is a flowchart of the contrastive learning according to an embodiment of the present application. Please refer to Figure 4 In step S405, a positive-negative sample combination is randomly taken out. That is, a pair of training samples labeled with positive sample labels and training samples labeled with negative sample labels is selected by random sampling, and is sent into a classifier (first classification model or second classification model) for training in pairs. The main purpose is to make the classifier learn to distinguish the difference between positive samples and negative samples, and the secondary purpose is to balance the number of positive samples and negative samples to prevent the classifier from being biased due to insufficient negative samples. The number of training samples labeled with positive sample labels is one or two, and the number of training samples labeled with negative sample labels is one.
[0060] Then, in step S410, the selected training samples are input into an encoder to obtain a feature vector. In this embodiment, a convolutional neural network (CNN) encoder is used to extract a feature vector in the training sample (time spectrum graph). In other embodiments, the encoder can also use ResNet or VGG19. Since CNN can learn features while projecting them to high dimensions, it can achieve better classification accuracy.
[0061] After that, in step S415, feature description extraction is performed to take out the feature vector of the latent space from the feature vector extracted by the encoder.
[0062] Then, in step S420, a Projection Head, which is a non-linear projection process using a fully-connected network, such as a multi-layer perceptron (MLP), is performed to transform the feature vectors of the latent space obtained in step S415, with the purpose of amplifying (enhancing) the features and maximizing the ability of the network to recognize the same picture converted in different ways.
[0063] Next, in step S425, a loss function is designed. The loss function is designed in such a way that positive samples are pulled closer and negative samples are pushed further apart. Then, in step S430, a similarity comparison is performed. The similarity comparison is basically performed in the form of a dot product. In the case of using one training sample marked with a positive sample label (positive sample) and one training sample marked with a negative sample label (negative sample), the similarity of the two is compared. In the case of using two positive samples and one negative sample, it is determined that the similarity of the positive sample A and the positive sample B should be as similar as possible, and the similarity of the positive sample A and the negative sample C should be as dissimilar as possible. Through contrastive learning, the features of the same class are made to be more similar, and the features of different classes are made to be less similar. A more detailed description of the contrastive learning framework can be referred to the SimCLR framework. In an embodiment, when training the model, the similarity comparison is performed, the corresponding loss function is calculated, the model parameters are adjusted by the loss function, and the model is continuously trained, so that the loss function calculated next time gradually becomes smaller. The model recognizes the features of the training samples, and recognizes that the features of the training samples marked with a positive sample label and the features of the training samples marked with a negative sample label are dissimilar.
[0064] Figure 5 is a schematic view of a machine table according to an embodiment of the present application. Please refer to Figure 5 , the machine table 500 includes Figure 1The electronic device 100 and the recording device 510 are shown. The recording audio is obtained by the recording device 510 and transmitted to the electronic device 100. After receiving the recording audio, the electronic device 100 converts the recording audio into a spectrogram and performs data enhancement processing and the like, and then inputs the processed spectrogram into the trained second classification model 320 to obtain a prediction result, thereby determining whether the recording audio has an abnormal sound. Moreover, a report is output to the user interface based on the prediction result. The report content includes the total number of recording audios to be detected, the number of misjudgments as "NG", the number of correct classifications as "NG", the number of misjudgments as "OK", the number of correct classifications as "OK", the missing rate, the overkill rate, the stability, the average detection time, and the like.
[0065] In summary, the embodiments of the present application use two-stage training to delete outliers, thereby improving the accuracy of the second classification model (the final defect detection model) for defect detection. In addition, the comparative learning and semi-supervised learning training method is used in combination with the spectrogram conversion technology to establish an artificial intelligence acoustic detection model. Compared with the conventional detection method by human ear, the embodiments of the present application establish an artificial intelligence acoustic detection model, which can greatly reduce the missing rate. Moreover, the artificial intelligence acoustic detection model replaces the traditional manpower in an automated process, reducing labor costs.
Claims
1. A method for establishing a defect detection model, comprising: establishing a first classification model based on a training sample set, wherein the training sample set comprises a plurality of training samples; inputting each of the training samples into the first classification model to obtain a classification result of each of the training samples; obtaining a plurality of outlier samples with classification errors from the training samples based on the classification results; deleting part of the outlier samples with classification errors from the training samples, and taking the remaining training samples as an optimal sample set; and establishing a second classification model based on the optimal sample set to perform a defect detection by the second classification model, wherein each of the training samples is labeled with a positive sample label or a negative sample label, and the classification result comprises a first score corresponding to the positive sample label and a second score corresponding to the negative sample label.
2. The method for establishing a defect detection model as described in claim 1, wherein, The step of obtaining the outlier samples with classification errors from the training samples based on the classification results comprises: judging whether each of the training samples has a classification error based on the classification result; judging the training sample labeled with the positive sample label and having the second score greater than the first score in the classification result as the outlier sample with a classification error; and judging the training sample labeled with the negative sample label and having the first score greater than the second score in the classification result as the outlier sample with a classification error. 3.The method of claim 2, wherein after judging whether each of the training samples has a classification error, further comprising: classifying the training sample labeled with the positive sample label and having the second score greater than the first score in the classification result into a first error group; and classifying the training sample labeled with the negative sample label and having the first score greater than the second score in the classification result into a second error group; wherein the step of deleting part of the outlier samples with classification errors from the training samples comprises: sorting the outlier samples included in the first error group based on the second score, and deleting a specified proportion of the outlier samples from the sorted first error group from high to low; and sorting the outlier samples included in the second error group based on the first score, and deleting the specified proportion of the outlier samples from the sorted second error group from high to low. The step of deleting part of the outlier samples with classification errors from the training samples comprises:
4. The method for establishing a defect detection model as described in claim 1, wherein, deleting the outlier sample labeled with the positive sample label and having the second score greater than a preset threshold value; and deleting the outlier sample labeled with the negative sample label and having the first score greater than the preset threshold value. 5.The method of claim 1, wherein the step of establishing the first classification model based on the training sample set comprises: training the first classification model by using a contrastive learning, wherein the contrastive learning comprises the following steps: (a1) randomly taking out training samples labeled with a positive sample label and training samples labeled with a negative sample label from the training sample set; (a2) performing similarity comparison on the training samples taken out in step (a1), thereby adjusting parameters of the first classification model; and (a3) repeating steps (a1) and (a2) until accuracy of the first classification model classifying the training samples is higher than a specified value.
6. The method of claim 5, wherein the number of training samples labeled with the positive sample label in step (a1) is one or two, and the number of training samples labeled with the negative sample label is one.
7. The method of claim 1, wherein the step of establishing the second classification model based on the optimal sample set comprises: training the second classification model using a contrastive learning, wherein the contrastive learning comprises the following steps: (b1) randomly taking out a training sample labeled with a positive sample label and a training sample labeled with a negative sample label from the optimal sample set; (b2) performing similarity comparison on the training samples taken out in step (b1), thereby adjusting parameters of the second classification model; and (b3) repeating steps (b1) and (b2) until a false negative rate of the second classification model classifying the training samples is less than or equal to a specified ratio.
8. The method of claim 7, wherein the number of training samples labeled with the positive sample label in step (b1) is one or two, and the number of training samples labeled with the negative sample label is one.
9. The method of claim 1, wherein each of the training samples is a time-spectrum graph, and the method further comprises: collecting a plurality of audio signals, wherein each of the audio signals is labeled with a positive sample label or a negative sample label; performing a Fourier transform on each of the audio signals; and converting each of the audio signals after the Fourier transform into the time-spectrum graph, and adding the time-spectrum graph and its corresponding positive sample label or negative sample label to the training sample set.
10. The method of claim 9, further comprising: performing a data augmentation process on each of the time-spectrum graphs in the training sample set.
11. The method of claim 1, wherein after establishing the second classification model, the method further comprises: receiving a recorded audio file; converting the recorded audio file into a time-spectrum graph; inputting the time-spectrum graph into the second classification model to obtain a prediction result, thereby determining whether the recorded audio file has an abnormal sound; and outputting a report based on the prediction result to a user interface.
12. An electronic device, comprising: a storage device comprising a training sample set and a plurality of modules, wherein the training sample set comprises a plurality of training samples; and a processor coupled to the storage device and configured to execute the modules to perform the following actions: establishing a first classification model based on the training sample set; inputting each of the training samples into the first classification model to obtain a classification result of each of the training samples; and obtaining a plurality of outlier samples from the training samples based on the classification result which are misclassified; removing part of the outlier samples which are misclassified from the training samples, and taking the remaining training samples as a best sample set; and establishing a second classification model based on the best sample set, so as to perform a defect detection by the second classification model, wherein each of the training samples is labeled with a positive sample label or a negative sample label, and the classification result comprises a first score corresponding to the positive sample label and a second score corresponding to the negative sample label. 13.The electronic device of claim 12, wherein, The processor is configured to: determine whether each of the training samples is misclassified based on the classification result; determine the training samples labeled with the positive sample label and the second score in the classification result being greater than the first score as the outlier samples which are misclassified; and determine the training samples labeled with the negative sample label and the first score in the classification result being greater than the second score as the outlier samples which are misclassified.
14. The electronic device of claim 13, wherein the processor is configured to: classify the training samples labeled with the positive sample label and the second score in the classification result being greater than the first score into a first misclassified group; classify the training samples labeled with the negative sample label and the first score in the classification result being greater than the second score into a second misclassified group; sort the outlier samples included in the first misclassified group based on the second score, and remove a specified proportion of the outlier samples from the sorted first misclassified group from high to low; and sort the outlier samples included in the second misclassified group based on the first score, and remove the specified proportion of the outlier samples from the sorted second misclassified group from high to low. The processor is configured to: 15.The electronic device of claim 12, wherein, remove the outlier samples labeled with the positive sample label and the second score being greater than a preset threshold value; and remove the outlier samples labeled with the negative sample label and the first score being greater than the preset threshold value.
16. The electronic device of claim 12, wherein the processor is configured to train the first classification model and the second classification model respectively by using a contrastive learning.
17. The electronic device of claim 12, wherein each of the training samples is a time-spectrum graph, and the processor is configured to: collect a plurality of audio signals, wherein each of the audio signals is labeled with a positive sample label or a negative sample label; perform a Fourier transform on each of the audio signals; and convert each of the audio signals after the Fourier transform into the time-spectrum graph, and add the time-spectrum graph and its corresponding positive sample label or negative sample label to the training sample set.
18. The electronic device of claim 17, wherein the processor is configured to: perform a data enhancement processing on each of the time-spectrum graphs in the training sample set.
19. The electronic device of claim 12, wherein the processor is configured to: receive a recorded audio file; convert the recorded audio file into a time-spectrum graph; input the time-spectrum graph into the second classification model to obtain a prediction result, thereby determining whether the recorded audio file has an abnormal sound; and A report is outputted to a user interface based on the prediction result.
Citation Information
Patent Citations
Reflective mode multi-spectral time-resolved optical imaging methods and apparatuses for tissue classification
CN108471949A
Multimedia resource matching method and apparatus, storage medium, and electronic apparatus
US20200349385A1
Outlier detection for spectroscopic classification
US20210142038A1