Visual detection method for quality of alloy shell of gearbox
By generating an adversarial network to expand defect samples and building a residual neural network, the problems of scarcity and complex defects in the detection of transmission alloy shell defects are solved, and visual detection with high accuracy is achieved.
Patent Information
- Application Number
- CN202510397051.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-07-08
AI Technical Summary
In the quality inspection of transmission alloy shell, the defect rate is less than 0.1%, resulting in scarce defect samples. It is difficult for ordinary computer vision models to achieve high accuracy detection effect, and the defects are complex and changeable.
By generating adversarial network models to expand defect samples, build a residual neural network model, realize positive and negative sample balance of the data set, and convert the detection task into a binary classification task, and use the residual neural network for training and detection.
It realizes high accuracy detection in the case of scarce defect samples, solves the problem of complex and changeable defects in the transmission alloy shell, and improves the accuracy of detection.
Smart Images

Figure CN120278977A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of visual inspection, and particularly to a method for visually inspecting the quality of a gearbox alloy housing. Background Art
[0002] In the automated production process of a gearbox, it is necessary to perform quality inspections on the finished parts to be assembled to prevent unqualified products from entering the production line. During this process, when inspecting the quality of a gearbox alloy housing, in addition to inspecting the quality of the gearbox alloy housing from the perspectives of weight, dimensions, and material technology, it is also necessary to use computer vision inspection technology to visually inspect the quality of the gearbox alloy housing.
[0003] However, in an actual production line, the defect rate is usually less than 0.1%. Therefore, the image samples of defective gearbox alloy housings are very few. The lack of defective samples will make it difficult to carry out the quality inspection task based on computer vision. In addition, the defects on the gearbox alloy housing are complex and variable, and it is difficult to achieve a high accuracy rate when using an ordinary computer vision model for quality inspection. Summary of the Invention
[0004] The purpose of the present invention is to provide a method for visually inspecting the quality of a gearbox alloy housing, aiming to solve the problems that in an actual production line, the defect rate is usually less than 0.1%, so the image samples of defective gearbox alloy housings are very few, the lack of defective samples will make it difficult to carry out the quality inspection task based on computer vision, and the defects on the gearbox alloy housing are complex and variable, and it is difficult to achieve a high accuracy rate when using an ordinary computer vision model for quality inspection.
[0005] In view of the above problems, the present application provides a method for visually inspecting the quality of a gearbox alloy housing.
[0006] In the first aspect disclosed in the present application, a method for visually inspecting the quality of a gearbox alloy housing is provided. The method includes the following steps: Collect images of defective and non-defective gearbox alloy housings, and expand the images of defective gearbox alloy housings through a generative adversarial network model to generate a first image dataset of gearbox alloy housings; Perform preprocessing operations on all the gearbox alloy housing images in the first image dataset of gearbox alloy housings to generate a second image dataset of gearbox alloy housings; Construct a residual neural network model and perform an initialization operation. Use the second image dataset of gearbox alloy housings to iteratively train the residual neural network model until the loss function of the residual neural network model converges, and generate a trained residual neural network model; The real-time image of the gearbox alloy housing is obtained by the image acquisition device on the production line. After preprocessing operations, it is input into the trained residual neural network model to generate the confidence of defects in the real-time gearbox alloy housing.
[0007] Preferably, the defective and non-defective images of the gearbox alloy housing are collected, and the defective images of the gearbox alloy housing are augmented through a generative adversarial network model to generate the first image dataset of the gearbox alloy housing, specifically including: Collect defective and non-defective images of the gearbox alloy housing, and convert all images into a unified format and size. Among them, the defective images of the gearbox alloy housing cover various types of defects; Construct the generator and discriminator of the generative adversarial network model, perform initialization operations, and iteratively train the generator and discriminator using the defective and non-defective images of the gearbox alloy housing until the loss functions of the discriminator and generator tend to converge, generating the trained generative adversarial network model; The generator of the trained generative adversarial network model adds defects to specific regions in the non-defective images of the gearbox alloy housing according to the learned patterns, and keeps other regions unchanged, generating defective images of the gearbox alloy housing; Repeat generating defective images of the gearbox alloy housing until the defective and non-defective images of the gearbox alloy housing reach sample balance, generating the first image dataset of the gearbox alloy housing.
[0008] Preferably, the construction of the generator and discriminator of the generative adversarial network model, and the initialization operation, and the iterative training of the generator and discriminator using the defective and non-defective images of the gearbox alloy housing specifically include: Construct the generator and discriminator of the generative adversarial network model. The generator is composed of a U-Net model, which is used to add defects to specific regions in the non-defective images of the gearbox alloy housing to generate defective images of the gearbox alloy housing. The discriminator is composed of convolutional layers, pooling layers, and fully connected layers, and finally outputs the real probability through a sigmoid activation function to determine whether the defective images of the gearbox alloy housing generated by the generator are real; Initialize the parameters of the generator and discriminator by randomly sampling from the standard normal distribution. Use the non-defective images of the gearbox alloy housing as the input of the generator, and use the defective images of the gearbox alloy housing generated by the generator as the input of the discriminator; According to the loss functions of the discriminator and generator, through backpropagation, iteratively train the generator and discriminator simultaneously.
[0009] Preferably, the preprocessing operation specifically includes: For each channel of the image, the non - linear function in Equation (1) is used to perform non - linear transformation on the values of all pixels in the current channel: Equation (1) Wherein, is used to represent the value of a pixel, is used to represent the value of the pixel after non - linear transformation, is used to represent the maximum value among the values of all pixels in the current channel.
[0010] In the second aspect disclosed in the present application, a visual inspection system for the quality of a gearbox alloy housing is provided. The system is used for the above - mentioned method for visual inspection of the quality of a gearbox alloy housing, and the system includes: A generative adversarial module, which is used to collect defective and non - defective gearbox alloy housing images, expand the defective gearbox alloy housing images through a generative adversarial network model, and generate a first image dataset of gearbox alloy housings; A pre - processing module, which is used to perform pre - processing operations on all gearbox alloy housing images in the first image dataset of gearbox alloy housings to generate a second image dataset of gearbox alloy housings; A residual network module, which is used to construct a residual neural network model and perform an initialization operation, and iteratively train the residual neural network model using the second image dataset of gearbox alloy housings until the loss function of the residual neural network model converges, generating a trained residual neural network model; A real - time detection module, which is used to obtain real - time gearbox alloy housing images by using an image acquisition device on the production line, perform pre - processing operations and then input them into the trained residual neural network model to generate the confidence of defects in real - time gearbox alloy housings.
[0011] In the third aspect disclosed in the present application, a computer device is provided, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the above - mentioned method for visual inspection of the quality of a gearbox alloy housing are implemented.
[0012] In the fourth aspect disclosed in the present application, a computer - readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above - mentioned method for visual inspection of the quality of a gearbox alloy housing are implemented.
[0013] In the fifth aspect disclosed in the present application, a computer program product is provided, including a computer program or instruction. When the computer program or instruction is executed by a processor, the steps of the above - mentioned method for visual inspection of the quality of a gearbox alloy housing are implemented.
[0014] The beneficial effects of the present invention are as follows: (1) By using a generative adversarial network model to augment defective gearbox alloy housing images, the problem that computer vision detection tasks are difficult to perform due to the lack of defect samples is solved, and the balance between positive and negative samples in the dataset is achieved. (2) Using a residual neural network, the visual inspection task of the quality of the gearbox alloy housing is transformed into a computer vision binary classification detection task, solving the problem that the defects on the gearbox alloy housing are complex and variable, and it is difficult to improve the detection accuracy. Description of the Drawings
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0016] Figure 1 It is an overall flowchart of a visual inspection method for the quality of a gearbox alloy housing.
[0017] Figure 2 It is an overall structural diagram of a visual inspection system for the quality of a gearbox alloy housing. Detailed Embodiments
[0018] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present invention.
[0019] Embodiment 1: As Figure 1 shown, the embodiment of the present application provides a visual inspection method for the quality of a gearbox alloy housing, and the method includes: Collect images of defective and non-defective gearbox alloy housings, and convert all images into a unified format and size. Among them, the images of defective gearbox alloy housings cover various types of defects.
[0020] In an actual production line, the defective product sample rate may be less than 0.1%. Therefore, the image samples of defective gearbox alloy housings are very few. The lack of defect samples will make it difficult to perform quality inspection tasks based on computer vision. Therefore, it is necessary to use a generative adversarial network model to augment the images of defective gearbox alloy housings to achieve the balance between positive and negative samples.
[0021] First, construct the generator and discriminator of the generative adversarial network model. The generator is composed of a U-Net model, which is used to add defects to specific regions in the defect-free gearbox alloy housing image to generate a defective gearbox alloy housing image. The discriminator consists of a convolutional layer, a pooling layer, and a fully connected layer, and finally outputs the true probability through the sigmoid activation function to determine whether the defective gearbox alloy housing image generated by the generator is real. Then, initialize the parameters of the generator and discriminator by randomly sampling from the standard normal distribution. Use the defect-free gearbox alloy housing image as the input of the generator, and use the defective gearbox alloy housing image generated by the generator as the input of the discriminator. Finally, according to the loss functions of the discriminator and the generator, through backpropagation, iteratively train the generator and the discriminator simultaneously until the loss functions of the discriminator and the generator tend to converge, and generate the trained generative adversarial network model. Specifically, the goal of the generator is to use the U-Net structure to precisely control the position and shape of the defects. Since the U-Net has skip connections and can retain more spatial information, in the defect detection of the gearbox alloy housing, the defects only appear in specific regions. The generator needs to accurately generate defects in these regions while keeping other regions normal. The goal of the discriminator is to enable it to distinguish whether the defects on the gearbox alloy housing image are real defects or generated defects, that is, after the discriminator receives the defective gearbox alloy housing image generated by the generator, it detects whether the generated defects in the image are real. The discriminator and the generator play against each other and confront each other. Through gradient descent on the loss functions of the two, they are continuously optimized. Eventually, the generator can generate images similar to real defects.
[0022] The generator of the trained generative adversarial network model adds defects to specific regions in the defect-free gearbox alloy housing image, while keeping other regions unchanged, to generate a defective gearbox alloy housing image.
[0023] Repeat generating defective gearbox alloy housing images until the defective and defect-free gearbox alloy housing images reach sample equilibrium, and generate the first image dataset of gearbox alloy housings.
[0024] Perform preprocessing operations on all the gearbox alloy housing images in the first image dataset of gearbox alloy housings to generate the second image dataset of gearbox alloy housings.
[0025] Specifically, the preprocessing operations specifically include: For each channel of the image, use the nonlinear function in Equation (1) to perform nonlinear transformation on the values of all pixels in the current channel: Equation (1) Wherein, The value used to represent the pixel, The value of the pixel after non-linear transformation, The maximum value among the values of all pixels in the current channel.
[0026] Construct a residual neural network model and perform an initialization operation. Iteratively train the residual neural network model using the second image dataset of the gearbox alloy housing until the loss function of the residual neural network model converges, generating a trained residual neural network model; Specifically, the residual neural network uses ResNet-50 as the backbone network and adds a fully connected layer on top of ResNet-50 to output the probability of the gearbox alloy housing being defective, as the confidence level of the gearbox alloy housing being defective, converting the gearbox alloy housing defect detection task into a binary classification task.
[0027] Use the image acquisition device on the production line to obtain real-time images of the gearbox alloy housing, and after preprocessing, input them into the trained residual neural network model to generate the confidence level of the real-time gearbox alloy housing being defective.
[0028] In summary, a method for visual inspection of the quality of a gearbox alloy housing provided by an embodiment of the present application has the following technical effects: (1) By using a generative adversarial network model to augment the images of defective gearbox alloy housings, the problem that the quality inspection task based on computer vision is difficult to perform due to the lack of defect samples is solved, and the balance between positive and negative samples in the dataset is achieved; (2) Using a residual neural network, the visual inspection task of the quality of the gearbox alloy housing is converted into a computer vision binary classification detection task, solving the problem that the defects on the gearbox alloy housing are complex and variable, and it is difficult to improve the detection accuracy.
[0029] Embodiment 2: Based on the same inventive concept as a method for visual inspection of the quality of a gearbox alloy housing in Embodiment 1, as Figure 2 shown, the present application provides a system for visual inspection of the quality of a gearbox alloy housing, and the system includes: A generative adversarial module, which is used to collect images of defective and non-defective gearbox alloy housings, augment the images of defective gearbox alloy housings through a generative adversarial network model, and generate a first image dataset of the gearbox alloy housing; A preprocessing module, which is used to preprocess all the gearbox alloy housing images in the first image dataset of the gearbox alloy housing to generate a second image dataset of the gearbox alloy housing; Residual network module, which is used to construct a residual neural network model and perform initialization operations, and iteratively train the residual neural network model using the second image dataset of the transmission alloy housing until the loss function of the residual neural network model converges, generating a trained residual neural network model. Real-time detection module, which is used to obtain real-time images of the transmission alloy housing using the image acquisition device on the production line, perform preprocessing operations, and then input them into the trained residual neural network model to generate the confidence level of defects in the real-time transmission alloy housing.
[0030] Through the above detailed description of a method for visual inspection of the quality of a transmission alloy housing, those skilled in the art can clearly know a visual inspection system for the quality of a transmission alloy housing in this embodiment. Since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method part.
[0031] Embodiment Three: In Embodiment Three, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps of the above method for visual inspection of the quality of a transmission alloy housing are implemented.
[0032] Embodiment Four: In Embodiment Four, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method for visual inspection of the quality of a transmission alloy housing are implemented.
[0033] Embodiment Five: In Embodiment Five, a computer program product is provided, including a computer program or instruction. When the computer program or instruction is executed by a processor, the steps of the above method for visual inspection of the quality of a transmission alloy housing are implemented.
[0034] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0035] The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A visual inspection method for the quality of an alloy housing of a gearbox, characterized in that, The method includes: Collect images of defective and non-defective transmission alloy casings, and augment the images of defective transmission alloy casings through a generative adversarial network model to generate a first image dataset of transmission alloy casings; Perform preprocessing operations on all the transmission alloy casing images in the first image dataset of transmission alloy casings to generate a second image dataset of transmission alloy casings; Construct a residual neural network model and perform an initialization operation. Use the second image dataset of transmission alloy casings to iteratively train the residual neural network model until the loss function of the residual neural network model converges, generating a trained residual neural network model; Use the image acquisition device on the production line to obtain real-time images of transmission alloy casings. After performing preprocessing operations, input them into the trained residual neural network model to generate the confidence of real-time defective transmission alloy casings.
2. The visual inspection method for the quality of an alloy housing of a gearbox according to claim 1, characterized in that The collection of images of defective and non-defective transmission alloy casings, and the augmentation of the images of defective transmission alloy casings through a generative adversarial network model to generate a first image dataset of transmission alloy casings specifically includes: Collect images of defective and non-defective transmission alloy casings, and convert all the images into a unified format and size. Among them, the images of defective transmission alloy casings cover various types of defects; Construct the generator and discriminator of the generative adversarial network model, perform an initialization operation, and use the images of defective and non-defective transmission alloy casings to iteratively train the generator and discriminator until the loss functions of the discriminator and generator converge, generating a trained generative adversarial network model; The generator of the trained generative adversarial network model adds defects to specific regions in the images of non-defective transmission alloy casings according to the learned pattern, and keeps other regions unchanged, generating images of defective transmission alloy casings; Repeat generating images of defective transmission alloy casings until the number of defective and non-defective transmission alloy casing images reaches sample balance, generating a first image dataset of transmission alloy casings.
3. A method for visually inspecting the quality of an alloy housing of a gearbox according to claim 2, characterized in that, The construction of the generator and discriminator of the generative adversarial network model, the initialization operation, and the iterative training of the generator and discriminator using the images of defective and non-defective transmission alloy casings specifically include: Construct the generator and discriminator of the generative adversarial network model. The generator is composed of a U-Net model, which is used to add defects to specific regions in the images of non-defective transmission alloy casings to generate images of defective transmission alloy casings. The discriminator is composed of convolutional layers, pooling layers, and fully connected layers, and finally outputs the real probability through a sigmoid activation function to determine whether the images of defective transmission alloy casings generated by the generator are real; Initialize the parameters of the generator and discriminator by randomly sampling from a standard normal distribution. Use the images of non-defective transmission alloy casings as the input of the generator, and use the images of defective transmission alloy casings generated by the generator as the input of the discriminator; According to the loss functions of the discriminator and generator, perform iterative training on the generator and discriminator simultaneously through backpropagation.
4. A method for visually inspecting the quality of an alloy housing of a gearbox according to claim 1, characterized in that The preprocessing operation specifically includes: For each channel of the image, a non - linear function of Equation (1) is used to perform non - linear transformation on the values of all pixels in the current channel: Formula (1) Among them, is used to represent the value of a pixel, is used to represent the value of the pixel after non-linear transformation, is used to represent the maximum value among the values of all pixels in the current channel.
5. A visual inspection system for the quality of a gearbox alloy housing, the system comprising: A generative adversarial module, which is used to collect images of defective and non - defective gearbox alloy housings, expand the images of defective gearbox alloy housings through a generative adversarial network model, and generate a first image dataset of gearbox alloy housings; A pre - processing module, which is used to perform pre - processing operations on all the gearbox alloy housing images in the first image dataset of gearbox alloy housings, and generate a second image dataset of gearbox alloy housings; A residual network module, which is used to construct a residual neural network model and perform an initialization operation, and use the second image dataset of gearbox alloy housings to iteratively train the residual neural network model until the loss function of the residual neural network model converges, and generate a trained residual neural network model; A real - time detection module, which is used to obtain real - time images of gearbox alloy housings by using an image acquisition device on the production line, perform pre - processing operations, and then input them into the trained residual neural network model to generate the confidence of defective gearbox alloy housings in real time.
6. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of a method for visual inspection of the quality of a gearbox alloy housing according to any one of claims 1 to 4.
7. A computer-readable storage medium, having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of a method for visual inspection of the quality of a gearbox alloy housing according to any one of claims 1 to 4.
8. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instruction is executed by the processor, it implements the steps of a method for visual inspection of the quality of a gearbox alloy housing according to any one of claims 1 to 4.
Citation Information
Patent Citations
Wafer defect detection method based on generative adversarial network
CN117372413A
Metal surface defect detection method based on adversarial and residual network
CN119625390A
Intelligent system and method for detecting filament breakage and needle breakage
US20250086778A1
Cited By
Wafer defect data generation method, wafer detection method and storage medium
CN121073983A