Clock accessory defect classification method and system based on visual technology
This defect classification and identification method using visual technology utilizes adaptive illumination correction and deep learning networks to extract features, and generates adversarial networks and Bayesian algorithms to output target classification results. This solves the problems of missed and false detections in traditional inspection, and achieves efficient and accurate defect detection, meeting the needs of modern production lines.
Patent Information
- Application Number
- CN202511033607.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-25
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2045-07-25
AI Technical Summary
Traditional watch component defect detection is affected by the experience and fatigue level of the inspectors, which easily leads to missed or false detections and is inefficient, making it difficult to meet the detection needs of modern production lines.
A defective part classification and recognition method based on vision technology is adopted. The adaptive illumination correction algorithm is used to eliminate reflection interference, the DualPathNet dual-path convolutional neural network is used to extract local texture and global geometric features, the SEBlock attention mechanism is combined for feature fusion, and the MobileNetV3 neural network is used for lightweight classification. Finally, the target classification result is output through GANs generative adversarial network and Bayesian algorithm.
It achieves comprehensive capture of defect features, improves the accuracy and completeness of detection, reduces the rate of missed detections and false detections, enables millisecond-level real-time detection on industrial production lines, adapts to the dynamic changes of production lines, and improves production efficiency.
Smart Images

Figure CN120808037B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image recognition, in particular to a watch spare part defect classification method and system based on visual technology. BACKGROUND
[0002] Traditional watch spare part defect detection is greatly influenced by the experience and fatigue degree of the detection personnel, and is prone to missed detection and false detection. For some extremely subtle scratches, spots and other defects, the detection personnel cannot concentrate after long-time work, and cannot accurately identify. Moreover, the artificial detection is low in efficiency, and it is difficult to meet the high-speed detection demand of modern watch production line, which seriously restricts the improvement of production efficiency. SUMMARY
[0003] The present application relates to the technical field of image recognition, in particular to a watch spare part defect classification method and system based on visual technology.
[0004] To achieve the above-mentioned purpose, the technical scheme of the present application is as follows: further, in the watch spare part defect classification method based on visual technology, the watch spare part defect classification method comprises the following steps:
[0005] Obtain the watch spare part image data, introduce the adaptive light correction algorithm, eliminate the reflection interference through histogram equalization and Retinex enhancement technology, and obtain the processed image data;
[0006] Establish a DualPathNet double-path convolutional neural network to extract local texture features and global geometric features in the processed image data respectively, and perform weighted fusion of the features through SEBlock attention mechanism to obtain fusion feature data;
[0007] Based on the MobileNetV3 neural network, a lightweight classifier is established, the fusion feature data is input into the lightweight classifier for classification, and a preliminary classification result is output;
[0008] According to the preliminary classification result, a GANs generative adversarial network is used to generate a defect sample, a posterior probability is calculated through a Bayesian algorithm, and a target classification result is output.
[0009] Further, in the watch spare part defect classification method based on visual technology, the watch spare part image data is obtained, the adaptive light correction algorithm is introduced, the reflection interference is eliminated through histogram equalization and Retinex enhancement technology, and the processed image data is obtained, which comprises:
[0010] Obtain the watch spare part image data, calculate the number of pixels of each gray level in the image in the watch spare part image data;
[0011] Calculate the cumulative distribution function to map the gray values of the original image to a new gray value range; thus obtaining equalized image data.
[0012] The original image is subjected to a logarithmic transformation, which converts multiplication into addition. The illumination component is estimated using a Gaussian filtering method. The logarithmic form of the reflection component is obtained by calculation, and then an exponential transformation is performed to obtain the reflection component, thus obtaining the processed image data.
[0013] Furthermore, in the aforementioned method for classifying and identifying defective watch parts based on visual technology, the establishment of a DualPathNet dual-path convolutional neural network extracts local texture features and global geometric features from the processed image data, and performs weighted fusion of features through the SEBlock attention mechanism to obtain fused feature data, including:
[0014] A DualPathNet dual-path convolutional neural network is established. Convolution operations are performed through convolution kernels to extract preliminary features from the processed image data and obtain a preliminary feature image.
[0015] The initial feature image is passed through three convolutional blocks in sequence, with batch normalization and ReLU activation function added in between. This reduces the receptive field and captures local texture details in the image, including surface scratches and spots.
[0016] The processed image data is convolved using the convolution kernels of the DualPathNet dual-path convolutional neural network. The first convolution reduces the number of feature channels; the middle convolution extracts medium-scale geometric features; and the final convolution restores the number of channels.
[0017] By increasing the receptive field, the global geometric features of watch components can be captured, including at least the overall shape and outline.
[0018] Furthermore, in the aforementioned method for classifying and identifying defective watch parts based on visual technology, the establishment of a DualPathNet dual-path convolutional neural network extracts local texture features and global geometric features from the processed image data, and performs weighted fusion of features through the SEBlock attention mechanism to obtain fused feature data, including:
[0019] A DualPathNet dual-path convolutional neural network is established. Convolution operations are performed through convolution kernels to extract preliminary features from the processed image data and obtain a preliminary feature image.
[0020] The initial feature image is passed through three convolutional blocks in sequence, with batch normalization and ReLU activation function added in between. This reduces the receptive field and captures local texture details in the image, including surface scratches and spots.
[0021] The processed image data is convolved using the convolution kernels of the DualPathNet dual-path convolutional neural network. The first convolution reduces the number of feature channels; the middle convolution extracts medium-scale geometric features; and the final convolution restores the number of channels.
[0022] By increasing the receptive field, the global geometric features of watch components can be captured, including at least the overall shape and outline.
[0023] Furthermore, in the aforementioned method for classifying and identifying defective watch parts based on visual technology, the step of establishing a lightweight classifier based on the MobileNetV3 neural network, inputting the fused feature data into the lightweight classifier for classification, and outputting preliminary classification results includes:
[0024] The fused feature data is input into a lightweight classifier, and the convolutional layer extracts deep patterns from the fused features through convolutional kernels of different sizes, amplifying the difference between the texture features of the scratch and the surrounding normal texture.
[0025] Pooling layers select the maximum and average values of local regions to retain key information while compressing the feature map size, thus obtaining high-dimensional feature regions.
[0026] The fully connected layer maps high-dimensional features to a predefined classification space and outputs preliminary classification results, including at least qualified parts, scratched parts, deformed parts, and spotted parts.
[0027] Furthermore, in the aforementioned method for classifying and identifying defective watch parts based on visual technology, the step of generating defect samples using GANs (Generative Adversarial Networks) based on the preliminary classification results, calculating the posterior probability using a Bayesian algorithm, and outputting the target classification result includes:
[0028] The discriminator extracts the feature details of the samples through multi-layer convolution operations and analyzes whether the defect features in the image conform to the real physical laws.
[0029] Real samples with rare defects are given higher weights, and the generator prioritizes generating diverse samples with defects.
[0030] Furthermore, in the aforementioned method for classifying and identifying defective watch parts based on visual technology, the step of generating defect samples using GANs (Generative Adversarial Networks) based on the preliminary classification results, calculating the posterior probability using a Bayesian algorithm, and outputting the target classification result further includes:
[0031] The classification confidence is quantified by using the probability of various defects to occur based on the preliminary classification results using the Bayesian algorithm, and the target classification result is output.
[0032] Furthermore, in the watch parts defect classification and identification system based on vision technology, the watch parts defect classification and identification system includes the following modules:
[0033] The image data acquisition module is used to acquire image data of watch parts. It introduces an adaptive illumination correction algorithm and eliminates reflection interference through histogram equalization and Retinex enhancement technology to obtain processed image data.
[0034] The image feature fusion module is used to establish a DualPathNet dual-path convolutional neural network to extract local texture features and global geometric features from the processed image data, and to perform weighted fusion of features through the SEBlock attention mechanism to obtain fused feature data.
[0035] The defect preliminary classification module is used to build a lightweight classifier based on the MobileNetV3 neural network, input the fused feature data into the lightweight classifier for classification, and output the preliminary classification result;
[0036] The defect target classification module is used to generate defect samples using GANs (Generative Adversarial Networks) based on the preliminary classification results, calculate the posterior probability using a Bayesian algorithm, and output the target classification results.
[0037] Furthermore, in the watch component defect classification and identification system based on vision technology, the defect target classification module includes the following sub-modules:
[0038] The discriminator submodule is used by the discriminator to extract feature details of samples through multi-layer convolution operations and analyze whether the defect features in the image conform to the real physical laws.
[0039] The generator submodule is used to assign higher weights to real samples with rare defects, and the generator prioritizes generating diverse samples with defects.
[0040] Furthermore, in the watch component defect classification and identification system based on vision technology, the defect target classification module includes the following sub-modules:
[0041] The output submodule is used to quantify the classification confidence based on the probability of occurrence of various defects statistically calculated from the preliminary classification results using the Bayesian algorithm, and output the target classification result.
[0042] Its beneficial effects are as follows: 1. It achieves comprehensive capture of defect features, improving the accuracy and completeness of features. The resulting classification results are more reliable, significantly reducing the rates of missed and false detections. 2. This technical solution can be deployed on edge computing devices in industrial production lines, achieving millisecond-level real-time detection response, meeting the detection needs of high-speed production lines in the watchmaking industry, and improving production efficiency. 3. The system can quickly learn and generate relevant samples, incorporating new defects into the classification system, continuously improving its ability to identify new types of defects, adapting to the dynamic changes in the production line, and possessing strong flexibility and adaptability. Attached Figure Description
[0043] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention.
[0044] Figure 1 This is a schematic diagram of the first embodiment of the method for classifying and identifying defective watch parts based on vision technology in this invention.
[0045] Figure 2 This is a schematic diagram of a second embodiment of the method for classifying and identifying defective watch parts based on vision technology in this invention.
[0046] Figure 3 This is a schematic diagram of the first embodiment of the watch parts defect classification and identification system based on vision technology in this invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0048] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0049] The present invention will now be described in detail with reference to the accompanying drawings. Figure 1 As shown, a method for classifying and identifying defective watch parts based on vision technology includes the following steps:
[0050] Step 101: Obtain image data of watch parts and introduce an adaptive illumination correction algorithm. Eliminate reflection interference through histogram equalization and Retinex enhancement technology to obtain processed image data.
[0051] Specifically, in this embodiment, image data of watch parts is acquired, and the number of pixels appearing in the image data of each gray level of the watch parts is calculated.
[0052] Calculate the cumulative distribution function to map the gray values of the original image to a new gray value range; thus obtaining equalized image data.
[0053] The original image is subjected to a logarithmic transformation, which converts multiplication into addition. The illumination component is estimated using a Gaussian filtering method. The logarithmic form of the reflection component is obtained by calculation, and then an exponential transformation is performed to obtain the reflection component, thus obtaining the processed image data.
[0054] Specifically,
[0055] (a) Image data acquisition
[0056] A high-resolution industrial camera (Baslerac A2040-90uc with 12 megapixels) was used to acquire image data of watch components. Camera parameters were set as follows: exposure time 5-10ms, frame rate 30fps, and lens focal length adjusted according to the size of the components to ensure clear image detail. To guarantee image quality stability, the camera was fixed on a precision guide rail, and automated control was used to capture images of watch components from different angles and positions, obtaining multi-dimensional image data.
[0057] (ii) Adaptive illumination correction processing
[0058] Histogram equalization: First, the gray-level histogram of the image is calculated, that is, the number of pixels appearing at each gray level in the image. Then, the cumulative distribution function is calculated to map the gray values of the original image to a new gray-level range, making the gray-level distribution of the new image more uniform. The specific formula is: Let the original image have gray levels r_k, the number of pixels n_k, and the total number of pixels N. The cumulative distribution function is CDF(r_k)=∑(n_j / N) (j from 0 to k), then the mapped gray value s_k=round((L-1)*CDF(r_k)), where L is the total number of gray levels (usually 256). By adjusting the gray-level distribution of the image in this way, the image contrast is enhanced, and the details in the image are clearer.
[0059] Retinex Enhancement Technique: This technique is based on the characteristics of the human visual system, arguing that an image can be decomposed into illumination and reflection components. The reflection component contains the essential information of the image, while the illumination component causes problems such as image non-uniformity and glare. Specifically, the original image is first logarithmically transformed, converting multiplication into addition: log(I(x,y)) = log(L(x,y)) + log(R(x,y)), where I(x,y) is the original image, L(x,y) is the illumination component, and R(x,y) is the reflection component. Then, Gaussian filtering and other methods are used to estimate the illumination component L(x,y). Finally, the logarithmic form of the reflection component is obtained using log(R(x,y)) = log(I(x,y)) - log(L(x,y)), and then an exponential transformation is performed to obtain the reflection component R(x,y), thus eliminating glare interference and obtaining the processed image data.
[0060] Step 102: Establish a DualPathNet dual-path convolutional neural network to extract local texture features and global geometric features from the image data. Use the SEBlock attention mechanism to perform weighted fusion of features to obtain fused feature data.
[0061] Specifically, in this embodiment, a DualPathNet dual-path convolutional neural network is established. Convolution operations are performed through convolution kernels to extract preliminary features from the processed image data and obtain a preliminary feature image.
[0062] The initial feature image is passed through three convolutional blocks in sequence, with batch normalization and ReLU activation function added in between. This reduces the receptive field and captures local texture details in the image, including surface scratches and spots.
[0063] The image data is processed by performing convolution operations through the convolution kernels of the DualPathNet dual-path convolutional neural network. The first convolution reduces the number of feature channels; the middle convolution extracts medium-scale geometric features; and the final convolution restores the number of channels.
[0064] By increasing the receptive field, the global geometric features of watch components can be captured, including at least the overall shape and outline.
[0065] Global average pooling is performed on local texture features and global geometric features to compress the features of each channel into a scalar, thus obtaining the channel descriptor;
[0066] The channel descriptors are reduced in dimensionality by using a fully connected layer, and then the dimensionality is restored by using a ReLU activation function. Finally, the weight of each channel is obtained by using a Sigmoid activation function.
[0067] The obtained weights are multiplied by the corresponding feature maps, and the features of each channel are weighted and adjusted. Important features are given higher weights to obtain fused feature data.
[0068] Specifically,
[0069] (I) Local Texture Feature Extraction Path
[0070] This approach is specifically designed to address minute imperfections on the surface of watch components, such as micron-level scratches, pinhole-like spots, and subtle color differences.
[0071] In the initial stage, a 3x3 convolution kernel is used for the first feature extraction. This size of convolution kernel can accurately cover small-scale defect areas. The stride is set to 1 and edge pixels are preserved (padding=1) to ensure that the detailed position information of the original image is not lost.
[0072] The intermediate processing stage consists of five cascaded convolutional blocks. Each block comprises two 3x3 convolutional layers: the first layer captures basic texture features, and the second layer refines and filters these features. Batch normalization is applied between the two layers to stabilize the data distribution and prevent parameter fluctuations during network training. A ReLU activation function is then applied to enable the network to capture non-linear features—this design effectively distinguishes between normal textures and abnormal defects on a part's surface.
[0073] As the network depth increases, the number of channels in the feature map doubles after every two convolutional blocks, enhancing the ability to describe complex textures by increasing the feature dimension. The final output local feature map clearly shows the location and morphological features of various minute imperfections, providing accurate local basis for subsequent classification.
[0074] (II) Global Geometric Feature Extraction Path
[0075] This approach focuses on the integrity of the overall shape of the part, such as whether there are macroscopic defects such as deformation, edge defects, or structural misalignment.
[0076] First, preliminary feature extraction is performed using a large 7x7 convolutional kernel with a stride of 2 to moderately compress the image size while retaining sufficient global information (padding=3). This step can quickly capture the overall outline of the part.
[0077] The subsequent code contains four residual blocks, each employing a three-stage structure of "1x1 convolution - 3x3 convolution - 1x1 convolution". The first 1x1 convolution reduces the number of feature channels, decreasing computation; the middle 3x3 convolution focuses on extracting medium-scale geometric features, such as the corner radius and hole locations of the part; and the final 1x1 convolution restores the number of channels, ensuring consistency in feature dimensions. Skip connections (directly stacking the input to the output) between residual blocks address the gradient decay problem in deep networks, allowing the network to effectively learn the features of the overall part structure.
[0078] As residual blocks are stacked, the receptive field of the network expands continuously, eventually covering the entire part area. The output global feature map can fully describe the macroscopic information such as the shape, proportion, and structural layout of the part.
[0079] II. The SEBlock Attention Mechanism Fusion Process
[0080] (a) Extrusion Operation: Focusing on Key Information
[0081] The feature maps output from the local texture feature path and the global geometric feature path are processed separately. Global average pooling is used to transform the two-dimensional feature map of each channel into a numerical value, representing the overall strength of the feature in that channel. For example, channels containing scratch features will receive higher values, while channels unrelated to the background will receive lower values. This step condenses the core information of each channel, providing a basis for subsequent weight allocation.
[0082] (ii) Incentive Operation: Precisely Allocating Weights
[0083] The squeezed values are input into a small neural network for processing. First, a fully connected layer is used to reduce the channel dimension to 1 / 16 of its original size, reducing computational complexity while allowing the network to focus on learning the correlation between channels. After the ReLU activation function enhances the nonlinear expression, another fully connected layer is used to restore the original channel dimension. Finally, the Sigmoid function is used to compress the output values to between 0 and 1, obtaining the weight coefficient of each channel.
[0084] For watch parts, channels containing defect features (local channels corresponding to scratches and global channels corresponding to deformations) are given higher weights, while channels corresponding to background or normal areas are given lower weights, thus focusing on important features.
[0085] (III) Scaling Operation: Feature Enhancement Fusion
[0086] The weight coefficients obtained from the excitation operation are multiplied one by one with the feature maps of the corresponding channels to strengthen the feature signals of high-weight channels and weaken the interference information of low-weight channels. Then, the local texture features and global geometric features are concatenated along the channel dimension to form fused feature data. This fusion method preserves the local details of minor flaws while integrating macroscopic information about the overall structure of the part, providing more comprehensive feature support for subsequent classification.
[0087] Step 103: Build a lightweight classifier based on the MobileNetV3 neural network, input the fused feature data into the lightweight classifier for classification, and output the preliminary classification results;
[0088] Specifically, in this embodiment, the fused feature data is input into a lightweight classifier, and the convolutional layer extracts deep patterns from the fused features through convolutional kernels of different sizes, amplifying the difference between the texture features of the scratch and the surrounding normal texture.
[0089] Pooling layers select the maximum and average values of local regions to retain key information while compressing the feature map size, thus obtaining high-dimensional feature regions.
[0090] The fully connected layer maps high-dimensional features to a predefined classification space and outputs preliminary classification results, including at least qualified parts, scratched parts, deformed parts, and spotted parts.
[0091] Specifically,
[0092] (a) Application logic of depthwise separable convolution
[0093] MobileNetV3 employs depthwise separable convolution technology, splitting traditional convolution operations into two steps: depthwise convolution and pointwise convolution. When processing the fused features of watch parts, depthwise convolution performs convolution operations on each input channel individually, accurately capturing the unique information of different feature channels. For example, the texture channel of local scratches and the contour channel of global deformation can be processed separately. Pointwise convolution, on the other hand, recombines these separated channel features using a 1x1 convolution kernel to form more representative comprehensive features. This enables the classifier to operate efficiently under the real-time requirements of industrial inspection—for watch part images typically ranging from 200 to 500 pixels, processing speed can be improved by 3-5 times.
[0094] (ii) The reinforcing effect of the Squeeze-and-Excitation module
[0095] This module is embedded in a key network layer of MobileNetV3. By dynamically adjusting the weights of feature channels, it further highlights features crucial for defect identification. For example, when processing images of parts with tiny spots, the module automatically enhances the weights of channels containing spot features while suppressing irrelevant background channels, allowing the network to focus more on the discrimination of defect areas. This mechanism complements the feature fusion of SEBlock in step 2; the former focuses on global feature selection after fusion, while the latter emphasizes the initial weighting of dual-path features.
[0096] (III) Advantages of the h-swish activation function
[0097] Compared to traditional activation functions, the h-swish function reduces computational overhead while maintaining feature discriminative power through a smoother nonlinear transformation. In watch component inspection, this characteristic is particularly suitable for handling subtle grayscale differences—such as slight color variations in the electroplating layer on a part's surface. This function can more accurately convert these differences into discriminative feature signals, avoiding detail loss due to activation value saturation.
[0098] II. Hierarchical Processing Flow of Classifiers
[0099] (I) Feature Input and Preprocessing
[0100] The fused feature data (including local texture and global geometric features) first enters the input layer of the classifier. At this point, the feature map size has already been compressed to a size suitable for network operations (typically 32x32 or 64x64) through preprocessing. The input layer then standardizes the feature data to eliminate differences in numerical ranges between different batches of features, ensuring the stability of network training and inference.
[0101] (ii) Progressive processing of convolution and pooling
[0102] The middle layer of the network consists of multiple "convolution-pooling" units: the convolutional layer further extracts deep patterns from the fused features through convolutional kernels of different sizes (mainly 3x3, taking into account local details and medium-scale features), such as amplifying the difference between the texture features of scratches and the surrounding normal textures; the pooling layer selects the maximum or average value of local regions, compressing the feature map size while retaining key information, and gradually focusing on the most discriminative feature regions (the core location of the defect).
[0103] (III) Classification Decision of Fully Connected Layers
[0104] After multiple rounds of convolution and pooling, the feature data is transformed into a one-dimensional vector and input into a fully connected layer. The fully connected layer maps the high-dimensional features to a predefined classification space through dense connections between neurons—for watch parts, this space typically includes categories such as "qualified parts," "scratched parts," "deformed parts," and "blemished parts." Finally, the softmax function converts the output into probability values for each category; the category with the highest probability is the initial classification result.
[0105] Step 104: Based on the preliminary classification results, use GANs (Generative Adversarial Networks) to generate defect samples, calculate the posterior probability using the Bayesian algorithm, and output the target classification results.
[0106] Specifically, in this embodiment, the discriminator extracts the feature details of the sample through multi-layer convolution operations and analyzes whether the defect features in the image conform to the real physical laws.
[0107] Real samples with rare defects are given higher weights, and the generator prioritizes generating diverse samples with defects.
[0108] The classification confidence is quantified by using the probability of various defects to occur based on the preliminary classification results using the Bayesian algorithm, and the target classification result is output.
[0109] Specifically,
[0110] (a) Design Logic of Generator
[0111] As a core component of GANs, the generator's main function is to create virtual samples that are highly similar to real defect samples. Its input is randomly generated noise signals, which are progressively transformed through multi-layered neural networks into image data with clear defect features. Targeting the defect characteristics of watch parts, the generator's network structure employs a progressive growth design: the initial layers focus on generating the basic contours of defects, such as the linear shape of scratches and the circular base of spots; the deeper layers are responsible for adding detailed features, such as the roughness of scratch edges and the reflective differences on the surface of spots, ensuring that the generated defect samples are consistent with real samples in terms of texture and lighting response.
[0112] (ii) The discrimination mechanism of the discriminator
[0113] The discriminator distinguishes between input samples that are real defect samples (from images of flawed parts in actual production) and virtual samples created by the generator. It extracts feature details from the samples through multiple convolutional operations, analyzing layer by layer whether the defect features in the image conform to real physical laws—for example, determining whether the direction of scratches is consistent with the stress direction in the part's manufacturing process, and whether the distribution of spots conforms to the random characteristics of electroplating defects. The discriminator's output is a confidence score, which is fed back to the generator to optimize the generation effect.
[0114] (III) The dynamic process of adversarial training
[0115] The generator and discriminator achieve co-optimization through continuous adversarial training. In the early stages of training, the samples generated by the generator may have obvious defects, such as blurred contours or distorted features, which the discriminator can easily identify. As training progresses, the generator continuously adjusts its parameters based on feedback from the discriminator, gradually improving the realism of the samples. At the same time, the discriminator also continuously learns the differences between real samples and optimized virtual samples, enhancing its discrimination ability.
[0116] II. Targeted Optimization of Defect Sample Generation
[0117] (a) Focusing on strategies for generating rare defects
[0118] For rare defects that occur infrequently but have a significant impact in watch component production (such as edge chipping at specific angles and micro-aperture displacement), the generator uses reinforcement learning to focus on learning the characteristics of these defects. During training, real samples of rare defects are given higher weights, guiding the generator to prioritize generating diverse samples of this type of defect, such as edge chipping of different lengths and aperture defects with different degrees of displacement, to compensate for the lack of such data in the real sample library.
[0119] (ii) The linkage mechanism with the preliminary classification results
[0120] The generated defect samples are not randomly generated, but are linked to the preliminary classification results output in step 3. When the recognition accuracy of a certain type of defect in the preliminary classification is low (the misclassification rate for "deformed parts" exceeds 5%), the generator will increase the number of samples generated for that type of defect, and the generated samples will simulate the feature combinations that are prone to misclassification in the preliminary classification.
[0121] (III) Evaluation criteria for sample quality
[0122] To ensure the validity of the generated samples, quality assessment is conducted from three dimensions: first, feature consistency, the defect features of the generated samples (visual representation of scratch depth, geometric proportion of deformation) must be consistent with the physical characteristics of the real samples; second, diversity, covering different forms of the same defect type (scratches of different lengths and widths); and third, realism, through manual judgment and feature similarity analysis (comparing the feature distribution of real samples and generated samples), ensuring that the generated samples can be integrated into the original sample library for joint analysis.
[0123] III. Quantization Process of Bayesian Algorithm
[0124] (a) Collection and application of prior information
[0125] The quantification basis of the Bayesian algorithm is prior probability, which is the probability of various defects occurring based on historical production data or preliminary classification results.
[0126] (ii) Feature matching logic of likelihood function
[0127] The likelihood function measures the probability that sample features (including original image features and generated sample features) will appear under a specific defect type. For example, for "spotted pieces," the likelihood function analyzes the degree to which features such as the size and distribution density of spots in the sample match the typical features of this type of defect: if the spot features of a sample highly match the features of historical "spotted pieces," the likelihood value is high; if there are significant differences in features (abnormal spot shape), the likelihood value is low.
[0128] (III) Comprehensive Calculation of Posterior Probability
[0129] By combining the prior probability and the likelihood function, the posterior probability is obtained, which is the final quantified classification reliability. For example, if a part is initially classified as a "scratched part," combining the prior probability (the historical proportion of scratch defects) and the likelihood value (the degree of matching between the scratch features of the part and typical scratches), the posterior probability of it belonging to the "scratched part" category is calculated to be 92%, and the probability of it belonging to the "qualified part" category is 8%. This probability value quantifies the reliability of the classification result and provides a basis for subsequent decision-making.
[0130] IV. Output and Application of Target Classification Results
[0131] (a) Hierarchical presentation of quantitative results
[0132] The final output classification result includes not only the defect type ("scratched part" or "deformed part"), but also the corresponding posterior probability value, and is divided into different confidence levels according to the probability: high confidence (probability ≥ 90%), medium confidence (70%-90%), and low confidence (< 70%). For example, a part labeled "scratched part (high confidence)" can be directly identified as a defective part; a part labeled "deformed part (low confidence)" requires manual review to avoid misjudgment.
[0133] Its beneficial effects are as follows: 1. It achieves comprehensive capture of defect features, improving the accuracy and completeness of classification and identification. The classification results based on this are more reliable, significantly reducing the rates of missed detections and false detections. 2. This technical solution can be deployed on edge computing devices in industrial production lines, achieving millisecond-level real-time detection response, meeting the detection needs of high-speed production lines in the watchmaking industry, and improving production efficiency. 3. The system can quickly learn and generate relevant samples, incorporating new defects into the classification system, continuously improving its ability to identify new types of defects, adapting to the dynamic changes of the production line, and possessing strong flexibility and adaptability.
[0134] Please see Figure 2In the classification and identification method of defective watch parts based on vision technology, a DualPathNet dual-path convolutional neural network is established to extract local texture features and global geometric features from image data. The features are then weighted and fused using the SEBlock attention mechanism to obtain the fused feature data. The steps include:
[0135] Step 201: Establish a DualPathNet dual-path convolutional neural network, perform convolution operations through convolution kernels, extract preliminary features from the processed image data, and obtain a preliminary feature image;
[0136] Step 202: Pass the preliminary feature image through three convolutional blocks in sequence, with batch normalization and ReLU activation function added in between. This reduces the receptive field and captures local texture details in the image, including surface scratches and spots.
[0137] Step 203: Perform convolution operations on the processed image data through the convolution kernels of the DualPathNet dual-path convolutional neural network. The first convolution reduces the number of feature channels; the middle convolution extracts medium-scale geometric features; and the final convolution restores the number of channels.
[0138] Step 204: By increasing the receptive field, capture the global geometric features of the watch components, including at least the overall shape and outline.
[0139] The above describes embodiments of the present invention's method for classifying and identifying defective watch parts based on vision technology. Please refer to [link / reference]. Figure 3 A vision-based system for classifying and identifying defective watch parts includes the following modules:
[0140] The image data acquisition module is used to acquire image data of watch parts. It introduces an adaptive illumination correction algorithm and eliminates reflection interference through histogram equalization and Retinex enhancement technology to obtain processed image data.
[0141] The image feature fusion module is used to build a DualPathNet dual-path convolutional neural network to extract local texture features and global geometric features from image data respectively, and to perform weighted fusion of features through the SEBlock attention mechanism to obtain fused feature data.
[0142] The defect preliminary classification module is used to build a lightweight classifier based on the MobileNetV3 neural network. It inputs the fused feature data into the lightweight classifier for classification and outputs the preliminary classification results.
[0143] The defect target classification module is used to generate defect samples using GANs (Generative Adversarial Networks) based on the preliminary classification results, calculate the posterior probability using the Bayesian algorithm, and output the target classification results.
[0144] 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 preferred examples and are not intended to limit 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 method for classifying and identifying defective parts in watch components based on vision technology, characterized in that, The method for classifying and identifying defective watch parts includes the following steps: Image data of watch parts is acquired, an adaptive illumination correction algorithm is introduced, and histogram equalization and Retinex enhancement techniques are used to eliminate reflection interference to obtain processed image data. A DualPathNet dual-path convolutional neural network is established to extract local texture features and global geometric features from the processed image data, respectively. The features are then weighted and fused using the SEBlock attention mechanism to obtain fused feature data. A lightweight classifier is built based on the MobileNetV3 neural network. The fused feature data is input into the lightweight classifier for classification, and a preliminary classification result is output. Based on the preliminary classification results, defect samples are generated using GANs (Generative Adversarial Networks), and the posterior probability is calculated using a Bayesian algorithm to output the target classification results. The DualPathNet dual-path convolutional neural network is established to extract local texture features and global geometric features from the processed image data, respectively. The features are then weighted and fused using the SEBlock attention mechanism to obtain fused feature data, including: A DualPathNet dual-path convolutional neural network is established. Convolution operations are performed through convolution kernels to extract preliminary features from the processed image data and obtain a preliminary feature image. The initial feature image is passed through three convolutional blocks in sequence, with batch normalization and ReLU activation function added in between. This reduces the receptive field and captures local texture details in the image, including surface scratches and spots. The processed image data is convolved using the convolution kernels of the DualPathNet dual-path convolutional neural network. The first convolution reduces the number of feature channels; the middle convolution extracts medium-scale geometric features; and the final convolution restores the number of channels. By increasing the receptive field, the global geometric features of watch components can be captured, including their overall shape and outline. The step of establishing a DualPathNet dual-path convolutional neural network to extract local texture features and global geometric features from the processed image data, and then using the SEBlock attention mechanism to perform weighted fusion of features to obtain fused feature data, further includes: Global average pooling is performed on local texture features and global geometric features to compress the features of each channel into a scalar, thus obtaining the channel descriptor; The channel descriptors are reduced in dimensionality by using a fully connected layer, and then the dimensionality is restored by using a ReLU activation function. Finally, the weight of each channel is obtained by using a Sigmoid activation function. The obtained weights are multiplied by the corresponding feature maps, and the features of each channel are weighted and adjusted. Important features are given higher weights to obtain fused feature data. The lightweight classifier built based on the MobileNetV3 neural network is used to classify the fused feature data and output preliminary classification results, including: The fused feature data is input into a lightweight classifier, and the convolutional layer extracts deep patterns from the fused features through convolutional kernels of different sizes, amplifying the difference between the texture features of the scratch and the surrounding normal texture. Pooling layers select the maximum and average values of local regions to retain key information while compressing the feature map size, thus obtaining high-dimensional feature regions. The fully connected layer maps high-dimensional features to a predefined classification space and outputs preliminary classification results, including qualified parts, scratched parts, deformed parts, and spotted parts. The process involves generating defect samples using GANs (Generative Adversarial Networks) based on the preliminary classification results, calculating the posterior probability using a Bayesian algorithm, and outputting the target classification result, including: The discriminator extracts the feature details of the samples through multi-layer convolution operations and analyzes whether the defect features in the image conform to the real physical laws. The generator prioritizes generating diverse defect samples, assigning higher weights to real samples with rare defects. When the recognition accuracy of a certain type of defect is low in the initial classification, the generator will increase the number of samples generated for that type of defect, and the generated samples will simulate the feature combinations that are easily misjudged in the initial classification. The step of generating defect samples using GANs (Generative Adversarial Networks) based on the preliminary classification results, calculating the posterior probability using a Bayesian algorithm, and outputting the target classification result further includes: The classification confidence is quantified by the probability of occurrence of various defects based on the preliminary classification results using the Bayesian algorithm, and the target classification result is output. The quantification basis of the Bayesian algorithm is the prior probability, that is, the probability of occurrence of various defects based on the preliminary classification results.
2. The method for classifying and identifying defective watch parts based on vision technology as described in claim 1, characterized in that, The process involves acquiring image data of watch parts, introducing an adaptive illumination correction algorithm, and using histogram equalization and Retinex enhancement techniques to eliminate reflection interference, resulting in processed image data, including: Acquire image data of watch parts and calculate the number of pixels in the image data of each gray level of the watch parts and calculate the number of pixels in the image; Calculate the cumulative distribution function to map the gray values of the original image to a new gray value range; thus obtaining equalized image data. The original image is subjected to a logarithmic transformation, which converts multiplication into addition. The illumination component is estimated using a Gaussian filtering method. The logarithmic form of the reflection component is obtained by calculation, and then an exponential transformation is performed to obtain the reflection component, thus obtaining the processed image data.
3. A vision-based system for classifying and identifying defective watch parts, used to implement the vision-based method for classifying and identifying defective watch parts as described in claim 1, characterized in that... The watch parts defect classification and identification system includes the following modules: The image data acquisition module is used to acquire image data of watch parts. It introduces an adaptive illumination correction algorithm and eliminates reflection interference through histogram equalization and Retinex enhancement technology to obtain processed image data. The image feature fusion module is used to establish a DualPathNet dual-path convolutional neural network to extract local texture features and global geometric features from the processed image data, and to perform weighted fusion of features through the SEBlock attention mechanism to obtain fused feature data. The defect preliminary classification module is used to build a lightweight classifier based on the MobileNetV3 neural network, input the fused feature data into the lightweight classifier for classification, and output the preliminary classification result; The defect target classification module is used to generate defect samples using GANs (Generative Adversarial Networks) based on the preliminary classification results, calculate the posterior probability using a Bayesian algorithm, and output the target classification results. The defect target classification module includes the following sub-modules: The discriminator submodule is used by the discriminator to extract feature details of samples through multi-layer convolution operations and analyze whether the defect features in the image conform to the real physical laws. The generator submodule is used to assign higher weights to real samples of rare defects. The generator prioritizes generating diverse samples of defects. When the recognition accuracy of a certain type of defect is low in the initial classification, the generator will increase the number of samples generated for that type of defect. The generated samples will simulate the feature combinations that are easily misjudged in the initial classification. The defect target classification module includes the following sub-modules: The output submodule is used to quantify the classification confidence based on the probability of occurrence of various defects statistically calculated from the preliminary classification results using the Bayesian algorithm, and output the target classification result. The quantization basis of the Bayesian algorithm is the prior probability, that is, the probability of occurrence of various defects statistically calculated from the preliminary classification results.
Citation Information
Patent Citations
Packing material defect detection method and system based on machine vision
CN120356002A