A visual inspection method and device for surface defects of rudder structural parts
Through the image reconstruction network and complex convolution network, combined with grayscale image preprocessing and HOG features, the problem of low detection accuracy in surface defect detection of rudder structural parts is solved, and high-precision defect detection is achieved, which is suitable for practical engineering applications.
Patent Information
- Application Number
- CN202111571264.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-12-21
AI Technical Summary
The existing technology lacks high-precision detection methods suitable for actual engineering in the detection of surface defects in rudder structural parts. Especially in the absence of negative samples with surface defects, the deep learning method is not effective, and the image reconstruction process The object edge reconstruction error is large, which affects the detection effect.
The image reconstruction network is combined with the complex convolution network. Through grayscale image preprocessing, image reconstruction and residual calculation, HOG features and threshold binary segmentation are used to detect defects, which avoids the loss of high-frequency components of the image and improves the detection accuracy.
It achieves high-precision surface defect detection in actual projects, meets the detection requirements of practical applications, improves detection accuracy, reduces dependence on negative samples, and simplifies the sample labeling process.
Smart Images

Figure CN114092471B
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of part surface defect detection, and in particular to a visual detection method and a detection device for surface defects of rudder-type structural parts. Background Art
[0002] The rudder components installed on the surface of the rocket change the air flow by adjusting their own angles, thereby generating lateral control force to change the rocket's flight attitude. They are important components for controlling the rocket's flight attitude. Rudder components are usually made of short fiber reinforced composite materials through a compression molding process. During the manufacturing process, various surface defects may appear on the surface of the parts due to the effect of residual stress. Surface defects will reduce the strength of the material, shorten the service life of the rudder components, increase the risk of damage to the rudder components during use, and pose a great threat to the safety of rocket flight. Surface defect detection of rudder components is extremely important in production and manufacturing.
[0003] The main methods for detecting surface defects of parts include manual detection, ultrasonic detection, eddy current detection, infrared detection and machine vision detection. Machine vision detection has strong adaptability, is non-destructive, non-contact, low-cost, and the detection method is simple and efficient. Therefore, defect detection and evaluation methods based on machine vision are developing rapidly and have been widely used. In addition, the combined application of machine vision detection methods and deep learning methods has greatly improved the efficiency, accuracy and robustness compared to traditional machine vision detection based on image processing, and is currently the main method for detecting surface defects of various parts.
[0004] Rudder structural parts have a high-standard manufacturing process due to their important application objects and extreme application scenarios. Their manufacturing quantity is small, and there are fewer cases of surface defects, resulting in a lack of negative samples with surface defects, which greatly reduces the effect of deep learning. Surface defect detection methods that only use positive samples for training are currently urgently needed.
[0005] The patent with application number 201810586872.9 discloses a surface defect detection method based on positive example training, including two steps: image reconstruction and defect detection. Image reconstruction is to reconstruct the input original image into a defect-free image. The steps are: adding artificial defects and noise to the positive example image during the training process, reconstructing it using an autoencoder, calculating the distance between the reconstruction result and the noise-free original image, minimizing the distance as the reconstruction target, and cooperating with the generative adversarial network to optimize the reconstruction image effect; after obtaining the reconstructed image, defect detection is performed: the LBP features of the reconstructed image and the original image are calculated, and the defects can be found by subtracting the two feature maps and binarizing them according to a fixed threshold. This method gives the idea of using image reconstruction to detect defects, but only uses public data sets to verify the effect of the method, without considering its applicability in actual engineering; the images in the data set are all local images of the fabric surface, and the method does not consider the loss of high-frequency information such as object boundaries in the convolutional network in general. This loss will cause the object edge in the reconstructed image to be significantly different from that in the original image, affecting the effect of defect detection. Summary of the invention
[0006] In view of the shortcomings of the prior art, the technical problem to be solved by the present invention is a visual detection method and detection device for surface defects of rudder structural parts. The detection method is more suitable for practical engineering applications and improves detection accuracy.
[0007] The technical solution of the present invention to solve the technical problem is to provide a visual inspection method for surface defects of rudder structural parts, which includes the following contents:
[0008] Obtain grayscale images of defect-free rudder structural parts, and obtain a surface image library of rudder structural parts after preprocessing;
[0009] An image reconstruction network is constructed and trained using images from a surface image library of rudder structural parts;
[0010] Collect a grayscale image of a defective rudder structure, pre-process the image, obtain a surface image of the defective rudder structure, record it as an original image, input the image into a trained image reconstruction network, obtain a reconstructed image, and the defective area in the original image will be reconstructed into a normal surface in the reconstructed image;
[0011] Subtract the surface image of the defective rudder structure from its reconstructed image, and calculate the reconstruction residual matrix res of the original image according to formula (1):
[0012] res(i,k)=r(i,k)-x(i,k) (1)
[0013] Among them, x represents the original image, r represents the reconstructed image, i is the horizontal coordinate of the image, and k is the vertical coordinate of the image;
[0014] Then, according to the reconstructed residual matrix res, the HOG features of the reconstructed residual matrix are calculated to obtain the feature matrix, where the HOG features are the local gradient features of the image; a feature threshold is set, and the feature matrix is binarized using the feature threshold. The eigenvalues smaller than the feature threshold are set to 0, and the eigenvalues greater than the feature threshold are set to 1. The obtained binary matrix is used as a mask for separating the surface defects of rudder structural parts; then the mask is corroded, expanded, opened and closed, and then the mask is multiplied by the image of the defective rudder structural parts, so that the surface defects of the rudder structural parts can be segmented out, thereby realizing the detection of surface defects of the rudder structural parts.
[0015] The specific steps of the visual inspection method for surface defects of rudder structural parts are:
[0016] Step 1: using an industrial camera to collect grayscale images of defect-free rudder structural parts to obtain rudder structural part images, collecting N rudder structural part samples to obtain rudder structural part images to form a rudder structural part image library, where N is an integer greater than 100;
[0017] Step 2: Preprocess the images in the rudder structure image library obtained in the first step. The flow chart is as follows: Figure 1 As shown, the grayscale image is binarized by taking a grayscale threshold of 127, so that the pixels in the image with grayscale less than the grayscale threshold are set to 0, and the pixels with grayscale greater than the grayscale threshold are set to 255. After the processing, the background grayscale value of the image is 0, and the foreground grayscale value is 255, so as to obtain a mask that can separate the surface of the rudder structure; then the mask is corroded, expanded, opened and closed, and then the mask is multiplied with the original image to extract the surface image of the rudder structure, and then the extracted surface image is adaptively grayscale equalized to increase the distinction between the surface area of the rudder structure and the background area, and at the same time increase the distinction between the parts within the surface area of the rudder structure, and these surface images of the rudder structure constitute a surface image library of the rudder structure;
[0018] Step 3: Use the images in the rudder structural parts surface image library obtained in step 2 as a training set for training the image reconstruction network. The images in the training set are used as the input of the image reconstruction network. The structure of the image reconstruction network is shown in the figure below. Figure 2 As shown in the figure, x is the original image of the surface of the rudder structure. The original image is subjected to a two-dimensional discrete Fourier transform, which is defined as:
[0019]
[0020] Where x is the original image, F is the spectrum matrix of the original image, m is the width of the image, n is the height of the image, i is the horizontal coordinate of the image, k is the vertical coordinate of the image, u is the horizontal coordinate of the element in the spectrum matrix, and v is the vertical coordinate of the element in the spectrum matrix;
[0021] After two-dimensional discrete Fourier transform DFT2D, the spectrum matrix F of the original image is obtained. This matrix is a complex matrix, which is input into the complex convolutional neural network DCN1 for encoding, and the high-dimensional features are output to the hidden layer h. The high-dimensional features in the hidden layer h are then input into the complex convolutional neural network DCN2 for decoding to obtain the reconstructed spectrum matrix Each element is a complex number, and the reconstructed spectrum matrix is subjected to a two-dimensional inverse discrete Fourier transform iDFT2D, which is defined as:
[0022]
[0023] in is the reconstructed spectrum matrix, r is the reconstructed image, m is the width of the image, n is the height of the image, i is the horizontal coordinate of the image, k is the vertical coordinate of the image, u is the horizontal coordinate of the element in the spectrum matrix, and v is the vertical coordinate of the element in the spectrum matrix;
[0024] The reconstructed image r of the rudder structure surface is obtained by two-dimensional inverse Fourier transform, and the loss function between the original image x and the reconstructed image r is calculated. The loss function uses the mean square error loss function (MSE), which is defined as:
[0025]
[0026] Where x is the original image, r is the reconstructed image, m is the width of the image, n is the height of the image, i is the horizontal coordinate of the image, and k is the vertical coordinate of the image;
[0027] By continuously updating the parameters of the image reconstruction network, the loss function is minimized to make the original image and the reconstructed image as close as possible. When the loss function is less than the preset value, the update of the convolutional autoencoder (image reconstruction network) parameters is stopped, the current network parameters are stored, and the training of the image reconstruction network is completed.
[0028] Step 4: Use an industrial camera to collect a grayscale image of the defective rudder structure, pre-process the image to obtain a surface image of the defective rudder structure, and input the image into the image reconstruction network trained in the third step to obtain a reconstructed image. The defective area in the original image will be reconstructed into a normal surface in the reconstructed image.
[0029] The surface image of the defective rudder structure is subtracted from its reconstructed image to calculate the reconstruction residual matrix of the original image, which is defined as:
[0030] res(i,k)=r(i,k)-x(i,k) (1)
[0031] The reconstructed residual matrix res is obtained, and the HOG features of the reconstructed residual matrix are calculated to obtain the feature matrix. The HOG features are local gradient features of the image, which can reflect the gradient changes between each element value and the adjacent element values in a matrix. The gradient changes in the defective area are significantly larger than those in other areas, and there are also obvious differences in the eigenvalues.
[0032] Step 5: In the feature matrix of the fourth step, the eigenvalue of the normal area on the surface of the rudder structure is small, while the eigenvalue of the defective area is large. The feature threshold is taken to binarize the feature matrix, and the eigenvalues smaller than the feature threshold are set to 0, and the eigenvalues greater than the feature threshold are set to 1. The obtained binary matrix is used as a mask for separating the surface defects of the rudder structure; then the mask is corroded, expanded, opened and closed, and then the mask is multiplied with the image of the defective rudder structure to segment the surface defects of the rudder structure.
[0033] In the present invention, the characteristic threshold can be set to 45-55, and the specific value is related to the influence of light intensity, etc., and preferably the characteristic threshold is 50 under natural light.
[0034] The present invention provides a visual inspection device for surface defects of rudder-type structural parts, which includes a structural part fixing mechanism, a camera positioning system, a CCD industrial camera and lens, a PLC, a host computer and a communication system;
[0035] The structural member fixing mechanism is used to realize the positioning and placement of the rudder structural members;
[0036] The host computer communicates with the PLC through the communication system and sends a signal to the PLC, so that the PLC controls the camera positioning system to make the camera reach the specified position, so as to capture clear and complete images of rudder structural parts; the host computer directly controls the CCD industrial camera to collect images of rudder structural parts, and uses the above-mentioned visual detection method for surface defects of rudder structural parts loaded in the host computer to detect defects, and the detection results are displayed on the display screen of the host computer.
[0037] The structural component fixing mechanism is the main structure of the detection device, including a hole platform for installing all mechanisms. The platform has an array of holes. The positioning fixture, fastening fixture and supporting mechanism of the rudder structural component are fixed to the platform through the bent fixing piece to realize the positioning and placement of the rudder structural component.
[0038] The communication system uses Bluetooth wireless communication. The computer where the host computer is located and the PLC are mounted with Bluetooth communication modules. The communication between the host computer and the PLC is realized through the Bluetooth protocol. The communication content is the camera position adjustment signal sent by the host computer to the PLC and the adjustment completion signal sent by the PLC to the host computer.
[0039] The CCD industrial camera model is MV-EM200M, with a photosensitive area of 7mm×5.3mm, a pixel size of 4.4μm×4.4μm, an optical size of 1 / 1.8", a maximum frame rate of 20fps, an exposure time of 16-5000000μs, and an output image of a grayscale image; the lens model is HX2X-T1, which is a zoom lens with a focal length of 12mm-36mm and a minimum object distance of 20cm.
[0040] Compared with the prior art, the present invention has the following beneficial effects:
[0041] (1) The detection method of the present invention is based on an image reconstruction network, directly calculates the residual between the reconstructed image and the original image, and then calculates the HOG feature of the residual, and detects defects by comparing it with the feature threshold. The method uses the images of structural parts actually used in actual engineering as training and detection objects, and has applicability to actual engineering.
[0042] (2) The detection method of the present invention is based on an image reconstruction network and introduces a complex convolutional network (DCN). The complex convolutional network is used instead of the ordinary convolutional neural network as the backbone network of the image reconstruction network to reconstruct the image spectrum, thereby avoiding the phenomenon that the high-frequency component loss of the image during the image reconstruction process leads to a large error in the reconstruction of the object edge, and eliminating the interference of the edge reconstruction error on the subsequent feature threshold segmentation. The image reconstruction network is used to calculate the residual to detect defects, thereby improving the accuracy of defect detection and making it meet the detection requirements in practical applications.
[0043] (3) Taking advantage of the fact that the number of defect samples in the manufacturing process is small and their shapes are different, while the number of positive samples is large and their shapes are almost the same, the image reconstruction network is used as the core algorithm of the surface defect detection method of rudder structural parts. During the training process, it only relies on a sufficient number of positive samples and has no requirements for negative samples. In addition to conforming to the actual situation of the manufacturing process, it also saves the time cost of labeling a large number of samples. The present invention is conducive to practical application.
[0044] (4) The detection device of the present invention is designed with a special positioning fixture and a fastening fixture according to the special structural form of rudder structural parts, and is based on a hole platform, which can realize visual inspection of rudder structural parts of different sizes and specifications. It has a certain degree of universal applicability and is easy to detect. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 is a flow chart of image preprocessing of the present invention;
[0046] Figure 2 is a structural diagram of the image reconstruction network of the present invention;
[0047] Figure 3It is a schematic diagram of the overall structure of the visual inspection device for surface defects of rudder-type structural parts of the present invention;
[0048] Figure 4 It is a front view of the overall structure of the visual inspection device for surface defects of rudder-type structural parts of the present invention;
[0049] Figure 5 It is a side view of the overall structure of the visual inspection device for surface defects of rudder-type structural parts of the present invention;
[0050] Figure 6 It is a top view of the overall structure of the visual inspection device for surface defects of rudder-type structural parts of the present invention;
[0051] In the figure: 1. rotating shaft; 2. chain; 3. industrial camera; 4. camera fixing plate; 5. camera bracket; 6. sprocket; 7. stepping motor; 8. rudder structure; 9. structure bracket; 10. rocker arm; 11. structure support plate; 12. fastening fixture; 13. positioning fixture; 14. fixing part; 15. hole platform. DETAILED DESCRIPTION
[0052] The specific embodiments of the present invention are given below. The specific embodiments are only used to further illustrate the present invention in detail and do not limit the protection scope of the rights of this application.
[0053] The present invention provides a visual inspection device for surface defects of rudder structural parts (referred to as a sorting device, see Figure 3-6 ), 1. Rotating shaft; 2. Chain; 3. Industrial camera; 4. Camera fixing plate; 5. Camera bracket; 6. Sprocket; 7. Stepper motor; 8. Rudder structure; 9. Structure bracket; 10. Rocker arm; 11. Structure support plate; 12. Fastening fixture; 13. Positioning fixture; 14. Fixing part; 15. Hole platform, PLC (not shown) and host computer (not shown);
[0054] The rudder structure 8 is a trapezoidal plate structure as a whole. A metal core is installed in the center of the plate along the length direction. A rocker arm 10 is mounted on one side of the metal core extending out of the main body of the rudder structure. The rudder structure 8 is relatively thin and has a trapezoidal variable cross-section structure along the length direction of the rudder structure. The side surface of the end with a smaller cross-section is tightly attached to the positioning fixture; the side surface of the end with a larger cross-section is tightly attached to the fastening fixture. The two side plate surfaces of the rudder structure are defect planes to be detected. Industrial cameras are symmetrically installed on both sides of the defect to be detected, and the field of view of the industrial camera is matched with the corresponding defect plane to be detected. The two defect planes to be detected of the same rudder structure are detected at the same time, and data is collected synchronously. The images detected by the two cameras are analyzed by detection algorithms to determine which defect plane to be detected has defects. If the detection result of the image collected by any of the industrial cameras is a defect, the rudder structure is considered to be a defective part.
[0055] In this embodiment, the rudder structure 8 has a height of 60 cm, a width of 30 cm, and a thickness of 8 cm. It is relatively thin near the positioning fixture 13 and relatively thick near the fastening fixture 12. The rudder structure slides into the U-shaped long strip of the positioning fixture 13 for positioning.
[0056] The hole platform 15 is the installation platform of the whole device with an array of threaded holes on it; the positioning fixture 13 is placed at a relatively central position of the hole platform 15, and has threaded holes on the side; the fixing piece 14 is a bent metal piece with a hole; the fixing piece 14 and the positioning fixture 13 are fastened by screws and gaskets, and the fixing piece 14 and the hole platform 15 are fastened by screws and gaskets to achieve relative fixation of the positioning fixture 13 and the hole platform 15; the rudder structure 8 is equipped with a metal core, and the metal core is covered with a rocker arm 10, and the side of the rudder structure 8 equipped with the metal core is in close contact with the positioning fixture; the fastening fixture 12 is a washer with a U-shaped opening and a threaded hole, and the other end of the rudder structure 8 is inserted into the U-shaped opening of the fastening fixture 12; the fixing piece 14 and the fastening fixture 12 are fastened by screws and gaskets, and the fixing piece 14 and the hole platform 15 are fastened. The fastening fixture 12 and the hole platform 15 are fastened by screws and gaskets to achieve relative fixation; the rudder structure 8 is fixed at the specified position on the hole platform 15 by the positioning fixture 13 and the fastening fixture 12; the structural member bracket 9 is vertically placed on both sides of the metal core of the rudder structure 8, with through holes, and is fastened with a fixing member 14 by screws and nuts, and the fixing member 14 is fastened with the hole platform 15 by screws to achieve relative fixation of the structural member bracket 9 and the hole platform; the structural member bracket 9 has a rectangular through hole along its width direction, and the upper edge of the through hole height is at the same height as the lower horizontal section of the metal core of the rudder structure 8, and the structural member support plate 11 can pass through the rectangular through holes on the two structural member brackets 9 to form an interference fit, and the structural member support plate 11 and the structural member bracket 9 ensure that the rudder structure 8 will not tip over to both sides;
[0057] A pair of camera brackets 5 are vertically placed on one side of the rudder structure 8, with through holes, and are fastened to the corresponding fixing parts 14 by screws and nuts. The fixing parts 14 are also fastened to the hole platform 15 by screws and gaskets, so as to achieve relative fixation of the camera bracket 5 and the hole platform 15; the upper and lower ends of the side of the camera bracket 5 are each provided with a through hole, and the through holes are installed with bearings. The longer rotating shaft 1 passes through the bearings of the through holes at the upper ends of the two camera brackets 5 to form an interference fit with the bearings, and the shorter rotating shaft 1 passes through the through holes at the lower end of one of the camera brackets 5. The bearings of the holes form an interference fit with the bearings, and a sprocket 6 is also installed on the shorter rotating shaft 1 and fastened with screws; the stepper motor 7 is placed on the hole platform 15, and the camera bracket and the hole platform 15 are fastened with screws. The rotating shaft of the stepper motor 7 passes through the bearing of the through hole at the lower end of another camera bracket 5 and forms an interference fit with the bearing. A sprocket 6 is installed on the rotating shaft of the stepper motor 7 and fastened with screws; the sprocket installed on the same camera bracket 5 and connected to the stepper motor is connected to the sprocket 6 on the rotating shaft 1 through a chain 2, so that The upper and lower sprockets 6 can rotate synchronously, and the two sprockets on the upper and lower long and short rotating shafts 1 on another camera bracket without a stepper motor are also connected by a chain. The stepper motor rotates the sprocket and chain structure directly mounted thereon, thereby driving the sprocket and chain structure on the other camera bracket to follow; the camera fixing plate 4 is a rectangular flat plate with a curved structure with through holes on both sides, which can be fixed with two chains 2 on a pair of camera brackets so that the camera fixing plate 4 is placed horizontally and can be lifted and lowered in the vertical direction with the chain 2; the industrial camera 3 is placed on the camera fixing plate 4, with the lens facing the side of the rudder-type structural member 8, the lower surface of the industrial camera 3 has a threaded hole, and the camera fixing plate 4 has a through hole. The industrial camera 3 and the camera fixing plate 4 are fastened by screws so that the industrial camera 3 and the camera fixing plate 4 are relatively fixed, and the industrial camera 3 can be lifted and lowered in the vertical direction with the camera fixing plate 4; the other side of the rudder-type structural member 8 is installed according to the same configuration, with two pairs of camera brackets, and the two pairs of camera brackets are symmetrically arranged relative to the rudder-type structural member.
[0058] The positioning fixture 3 is provided with a U-shaped long strip opening on the side facing the rudder structure 8, the width of the U-shaped long strip opening is not greater than the cross-sectional width of the rudder structure 8 at 1 / 4-1 / 3 along its length direction, and the length of the U-shaped long strip opening is not less than 1 / 4-1 / 3 of the length of the rudder structure 8.
[0059] The stepper motor 7 is of model 57BYG250C, with a step angle of 1.8° and a torque of 1.8 N·m. The motor shaft and the sprocket 6 are tightly connected by interference fit; the motor controller is of model TB6600, with a rated current of 4.2A and a subdivision number of 6400; the PLC controlling the stepper motor 7 is of model Siemens S7-200SMART, with a CPU of ST40, 24 input I / Os and 16 output I / Os. The input of the stepper motor 7 is connected to the output of the motor controller by a wire, and the input of the motor controller is connected to the output I / O of the PLC by a wire;
[0060] The industrial camera 3 is model MV-EM200M, which is a CCD camera with a photosensitive area of 7mm×5.3mm, a pixel size of 4.4μm×4.4μm, an optical size of 1 / 1.8", a maximum frame rate of 20fps, an exposure time of 16-5000000μs, and an output image of a grayscale image; the lens model on the industrial camera 3 is HX2X-T1, which is a zoom lens with a focal length of 12mm-36mm and a minimum object distance of 20cm.
[0061] The working principle and workflow of the visual inspection device for surface defects of rudder structural parts of the present invention are as follows:
[0062] The working principle of the detection device of the present invention is:
[0063] The rudder structure 8 is placed according to the U-shaped long strip set by the positioning fixture 13, and fixed with the fastening fixture 12 and the structure bracket 9; the host computer sends a signal to the PLC, and the PLC controls the stepper motors 7 on both sides to adjust the height of the industrial camera 3, so that the rudder structure 8 is imaged at the center position of the field of view of the industrial camera 3; the host computer sends a signal to the industrial camera 3, turns on the industrial camera and focuses, so that the image of the rudder structure 8 is clear; when the imaging position is reasonable and the image is clear, the host computer is used to control the industrial cameras 3 on both sides to collect a frame of image respectively, and the visual detection method for surface defects of rudder structures loaded in the host computer is used for detection, and the detection results are displayed on the host computer.
[0064] The workflow of the detection device of the present invention comprises the following steps:
[0065] Step 1: Place the rudder structure 8 with the positioning fixture 13 as the reference, and fix it with the fastening fixture 12 and the structure bracket 9;
[0066] Step 2: Use the host computer to send a signal to the PLC, so that the PLC enables the two stepper motors 7 respectively and outputs PWM waves to control the rotation of the stepper motors 7, thereby driving the rotation of the sprocket 6, so that the chain 2 and the camera fixing plate 4 fixed thereon perform lifting and lowering movements, thereby adjusting the height of the industrial camera 3, so that the rudder-type structural member 8 is imaged at the center of the field of view of the industrial camera 3;
[0067] Step 3: The host computer sends a series of instructions to the two industrial cameras 3 to turn on the camera, adjust the focus, set the frame rate, delay and other parameters, collect images, turn off the camera, release the camera and other operations to complete the image acquisition;
[0068] Step 4: The image input is transmitted to the host computer through a gigabit network cable; the visual inspection method for surface defects of rudder structural parts loaded by the software;
[0069] Using an industrial camera to collect grayscale images of defect-free rudder structural parts to obtain rudder structural part images, and collecting N number of rudder structural part samples to obtain rudder structural part images to form a rudder structural part image library, where N is an integer greater than 100;
[0070] The process of the surface defect detection method of rudder structural parts is: pre-processing the rudder structural parts image by threshold segmentation, grayscale transformation, etc.; inputting the image into the trained image reconstruction network to obtain the reconstructed image; subtracting the reconstructed image from the original image to obtain the residual image, and calculating the gradient matrix of the residual image, and using the gradient matrix to segment the defects from the original image; the specific steps are:
[0071] (1) Reading the image of the rudder structure, selecting a threshold of 127 to perform binarization on the grayscale image, so that the pixels in the image with a grayscale less than the threshold are set to 0, and the pixels with a grayscale greater than the threshold are set to 255. After the processing, the background grayscale value of the image is 0, and the foreground grayscale value is 255, so as to obtain a mask that can separate the surface of the rudder structure; then, the mask is eroded, expanded, opened, and closed, and then the mask is multiplied by the original image to extract the surface image of the rudder structure, and then the extracted surface image is adaptively grayscale equalized to obtain the pre-processed surface image of the rudder structure;
[0072] (2) The surface image of the rudder structure obtained in (1) is input into the image reconstruction network, and the network first performs a two-dimensional Fourier transform on the image:
[0073]
[0074] Where x is the input image, F is the spectrum matrix of the original image, m is the width of the image, and n is the height of the image;
[0075] After two-dimensional Fourier transform, a spectrum matrix with complex elements is obtained. The real and imaginary parts of each element of the matrix are split to obtain the real spectrum matrix and the imaginary spectrum matrix respectively. The two matrices are input into the two CAEs of the complex convolutional neural network respectively to reconstruct the real matrix and the imaginary matrix respectively. The two matrices are recombined into a complex matrix to obtain the reconstructed spectrum matrix. The reconstructed spectrum matrix is subjected to two-dimensional inverse Fourier transform:
[0076]
[0077] in is the reconstructed spectrum matrix, r is the reconstructed image, m is the width of the image, and n is the height of the image;
[0078] The reconstructed image of the surface of the rudder structure is obtained through two-dimensional inverse Fourier transform.
[0079] (3) Subtract the surface image of the rudder structure obtained in (1) from the reconstructed image obtained in (2) to calculate the reconstruction residual matrix of the original image:
[0080] res(i,k)=r(i,k)-x(i,k)
[0081] (4) Calculate the HOG features of the residual matrix obtained in (3) to obtain a feature matrix, perform binarization on the feature matrix, set the eigenvalues less than the threshold to 0, and set the eigenvalues greater than the threshold to 1, and use the obtained binary matrix as a mask for separating the surface defects of the rudder structure; then perform corrosion, expansion, opening and closing operations on the mask, and then multiply the mask with the image of the defective rudder structure to segment the surface defects of the rudder structure;
[0082] Step 5: Display the defect detection results on the host computer to complete the entire defect detection process.
[0083] By using the frequency domain reconstruction method of the image in this embodiment to detect surface defects of rudder-type structural parts, the defect detection rate can reach 100%.
[0084] The present invention does not describe the prior art.
Claims
1. A visual inspection method for surface defects of rudder structural parts, the method comprising the following contents: Obtain grayscale images of defect-free rudder structural parts, and obtain a surface image library of rudder structural parts after preprocessing; An image reconstruction network is constructed and trained using images from a surface image library of rudder structural parts; Collect a grayscale image of a defective rudder structure, pre-process the image, obtain a surface image of the defective rudder structure, record it as an original image, input the image into a trained image reconstruction network, obtain a reconstructed image, and the defective area in the original image will be reconstructed into a normal surface in the reconstructed image; Subtract the surface image of the defective rudder structure from its reconstructed image, and calculate the reconstruction residual matrix res of the original image according to formula (1): res(i,k)=r(i,k)-x(i,k) (1) Among them, x represents the original image, r represents the reconstructed image, i is the horizontal coordinate of the image, and k is the vertical coordinate of the image; Then, according to the reconstructed residual matrix res, the HOG features of the reconstructed residual matrix are calculated to obtain a feature matrix, where the HOG features are local gradient features of the image; The feature threshold is set, and the feature matrix is binarized using the feature threshold. The eigenvalues smaller than the feature threshold are set to 0, and the eigenvalues larger than the feature threshold are set to 1. The obtained binary matrix is used as a mask for separating the surface defects of rudder structural parts. Then, the mask is corroded, expanded, opened, and closed. Then, the mask is multiplied with the image of the defective rudder structural part, so that the surface defects of the rudder structural parts can be segmented, and the surface defects of the rudder structural parts can be detected. The image reconstruction network is a convolutional autoencoder, which includes two complex convolutional neural networks. The preprocessed image is used as input, and the spectrum matrix F of the original image is obtained by two-dimensional discrete Fourier transform DFT2D. The matrix is a complex matrix, which is input into the complex convolutional neural network DCN1 for encoding, and the high-dimensional features are output to the hidden layer h. The high-dimensional features in the hidden layer h are then input into the complex convolutional neural network DCN2 for decoding to obtain the reconstructed spectrum matrix Each element is a complex number. The reconstructed spectrum matrix is subjected to a two-dimensional inverse discrete Fourier transform iDFT2D to obtain the reconstructed image r of the rudder structure surface.
2. The detection method according to claim 1, characterized in that: The specific process of the preprocessing is: use a grayscale threshold of 127 to perform binarization processing on the grayscale image, so that the pixels in the image with grayscale less than the grayscale threshold are set to 0, and the pixels with grayscale greater than the grayscale threshold are set to 255. After the processing, the background grayscale value of the image is 0, and the foreground grayscale value is 255, so as to obtain a mask that can separate the surface of the rudder structure; then, the mask is corroded, expanded, opened and closed, and then the mask is multiplied by the original image to extract the surface image of the rudder structure, and then the extracted surface image is adaptively grayscale equalized to increase the distinction between the surface area of the rudder structure and the background area, and at the same time, increase the distinction between each part within the surface area of the rudder structure.
3. A visual inspection method for surface defects of rudder structural parts, characterized in that: The specific steps of this method are: Step 1: using an industrial camera to collect grayscale images of defect-free rudder structural parts to obtain rudder structural part images, collecting N rudder structural part samples to obtain rudder structural part images to form a rudder structural part image library, where N is an integer greater than 100; Step 2: Preprocess the images in the rudder structural component image library obtained in the first step: Use the grayscale threshold of 127 to perform binarization processing on the grayscale image, so that the pixels in the image with grayscale less than the grayscale threshold are set to 0, and the pixels with grayscale greater than the grayscale threshold are set to 255. After the processing, the background grayscale value is 0 and the foreground grayscale value is 255, and a mask that can separate the surface of the rudder structural component is obtained; then, the mask is corroded, expanded, opened and closed, and then the mask is multiplied by the original image to extract the surface image of the rudder structural component, and then the extracted surface image is adaptively grayscale equalized to increase the distinction between the surface area of the rudder structural component and the background area, and at the same time, increase the distinction between each part of the surface area of the rudder structural component. These rudder structural component surface images constitute the rudder structural component surface image library; Step 3: The images in the surface image library of rudder structural parts obtained in the second step are used as training sets for training the image reconstruction network. The images in the training set are used as inputs of the image reconstruction network. The input images are recorded as original images. The original images are subjected to a two-dimensional discrete Fourier transform according to formula (2). Where x is the original image, F is the spectrum matrix of the original image, m is the width of the image, n is the height of the image, i is the horizontal coordinate of the image, k is the vertical coordinate of the image, u is the horizontal coordinate of the element in the spectrum matrix, and v is the vertical coordinate of the element in the spectrum matrix; After two-dimensional discrete Fourier transform DFT2D, the spectrum matrix F of the original image is obtained. F is a complex matrix, which is input into the complex convolutional neural network DCN1 for encoding, and the high-dimensional features are output to the hidden layer h. The high-dimensional features in the hidden layer h are then input into the complex convolutional neural network DCN2 for decoding to obtain the reconstructed spectrum matrix Reconstructed spectrum matrix Each element in is a complex number. The reconstructed spectrum matrix is subjected to a two-dimensional inverse discrete Fourier transform iDFT2D according to formula (3): Where r is the reconstructed image; The reconstructed image r of the rudder structure surface is obtained by two-dimensional inverse Fourier transform, and the loss function between the original image x and the reconstructed image r is calculated. The loss function uses the mean square error loss function MSE, which is defined as formula (4): By continuously updating the parameters of the image reconstruction network, the loss function is minimized to make the original image and the reconstructed image as close as possible. When the loss function is less than the preset value, the updating of the image reconstruction network parameters is stopped, the current network parameters are stored, and the training of the image reconstruction network is completed. Step 4: Use an industrial camera to collect a grayscale image of the defective rudder structure, pre-process the image, and obtain a surface image of the defective rudder structure, which is recorded as the original image. The original image is input into the reconstruction network trained in the third step to obtain a reconstructed image. The defective area in the original image will be reconstructed into a normal surface in the reconstructed image. Subtract the surface image of the defective rudder structure from its reconstructed image, and calculate the reconstruction residual matrix res of the original image according to formula (1): res(i,k)=r(i,k)-x(i,k) (1) Obtain the reconstructed residual matrix res, calculate the HOG features of the reconstructed residual matrix, and obtain the feature matrix. The HOG feature is the local gradient feature of the image, which can reflect the gradient change between each element value and the adjacent element value in a matrix; Step 5: In the feature matrix of the fourth step, the eigenvalue of the normal area on the surface of the rudder structure is small, while the eigenvalue of the defective area is large. The feature threshold is taken to binarize the feature matrix, and the eigenvalues smaller than the feature threshold are set to 0, and the eigenvalues greater than the feature threshold are set to 1. The obtained binary matrix is used as a mask for separating the surface defects of the rudder structure; then the mask is corroded, expanded, opened and closed, and then the mask is multiplied with the image of the defective rudder structure to segment the surface defects of the rudder structure.
4. The detection method according to any one of claims 1 to 3, characterized in that: The characteristic threshold is 45-55.
5. A visual inspection device for surface defects of rudder-type structural parts, the device comprising a structural part fixing mechanism, a camera positioning system, a CCD industrial camera and lens, a PLC, a host computer and a communication system; The structural member fixing mechanism is used to realize the positioning and placement of the rudder structural members; The host computer communicates with the PLC through the communication system and sends a signal to the PLC, so that the PLC controls the camera positioning system to make the camera reach the specified position, so as to capture clear and complete images of rudder structures; the host computer directly controls the CCD industrial camera to collect images of rudder structures, and uses the visual detection method for surface defects of rudder structures described in any one of claims 1-4 loaded in the host computer to detect defects, and the detection results are displayed on the display screen of the host computer.
6. The detection device according to claim 5, characterized in that: The communication system uses Bluetooth wireless communication. The computer where the host computer is located and the PLC are mounted with Bluetooth communication modules. The communication between the host computer and the PLC is realized through the Bluetooth protocol. The communication content is the camera position adjustment signal sent by the host computer to the PLC and the adjustment completion signal sent by the PLC to the host computer. The CCD industrial camera model is MV-EM200M, with a photosensitive area of 7mm×5.3mm, a pixel size of 4.4μm×4.4μm, an optical size of 1 / 1.8, a maximum frame rate of 20fps, an exposure time of 16-5000000μs, and an output image as a grayscale image; the lens model is HX2X-T1, which is a zoom lens with a focal length of 12mm-36mm and a minimum object distance of 20cm.
7. A visual inspection device for surface defects of rudder structural parts, characterized in that: The detection device can realize the visual detection method of surface defects of rudder structural parts described in any one of claims 1 to 4, and the detection device includes an industrial camera, a camera fixing plate, a camera bracket, a fastening fixture, a positioning fixture, a fixing part, a hole platform, a PLC and a host computer. The hole platform is the installation platform of the entire device, with an array of threaded holes on it; the positioning fixture is placed near the center of the hole platform, with threaded holes on the side; the fixing piece is a curved metal piece with holes; the fixing piece and the positioning fixture are fastened by screws and gaskets, and the fixing piece and the hole platform are fastened by screws and gaskets to achieve relative fixation of the positioning fixture and the hole platform; The rudder structure is equipped with a metal core, on which a rocker arm is sleeved. The rudder structure is a trapezoidal variable cross-section structure, and the side of the end with a smaller cross-section is in close contact with the positioning fixture; the fastening fixture is a washer with a U-shaped opening and a threaded hole, and the side of the end with a larger cross-section of the rudder structure is inserted into the U-shaped opening of the fastening fixture; the fastening fixture is fastened to the hole platform by a fixing piece, a screw, and a gasket, so that the fastening fixture and the hole platform are relatively fixed; the rudder structure is fixed at a specified position on the hole platform by the positioning fixture and the fastening fixture; The positioning fixture is provided with a U-shaped long strip opening on one side facing the rudder structure, the width of the U-shaped long strip opening is not greater than the cross-sectional width of the rudder structure at 1 / 4-1 / 3 along the length direction thereof, and the length of the U-shaped long strip opening is not less than 1 / 4-1 / 3 of the length of the rudder structure; The upper part of the rudder structure close to the fastening fixture is fixed by a supporting mechanism to prevent the rudder structure from tipping over to both sides; Two industrial cameras that can move up and down are symmetrically installed on the hole platforms on the two sides of the rudder structure to be inspected.
8. The detection device according to claim 7, characterized in that: The support mechanism comprises a structural member bracket and a structural member support plate. Two structural member brackets are vertically symmetrically placed on both sides of the metal core in the rudder structure, with through holes, fastened to a fixing member by screws and nuts, and the fixing member is further fastened to the hole platform by screws to achieve relative fixation of the structural member bracket and the hole platform; the structural member bracket has a rectangular through hole along its width direction, and the upper edge of the through hole is at the same height as the lower horizontal section of the metal core of the rudder structure. The structural member support plate can pass through the rectangular through holes on the two structural member brackets to form an interference fit. The structural member support plate and the structural member bracket are used to support the metal core to ensure that the rudder structure will not tip over to both sides; A pair of camera brackets are vertically placed on one side of the rudder-type structural member, with through holes, and are fastened to the corresponding fixing parts by screws and nuts. The fixing parts are also fastened to the hole platform by screws and gaskets to achieve relative fixation of the camera bracket and the hole platform; the upper and lower ends of the side of the camera bracket are each provided with a through hole, and bearings are installed in the through holes. The longer rotating shaft passes through the bearings of the through holes at the upper ends of the two camera brackets to form an interference fit with the bearings, and the shorter rotating shaft passes through the bearing of the through hole at the lower end of one of the camera brackets to form an interference fit with the bearing. A sprocket is also installed on the shorter rotating shaft and fastened with screws; the stepper motor is placed on the hole platform, and the camera bracket and the hole platform are fastened with screws. The rotating shaft of the stepper motor passes through the bearing of the through hole at the lower end of the other camera bracket to form an interference fit with the bearing, and a sprocket is installed on the rotating shaft of the stepper motor and fastened with screws; a sprocket connected to the stepper motor installed on the same camera bracket The sprocket on the rotating shaft is connected by a chain, so that the upper and lower sprockets can rotate synchronously. The two sprockets on the upper and lower long and short rotating shafts of another camera bracket without a stepper motor are also connected by a chain. The stepper motor rotates the sprocket and chain structure directly mounted thereon, thereby driving the sprocket and chain structure on the other camera bracket to follow; the camera fixing plate is a rectangular flat plate, and the two sides are curved structures with through holes, which can be fixed with two chains on a pair of camera brackets, so that the camera fixing plate is placed horizontally and can be lifted and lowered in the vertical direction with the chain; the industrial camera is placed on the camera fixing plate, and the lens direction is facing the side of the rudder structure. The lower surface of the industrial camera has a threaded hole, and the camera fixing plate has a through hole. The industrial camera and the camera fixing plate are fastened by screws, so that the industrial camera and the camera fixing plate are relatively fixed, and the industrial camera can be lifted and lowered in the vertical direction with the camera fixing plate; The other side of the rudder-like structure is installed in the same configuration and has two pairs of camera brackets, and the two pairs of camera brackets are symmetrically arranged relative to the rudder-like structure.
