Method and device for training appearance quality high-precision detection model, and electronic equipment
The high-precision detection model built using deep learning networks and data augmentation strategies solves the problems of large model parameters and high computational cost in the detection of appearance defects in industrial products. It achieves high-speed, high-resolution, and high-precision detection results, and improves the robustness and adaptability of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- QINGDAO HAIGAO DESIGN & MANUFACTURING CO LTD
- Filing Date
- 2026-06-11
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies for detecting appearance defects in industrial products suffer from problems such as large model parameters, high computational cost, insufficient generalization and robustness, making it difficult to achieve high-speed, high-resolution, and high-precision detection. Furthermore, they are ill-suited to issues such as sample imbalance and image defocusing.
A deep learning network is used to build the basic model. The model combines deep convolutional modules, residual unit modules and global average pooling modules. A center weight mechanism and data augmentation strategy are introduced to build a high-precision detection model, reduce computational overhead, improve the stability and robustness of feature extraction, and alleviate the problem of imbalanced samples.
It achieves high-precision and high-robustness detection model training, is adapted to edge computing devices, improves the inference speed and detection accuracy of the model, and solves the problems of high computing power consumption, weak generalization ability, and high rate of missed and false detections of defects in traditional methods.
Smart Images

Figure CN122391216A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent industrial inspection technology, such as a training method and apparatus for a high-precision inspection model of appearance quality, and electronic equipment. Background Technology
[0002] Currently, high-speed production lines in the industrial sector have strong demands for high-speed, high-resolution, high-precision, and low-computing-power-consumption appearance defect detection. They need to stably identify minute defects such as scratches, color differences, dents, and paint peeling, while also dealing with challenges in industrial scenarios such as sample imbalance, image defocus, and multi-scale changes. Traditional manual and conventional vision solutions are difficult to balance efficiency and accuracy.
[0003] To address the need for automated inspection of industrial product appearance, a method for detecting appearance defects based on rule matching and traditional convolutional neural networks is disclosed. The method includes: image preprocessing, fixed threshold segmentation, manual feature extraction, fully connected layer classification, and bounding box regression. Standard convolution and a fixed receptive field are used for training with a large number of labeled samples.
[0004] In the process of implementing the embodiments of this disclosure, at least the following problems were found in the related art: The related technical models have large parameters and high computational requirements, making them difficult to deploy at edge devices. Furthermore, the technologies do not employ multi-resolution feature fusion, making it easy to miss minute defects. Their generalization and robustness are insufficient, failing to meet the demands of high-resolution real-time detection.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments, but rather as a prelude to the detailed description that follows.
[0007] This disclosure provides a training method, apparatus, and electronic device for a high-precision detection model of appearance quality, which enables the trained detection model to achieve accurate detection of the appearance of industrial products.
[0008] In some embodiments, the training method of the high-precision detection model for appearance quality includes: constructing a base model based on a deep learning network; wherein the base model includes a deep convolutional module, a residual unit module, and a global average pooling module; introducing a central weight function into the constructed detection model through a central weight mechanism; constructing an industrial product appearance image dataset according to a preset data augmentation strategy; and training the base model according to the industrial product appearance image dataset to obtain a detection model for detecting industrial product appearance images.
[0009] Optionally, the deep convolution module of the base model reduces the resolution of the original image; the residual unit module of the base model performs multi-scale feature extraction to obtain multi-scale information feature maps; and the global average pooling module of the base model extracts and retains the spatial information in the multi-scale information feature maps.
[0010] Optionally, the residual unit module of the base model performs multi-scale feature extraction to obtain a multi-scale information feature map, including: performing multi-scale feature extraction on the image through the residual unit module; upsampling and stitching the extracted features to obtain a fused multi-scale information feature map.
[0011] Optionally, the global average pooling module of the base model extracts and retains spatial information in the multi-scale information feature map, including: extracting spatial features of the multi-scale information feature map through the global average pooling module and generating a category-aware heatmap; and performing thresholding on the category-aware heatmap to extract the image's localization information.
[0012] Optionally, the center weight function can be introduced into the constructed detection model through a center weight mechanism, including multiplying the center weight value of the center weight function with the sample loss in the loss function to adjust the loss function of the detection model.
[0013] Optionally, the center weight function is as follows:
[0014] in, 'c' refers to the type of defect. and These are the coordinates within the defect. and These are the coordinates of the defect center, where w and h refer to the width and height of the defect. The kernel is Gaussian, and k is a parameter defining the neighborhood size, which is half the size of the convolution kernel. The weighting coefficients define the relative importance of each point within the neighborhood of the center point. With the center point, The eigenvalues are the eigenvalues within the neighborhood.
[0015] Optionally, preset data augmentation strategies include: randomly rotating, translating, scaling, cropping, and flipping the image.
[0016] In some embodiments, the training apparatus for the high-precision detection model of appearance quality includes: a model building module configured to build a base model based on a deep learning network; wherein the base model includes a deep convolution module, a residual unit module, and a global average pooling module; a function introduction module configured to introduce a central weight function into the built detection model through a central weight mechanism; a dataset building module configured to build an industrial product appearance image dataset according to a preset data augmentation strategy; and a model training module configured to train the base model according to the industrial product appearance image dataset to obtain a detection model for detecting industrial product appearance images.
[0017] In some embodiments, the training apparatus for the high-precision detection model of appearance quality includes: a processor and a memory storing program instructions, the processor being configured to execute the training method for the high-precision detection model of appearance quality as described above when the program instructions are executed.
[0018] In some embodiments, the electronic device includes: an electronic device body; and a training device for a high-precision detection model of appearance quality, as described above, mounted on the electronic device body.
[0019] The training method, apparatus, and electronic equipment for a high-precision detection model of appearance quality provided in this disclosure can achieve the following technical effects: In this embodiment, a deep learning base model comprising a deep convolution module, a residual unit module, and a global average pooling module is constructed. A central weight function is introduced into the detection model through a central weight mechanism. An industrial product appearance image dataset is constructed according to a preset data augmentation strategy. The model is trained using this dataset to obtain the final detection model. The deep convolution module significantly reduces the number of model parameters and computational overhead, adapting to edge computing devices in industrial settings. The residual unit module ensures the feature propagation capability of deep networks, avoids gradient vanishing, and improves the stability of small defect feature extraction. The global average pooling module replaces fully connected layers, reducing the risk of overfitting and compressing computation. The central weight mechanism can focus on key defect areas, alleviating the problem of imbalance between out-of-focus images and the ratio of positive to negative samples. The data augmentation strategy can significantly expand sample diversity, covering various defect morphologies such as scratches, color differences, dents, and paint peeling. In this way, high-precision and highly robust detection model training is achieved, improving the model's inference speed while maintaining high-resolution features, and solving the problems of traditional methods such as reliance on manual labor, high computational cost, weak generalization ability, and high false negative and false positive rates.
[0020] The above general description and the description below are exemplary and illustrative only and are not intended to limit this application. Attached Figure Description
[0021] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations and drawings do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are shown as similar elements. The drawings are not to be scaled. And wherein: Figure 1 This is a schematic diagram of the implementation environment of the detection model provided in this embodiment of the disclosure; Figure 2 This is a schematic diagram of a training method for a high-precision detection model for appearance quality provided in an embodiment of this disclosure; Figure 3 This is a schematic diagram illustrating the introduction of a central weight function into the constructed detection model through a central weight mechanism, as provided in an embodiment of this disclosure. Figure 4 This is a schematic diagram of a preset data augmentation strategy provided in an embodiment of this disclosure; Figure 5 This is a schematic diagram of a training device for a high-precision detection model of appearance quality provided in an embodiment of this disclosure; Figure 6 This is a schematic diagram of a training device for another high-precision detection model of appearance quality provided in an embodiment of this disclosure. Detailed Implementation
[0022] To provide a more detailed understanding of the features and technical content of the embodiments of this disclosure, the implementation of the embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for illustrative purposes only and are not intended to limit the embodiments of this disclosure. In the following technical description, for ease of explanation, several details are used to provide a full understanding of the disclosed embodiments. However, one or more embodiments may still be implemented without these details. In other cases, well-known structures and devices may be simplified in their depiction to simplify the drawings.
[0023] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this disclosure described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.
[0024] Unless otherwise stated, the term "multiple" means two or more.
[0025] In this embodiment of the disclosure, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.
[0026] The term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.
[0027] The term "correspondence" can refer to an association or binding relationship. The correspondence between A and B means that there is an association or binding relationship between A and B.
[0028] In the production process of home appliances, the quality inspection of the appliance casing is a crucial step, directly affecting the appearance quality of the appliance. Quality inspection of appliance casings involves numerous items and requires high standards. These include whether the casing is flat, whether the spacing between multiple casings is uniform, whether printed materials such as markings and energy consumption labels meet standards, and whether the casing surface has stains, dents, scratches, color differences, etc. There is an urgent need for a fast, efficient, and accurate inspection method to work in conjunction with the home appliance production line to meet production requirements.
[0029] Although most manufacturers have automated their production lines to some extent, monitoring product appearance quality still requires significant human intervention. Furthermore, manual inspection during component manufacturing is not only time-consuming and labor-intensive but also unreliable. Establishing vision-based automated inspection systems on continuous production lines can largely solve these problems. While traditional image processing techniques offer effective methods for appearance inspection, they cannot efficiently handle external noise and environmental changes on continuous production lines. Their slow processing speed, high sensitivity to image background, and requirement for large training datasets and high computational power limit their applicability for automated appearance inspection.
[0030] Therefore, a detection model is needed that can accurately inspect the appearance of industrial products. Figure 1 This is a schematic diagram of the implementation environment of the detection model according to an embodiment of this disclosure. For example... Figure 1 As shown, the implementation environment may include an industrial product image 100 to be detected, an industrial product appearance image dataset 200, and a detection model 300.
[0031] It should be understood that Figure 1 The industrial product appearance image dataset 200 is used to train the base model to finally obtain the detection model 300. After inputting the industrial product image 100 to be detected into the trained detection model 300, the accurate detection results output by the detection model 300 can be obtained.
[0032] Combination Figure 2 As shown in the embodiments of this disclosure, a training method for a high-precision detection model of appearance quality is provided, including: S201, the processor builds a basic model based on a deep learning network; the basic model includes a deep convolution module, a residual unit module, and a global average pooling module.
[0033] S202, the processor introduces the central weight function into the constructed detection model through the central weight mechanism.
[0034] S203, the processor constructs an industrial product appearance image dataset according to a preset data augmentation strategy.
[0035] S204: The processor trains a base model based on a dataset of industrial product appearance images to obtain a detection model for detecting industrial product appearance images.
[0036] The training method for the high-precision appearance quality detection model provided in this disclosure constructs a deep learning basic model including a deep convolution module, a residual unit module, and a global average pooling module. A central weight function is introduced into the detection model through a central weight mechanism. An industrial product appearance image dataset is constructed according to a preset data augmentation strategy. The model is then trained using this dataset to obtain the final detection model. The deep convolution module significantly reduces the number of model parameters and computational overhead, adapting to edge computing devices in industrial settings. The residual unit module ensures the feature propagation capability of deep networks, avoids gradient vanishing, and improves the stability of small defect feature extraction. The global average pooling module replaces fully connected layers, reducing the risk of overfitting and compressing computation. The central weight mechanism can focus on key defect areas, alleviating the imbalance between out-of-focus images and the ratio of positive to negative samples. The data augmentation strategy can significantly expand sample diversity, covering various defect morphologies such as scratches, color differences, dents, and paint peeling. This achieves high-precision and robust detection model training, improving the model's inference speed while maintaining high-resolution features, and solving the problems of traditional methods such as reliance on manual labor, high computational cost, weak generalization ability, and high false negative and false positive rates.
[0037] Optionally, the deep convolution module of the base model reduces the resolution of the original image; the residual unit module of the base model performs multi-scale feature extraction to obtain multi-scale information feature maps; and the global average pooling module of the base model extracts and retains the spatial information in the multi-scale information feature maps.
[0038] In this embodiment, the depthwise convolution module uses a 3×3 depthwise convolution kernel to replace the standard convolution operation. Depthwise convolution decomposes the convolution operation, breaking it down into channel-by-channel convolution operations, thereby significantly reducing the number of model parameters and improving the model's computational efficiency.
[0039] By adding residual unit modules to the base model, the residual units enable information to propagate more effectively in the network through shortcut paths that directly connect the input and output, thus alleviating the gradient vanishing problem in deep neural networks and improving the accuracy of feature extraction.
[0040] The global average pooling module introduces global average pooling to replace fully connected layers, further reducing computational complexity while effectively preventing overfitting. During model training, a learning rate decay mechanism is employed, enabling the model to converge to the optimal solution more quickly in the later stages of training. Furthermore, the output of each layer in the network is normalized to effectively prevent gradient explosion or vanishing gradient problems and accelerate model training.
[0041] In this embodiment, the modules work together to enable the model to maintain efficient inference even with high-resolution input, enhance its adaptability to complex backgrounds, lighting changes, slight defocusing and other scenarios, and improve the stability and accuracy of industrial product appearance defect detection.
[0042] Optionally, the residual unit module of the base model performs multi-scale feature extraction to obtain a multi-scale information feature map, including: performing multi-scale feature extraction on the image through the residual unit module; upsampling and stitching the extracted features to obtain a fused multi-scale information feature map.
[0043] In this embodiment, the resolution of the feature map is reduced to one-quarter of the original input image using two 3×3 convolutional layers with strides, thus reducing computational cost while preserving key information. The base model then proceeds to four consecutive stages, each containing a different number of multi-resolution blocks. The first stage specifically includes five residual units, each employing a bottleneck structure with a width of 64 channels, and a 3×3 convolutional layer at the end of each unit adjusts the feature map width to C channels. In the second, third, and fourth stages, the number of multi-resolution blocks is 1, 4, and 3, respectively. Each branch within each multi-resolution block contains five residual units, each consisting of two 3×3 convolutional layers capable of extracting and transmitting feature information at each resolution. In the fourth stage, the convolutional widths of the four branches are C, 2C, 4C, and 8C, respectively, enabling the network to handle features at different scales while maintaining high feature representation capabilities. Specifically, the value of C can be set to 18.
[0044] In the task of inspecting the appearance of industrial products, since there may be defects in the appearance of industrial products, the appearance defects in the images may appear at different scales. Therefore, the embodiments of this disclosure use the output of all four branches of the fourth stage, adopt upsampling technology to upscale the lower resolution feature map to the highest resolution, and then stitch them together to unify the feature maps of different resolutions to the same scale, forming a multi-scale information feature map, thereby improving the accuracy and robustness of defect localization.
[0045] Optionally, the global average pooling module of the base model extracts and retains spatial information in the multi-scale information feature map, including: extracting spatial features of the multi-scale information feature map through the global average pooling module and generating a category-aware heatmap; and performing thresholding on the category-aware heatmap to extract the image's localization information.
[0046] In this embodiment, the global average pooling module consists of two components: a category-aware module and a category-aware pooling module. The category-aware module converts spatial feature maps into classification vectors so that the network can be trained under the supervision of image label annotations. Category-aware spatial information is extracted and preserved as a category-aware heatmap. The category-aware module extracts and preserves spatial information through a coarse-to-fine pipeline. The coarse pipeline assigns multi-channel feature maps to each defect class to extract its spatial information. The fine pipeline converts the spatial information of each class into a single-channel feature map.
[0047] This embodiment uses the obtained category-aware heatmap to extract the region with the highest score for each category and uses it for point-to-point localization. This involves thresholding the category-aware heatmap to extract object localization information, adjusting the size of the category-aware heatmap to match the size of the input image, and selecting the adjusted heatmap size as the category score output by the category-aware pool when converting the heatmap into a classification vector. Figure 2 The threshold is valued, and finally the bounding box is obtained on the threshold heatmap.
[0048] In this way, through the efficient extraction and retention of spatial information, the model can accurately distinguish the defect type and output the location coordinates, meeting the requirements of industrial product appearance inspection for high-precision and high-stability positioning. This allows the model to quickly output inspection results in the actual production line, reducing the cost of manual re-inspection and improving the overall inspection efficiency and reliability.
[0049] Optionally, the center weight function can be introduced into the constructed detection model through a center weight mechanism, including multiplying the center weight value of the center weight function with the sample loss in the loss function to adjust the loss function of the detection model.
[0050] Combination Figure 3 As shown, this disclosure provides another method for training a high-precision detection model for appearance quality, including: S301, the processor builds a basic model based on a deep learning network; the basic model includes a deep convolution module, a residual unit module, and a global average pooling module.
[0051] S302, the processor multiplies the center weight value of the center weight function with the sample loss in the loss function to adjust the loss function of the detection model.
[0052] S303, the processor constructs an industrial product appearance image dataset according to a preset data augmentation strategy.
[0053] S304 The processor trains a base model based on a dataset of industrial product appearance images to obtain a detection model for detecting industrial product appearance images.
[0054] In this embodiment, the center weight value calculated by the center weight function is multiplied by the sample loss in the loss function to achieve dynamic adjustment of the loss function. During model training, industrial product appearance defects typically account for a small proportion of images, leading to an extreme imbalance between positive and negative samples. Traditional loss functions tend to bias the model towards the majority class of negative samples, resulting in missed defect detections. The center weight value is generated based on the defect center distance and a Gaussian kernel weighting, assigning higher weights to the defect center region and gradually decreasing weights to the edge region. This makes the model training more focused on the key defect regions, strengthening the learning of effective samples.
[0055] Multiplying the weights by the sample loss dynamically suppresses the loss contribution of a large number of simple negative samples, enhances the gradient influence of difficult positive samples, and alleviates the problem of decreased model generalization ability caused by sample imbalance. This mechanism can significantly improve the model's sensitivity to minor defects, weak contrast defects, and edge defects, and reduce detection bias caused by out-of-focus and noisy images. During training, the model can converge to the optimal solution faster, improving the accuracy of keypoint prediction and classification reliability, and enabling the detection model to maintain stable output on high-resolution images. By optimizing the loss function, the model can achieve higher detection accuracy and stronger robustness on real industrial data, meeting the requirements of high-speed, high-precision, and high-stability inspection of industrial product appearance.
[0056] Optionally, the center weight function is as follows:
[0057] in, 'c' refers to the type of defect. and These are the coordinates within the defect. and These are the coordinates of the defect center, where w and h refer to the width and height of the defect. The kernel is Gaussian, and k is a parameter defining the neighborhood size, which is half the size of the convolution kernel. The weighting coefficients define the relative importance of each point within the neighborhood of the center point. With the center point, The eigenvalues are the eigenvalues within the neighborhood.
[0058] In model training, the central weight function can effectively reduce negative sample interference, improve positive sample learning efficiency, improve sample imbalance, and enhance defect localization and classification accuracy, enabling the detection model to achieve a balance between accuracy and speed in high-resolution appearance detection tasks.
[0059] Optionally, a Gaussian kernel can be applied to focus on the central region. The formula for the Gaussian kernel is defined as follows:
[0060] in, It is an adaptive standard deviation, where 'c' refers to the defect category. and These are the coordinates within the defect. and These are the coordinates of the defect center. The obtained category-aware heatmap shows that it considers global defects and gives greater weight to the central region.
[0061] The keypoint loss can regress as the focus loss improves. The keypoint loss function is:
[0062] Where c refers to the defect category, and x and y are the coordinates within the defect. Refers to the ground-based heat map initialized with central weights. It predicts the score at position (x, y) of class c in the heatmap. and These are hyperparameters set according to conventional detectors, typically 2 and 4. Focus loss is used to suppress the weights of negative samples and increase the weights of positive samples, making it easier for the network to determine keypoints and their categories.
[0063] Optionally, preset data augmentation strategies include: randomly rotating, translating, scaling, cropping, and flipping the image.
[0064] Combination Figure 4 As shown, this disclosure provides another method for training a high-precision detection model for appearance quality, including: S401, the processor builds a basic model based on a deep learning network; the basic model includes a deep convolution module, a residual unit module, and a global average pooling module.
[0065] S402, the processor introduces the central weight function into the constructed detection model through the central weight mechanism.
[0066] The S403 processor randomly rotates, translates, scales, crops, and flips images to build an industrial product appearance image dataset.
[0067] S404 The processor trains a base model based on a dataset of industrial product appearance images to obtain a detection model for detecting industrial product appearance images.
[0068] In this embodiment of the disclosure, the specific data augmentation strategy is as follows: Random rotation: The image was randomly rotated within a range of 0 to 360 degrees. Defects in industrial settings often appear on product surfaces at different angles, and due to vibrations from production line equipment or the randomness of product positioning, defects exhibit different characteristics at different angles. Through random rotation, the model can learn to identify the same defects at various rotation angles.
[0069] Translation: The image is shifted by 0% to 10% of its size in the horizontal or vertical direction, simulating the possibility that defects may appear in different locations.
[0070] Scaling: Image scaling is performed in the range of 0% to 5%. This scaling operation enables the model to learn to identify defects of different sizes, enhancing the model's sensitivity and adaptability to size changes.
[0071] Cropping: Perform random cropping operations within the range of 0% to 5% of the image size. Cropping can simulate the situation where some defects are occluded, thus enabling the model to learn to identify defects even with incomplete information.
[0072] Flipping: By randomly flipping the image data in the horizontal or vertical direction, the diversity of the image data is further increased, which prompts the model to learn symmetry features, thereby improving the ability to detect defects with symmetry.
[0073] Data augmentation expands the training set from an initial limited number of samples to approximately 20,000. The augmented samples cover a wide range of defect types, including punching defects, weld lines, crescent gaps, water spots, oil spots, silk spots, inclusions, rolling dents, creases, cracks, dented surfaces, entangled scales, scratches, bubbles, discoloration, and paint peeling. Each defect type has its own characteristics; some are minor surface variations, while others may be structural defects caused by material or manufacturing process issues. Before data augmentation, the entire industrial product appearance image dataset was randomly divided into training and test sets, each accounting for 50% of the total samples. This ensured the effectiveness of the augmentation operation and avoided model evaluation bias caused by improper dataset partitioning. The augmented samples retain the same distribution characteristics as the original data, enabling the augmented model to exhibit detection capabilities consistent with real-world production environments on the test set.
[0074] Data augmentation enables models to learn more comprehensive defect representations, reducing the risk of overfitting and improving generalization ability in new environments, new products, and new defects. Ultimately, this makes the detection model more stable and adaptable in actual production, allowing for rapid deployment on different industrial production lines to achieve high-precision, high-reliability automated detection of appearance defects.
[0075] Combination Figure 5 As shown in the embodiments of this disclosure, a training device 500 for a high-precision detection model of appearance quality is provided, including a model building module 501, a function introduction module 502, a dataset building module 503, and a model training module 504. The model building module 501 is configured to build a base model based on a deep learning network; wherein, the base model includes a deep convolution module, a residual unit module, and a global average pooling module; the function introduction module 502 is configured to introduce a central weight function into the built detection model through a central weight mechanism; the dataset building module 503 is configured to build an industrial product appearance image dataset according to a preset data augmentation strategy; the model training module 504 is configured to train the base model based on the industrial product appearance image dataset to obtain a detection model for detecting industrial product appearance images.
[0076] The training device 500 using the high-precision appearance quality detection model provided in this embodiment comprises the following modules: a model building module 501 constructs a deep learning base model including a deep convolution module, a residual unit module, and a global average pooling module; a function introduction module 502 introduces the central weight function into the detection model through a central weight mechanism; a dataset construction module 503 constructs an industrial product appearance image dataset according to a preset data augmentation strategy; and a model training module 504 uses this dataset to complete model training and obtain the final detection model. The deep convolution module significantly reduces the number of model parameters and computational overhead, adapting to edge computing devices in industrial settings. The residual unit module ensures the feature propagation capability of deep networks, avoids gradient vanishing, and improves the stability of small defect feature extraction. The global average pooling module replaces fully connected layers, reducing the risk of overfitting and compressing computation. The central weight mechanism can focus on key defect areas, alleviating the problem of imbalance between out-of-focus images and the ratio of positive to negative samples. The data augmentation strategy can significantly expand sample diversity, covering various defect morphologies such as scratches, color differences, dents, and paint peeling. In this way, high-precision and high-robustness detection model training is achieved, which improves the inference speed of the model while maintaining high-resolution features, and solves the problems of traditional methods such as reliance on manual labor, high computing power consumption, weak generalization ability, and high rate of missed and false detections of defects.
[0077] Combination Figure 6As shown, this embodiment of the present disclosure provides a training device 500 for a high-precision detection model of appearance quality, including a processor 600 and a memory 601. Optionally, the training device 500 may further include a communication interface 602 and a bus 603. The processor 600, communication interface 602, and memory 601 can communicate with each other via the bus 603. The communication interface 602 can be used for information transmission. The processor 600 can call logical instructions in the memory 601 to execute the training method of the high-precision detection model of appearance quality described in the above embodiment.
[0078] Furthermore, the logic instructions in the aforementioned memory 601 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0079] The memory 601, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this disclosure. The processor 600 executes functional applications and data processing by running the program instructions / modules stored in the memory 601, that is, it implements the training method of the high-precision detection model of appearance quality in the above embodiments.
[0080] The memory 601 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 601 may include high-speed random access memory and may also include non-volatile memory.
[0081] This disclosure provides an electronic device, including: an electronic device body, and a training device for the high-precision detection model of appearance quality described above. The training device for the high-precision detection model of appearance quality is mounted on the electronic device body. The mounting relationship described herein is not limited to placement inside the electronic device body, but also includes mounting connections with other components of the electronic device, including but not limited to physical connections, electrical connections, or signal transmission connections. Those skilled in the art will understand that the training device for the high-precision detection model of appearance quality can be adapted to feasible electronic device bodies, thereby realizing other feasible embodiments.
[0082] The technical solutions of this disclosure can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes one or more instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in this disclosure. The aforementioned storage medium can be a non-transitory storage medium, such as a USB flash drive, external hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc., and other media capable of storing program code.
[0083] The foregoing description and accompanying drawings fully illustrate embodiments of this disclosure to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operation may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the terminology used in this application is for describing embodiments only and is not intended to limit the claims. As used in the description of embodiments and claims, the singular forms “a,” “an,” and “the” are intended to equally include the plural forms unless the context clearly indicates otherwise. Similarly, the term “and / or” as used in this application means including one or more of the associated listed items and all possible combinations thereof. Additionally, when used in this application, the term "comprise" and its variations "comprises" and / or "comprising" refer to the presence of stated features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof. Without further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes said element. In this document, each embodiment may focus on the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., disclosed in the embodiments, if they correspond to the method section disclosed in the embodiments, the relevant parts can be referred to the description of the method section.
[0084] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this disclosure. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0085] The methods and products disclosed in the embodiments herein (including but not limited to devices and equipment) can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units may be merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to implement this embodiment according to actual needs. In addition, the functional units in the embodiments of this disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0086] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in a block diagram and / or flowchart, and combinations of blocks in a block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
Claims
1. A training method for a high-precision detection model for appearance quality, characterized in that, include: Construct a basic model based on deep learning networks; the basic model includes a deep convolution module, a residual unit module, and a global average pooling module; The central weighting function is introduced into the constructed detection model through a central weighting mechanism. Based on the preset data augmentation strategy, construct an industrial product appearance image dataset; Based on a dataset of industrial product appearance images, a base model is trained to obtain a detection model for detecting industrial product appearance images.
2. The method according to claim 1, characterized in that, include: The depthwise convolution module of the base model reduces the resolution of the original image; The residual unit module of the basic model performs multi-scale feature extraction to obtain multi-scale information feature maps; The global average pooling module of the base model extracts and retains spatial information in the multi-scale information feature map.
3. The method according to claim 2, characterized in that, The residual unit module of the basic model performs multi-scale feature extraction to obtain multi-scale information feature maps, including: Multi-scale feature extraction is performed on the image using the residual unit module; The extracted features are upsampled and concatenated to obtain a fused multi-scale information feature map.
4. The method according to claim 2, characterized in that, The global average pooling module of the base model extracts and preserves spatial information from multi-scale feature maps, including: Spatial features of multi-scale information feature maps are extracted using a global average pooling module, and category-aware heatmaps are generated. Thresholding is applied to category-aware heatmaps to extract localization information from the images.
5. The method according to any one of claims 1 to 4, characterized in that, The central weighting mechanism incorporates the central weighting function into the constructed detection model, including: The center weight value of the center weight function is multiplied by the sample loss in the loss function to adjust the loss function of the detection model.
6. The method according to any one of claims 1 to 4, characterized in that, The center weight function is as follows: in, 'c' refers to the type of defect. and These are the coordinates within the defect. and These are the coordinates of the defect center, where w and h refer to the width and height of the defect. The kernel is Gaussian, and k is a parameter defining the neighborhood size, which is half the size of the convolution kernel. The weighting coefficients define the relative importance of each point within the neighborhood of the center point. With the center point, The eigenvalues are the eigenvalues within the neighborhood.
7. The method according to any one of claims 1 to 4, characterized in that, Pre-defined data augmentation strategies include: Perform random rotation, translation, scaling, cropping, and flipping on the image.
8. A training device for a high-precision detection model of appearance quality, characterized in that, include: The model building module is configured to build a base model based on a deep learning network; the base model includes a deep convolution module, a residual unit module, and a global average pooling module. The function import module is configured to import the central weight function into the constructed detection model through the central weight mechanism; The dataset building module is configured to build an industrial product appearance image dataset based on a preset data augmentation strategy; The model training module is configured to train a base model based on a dataset of industrial product appearance images to obtain a detection model for detecting industrial product appearance images.
9. A training device for a high-precision detection model of appearance quality, characterized in that, It includes a processor and a memory storing program instructions, the processor being configured to, when executing the program instructions, perform a training method for a high-precision detection model of appearance quality as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, include: The electronic device itself; The training device for the high-precision detection model of appearance quality as described in claim 8 or 9 is installed on the electronic device body.