Search

CN-121994824-A - Fresnel lens bubble defect detection method based on stripe light source lighting scheme and improved YOLOv8

CN121994824ACN 121994824 ACN121994824 ACN 121994824ACN-121994824-A

Abstract

A Fresnel lens bubble defect detection method based on a stripe light source polishing scheme and an improvement YOLOv relates to the technical field of computer vision, and high-efficiency and accurate detection of bubble defects is realized through depth adaptation of the stripe light source and an improvement YOLOv model. Compared with the detection scheme of the conventional YOLOv model matched with the white light source, the invention effectively solves the problem of industry pain caused by confusion of the tooth marks and the bubble characteristics of the Fresnel lens by adding the stripe distortion characteristic enhancement module and the stripe distortion characteristic enhancement unit, and simultaneously, the unified parameter design and the cross-scale characteristic fusion optimization of the backbox and the Neck network ensure that the model has good recognition capability on bubbles with different sizes and different distortion degrees, adapts to the actual requirements of various lens specifications and complex defect forms in industrial scenes, and can meet the industrial on-line detection standard in detection speed and precision.

Inventors

  • PANG SHAOPENG
  • XU YAN
  • YU JIE
  • ZHAO YONGGUO
  • LI GUANGNAN
  • GUO RUIQI
  • Ren Lejia
  • ZHOU CAIBIN

Assignees

  • 齐鲁工业大学(山东省科学院)
  • 山东宇影光学仪器有限公司

Dates

Publication Date
20260508
Application Date
20260130

Claims (10)

  1. 1. A Fresnel lens bubble defect detection method based on a stripe light source lighting scheme and an improvement YOLOv is characterized by comprising the following steps: s1, obtaining Zhang Feinie L lens images are obtained to obtain an original Fresnel lens bubble image set , , Is the first Zhang Feinie mole lens bubble image; S2, the second pair of Zhang Feinie-mole lens bubble image Preprocessing to obtain a preprocessed Fresnel lens bubble image All the preprocessed Fresnel lens bubble images form a preprocessed Fresnel lens bubble image set , ; S3, collecting the preprocessed Fresnel lens bubble images Dividing the training set, the testing set and the verification set; s4, establishing an improved YOLOv model formed by a Backbone network of a backhaul, a Neck network and a detection head of a YOLOv model; S5, training the training set Sheet-processed Fresnel lens bubble image Inputting the core feature map into a Backbone network of an improved YOLOv model, and outputting to obtain a core feature map ; S6, mapping the core characteristics Input into Neck network of improved YOLOv model, and output to obtain characteristic diagram ; S7, feature graphs And inputting the detected bubble defects into a detection head of a YOLOv model in the improved YOLOv model, and outputting an identification image for detecting the bubble defects of the Fresnel lens.
  2. 2. The fresnel lens bubble defect detection method based on the stripe light source lighting scheme and the improvement YOLOv as set forth in claim 1, wherein the step S1 includes the steps of: S1-1. Selection A fresnel lens with bubble defects; s1-2, shooting each Fresnel lens with bubble defects by using an industrial camera in a mode of arranging a stripe light source at the right lower end of the Fresnel lens and arranging the industrial camera right above the Fresnel lens to obtain Zhang Feinie-mole lens image.
  3. 3. The fresnel lens bubble defect detection method based on the stripe light source lighting scheme and the improvement YOLOv as set forth in claim 1, wherein the step S2 includes the steps of: S2-1. Will be Zhang Feinie-mole lens bubble image Setting coordinate axis parameters to be 1 through flip functions in an OpenCV library in Python to perform horizontal overturn, and obtaining an overturned Fresnel lens bubble image ; S2-2, bubble images of the Fresnel lens after overturning Clipping is carried out through getRectSubPix functions in an OpenCV library in Python, and a clipped Fresnel lens bubble image is obtained ; S2-3, cutting the bubble image of the Fresnel lens Contrast is adjusted through convertScaleAbs functions in an OpenCV library in Python, and an adjusted Fresnel lens bubble image is obtained ; S2-4, bubble images of the Fresnel lens after adjustment Rotation within + -5 DEG is carried out through WARPAFFINE DEG function in OpenCV library in Python, and a rotated Fresnel lens bubble image is obtained ; S2-5, imaging the rotated Fresnel lens bubbles Gray processing is carried out through cvtColor functions in an OpenCV library in Python, and a processed Fresnel lens bubble image is obtained ; S2-6, carrying out bubble image processing on the Fresnel lens Random noise is removed through GaussianBlur functions in an OpenCV library in Python, and a denoised Fresnel lens bubble image is obtained ; S2-7, removing noise of the Fresnel lens bubble image Enhancement of contrast is achieved through CREATECLAHE functions in an OpenCV library in Python, and a preprocessed Fresnel lens bubble image is obtained 。
  4. 4. The Fresnel lens bubble defect detection method based on the stripe light source lighting scheme and the improvement YOLOv, according to claim 3, is characterized in that GaussianBlur function in step S2-6 adopts a 5×5 Gaussian kernel convolution kernel, standard deviation is set to be 1.5, CLIPLIMIT is set to be 2.0 in CREATECLAHE function in step S2-7, and grid size is set to be 8×8.
  5. 5. The Fresnel lens bubble defect detection method based on the strip light source lighting scheme and the improvement YOLOv on the scheme of claim 1, wherein the Fresnel lens bubble images after the pretreatment are collected in the step S3 The training set, the test set and the verification set are divided according to the proportion of 8:1:1.
  6. 6. The fresnel lens bubble defect detection method based on the stripe light source lighting scheme and the improvement YOLOv according to claim 1, wherein the step S5 includes the steps of: S5-1, a Backbone trunk network of an improved YOLOv model is formed by a first convolution Conv module, a second convolution Conv module, a first stripe distortion feature enhancement module, a third convolution Conv module, a second stripe distortion feature enhancement module, a fourth convolution Conv module, a third stripe distortion feature enhancement module, a fifth convolution Conv module, a fourth stripe distortion feature enhancement module and a sixth convolution Conv module, wherein the first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, the fifth convolution Conv module and the sixth convolution Conv module are sequentially formed by convolution layers, batch Normalization layers and SiLU activation functions, and the first stripe distortion feature enhancement module, the second stripe distortion feature enhancement module, the third stripe distortion feature enhancement module and the fourth stripe distortion feature enhancement module are sequentially formed by a first convolution layer, a first Batch Normalization layer, a first SiLU activation function, a second convolution layer, a second Batch Normalization layer, a second SiLU activation function and a stripe distortion feature enhancement unit; S5-2. Training set Sheet-processed Fresnel lens bubble image Inputting the characteristic images into a first convolution Conv module of a Backbone network of the backhaul, and outputting the characteristic images ; S5-3. Characteristic map Inputting the characteristic images into a second convolution Conv module of the Backbone network of the backhaul, and outputting the characteristic images ; S5-4. Characteristic map Sequentially inputting into a first convolution layer, a first Batch Normalization layer, a first SiLU activation function, a second convolution layer, a second Batch Normalization layer and a second SiLU activation function of a first stripe distortion characteristic enhancement module of a Backbone network of a backhaul, and outputting to obtain a characteristic diagram Map the characteristics of Inputting into the convolution layer of the stripe distortion characteristic enhancement unit, and outputting to obtain a characteristic diagram Feature map using Sobel operator pair Respectively carrying out gradient calculation in the horizontal direction and the vertical direction to obtain a characteristic diagram Middle (f) Horizontal gradient of individual pixels Vertical gradient By the formula Calculating to obtain the first Gradient direction of each pixel point For characteristic diagram Counting the gradient directions of all pixel points, constructing a direction histogram, normalizing the direction histogram, and taking the direction with the highest frequency in the normalized direction histogram as the main direction of stripes Map the characteristics of Inputting the image into the distortion extraction branch of the stripe distortion characteristic enhancement unit to obtain a characteristic image Middle (f) Each pixel point along the main direction of the stripe Calculating gradient change quantity and taking the average value of gradient change quantity amplitude values Setting a threshold TG as an average value 1.5-2.0 Times that of (C), if the characteristic diagram Middle (f) The magnitude of the gradient change quantity of each pixel point is larger than or equal to a threshold TG, the characteristic value of the pixel point is multiplied by 2-3 times of weight, and if the characteristic map Middle (f) If the amplitude of the gradient change quantity of each pixel point is smaller than the threshold TG, the characteristic value of the pixel point is kept unchanged, and a preliminary distortion enhancement weight map is obtained Enhancing the preliminary distortion by a weight map Input into a convolution layer, and output to obtain a distortion enhancement weight map Map the characteristics of Inputting the image into a background inhibition branch of a stripe distortion characteristic enhancement unit, and obtaining a characteristic diagram by a sliding window method Texture uniformity value of each window of (a) and calculating the average value of the texture uniformity values of all windows Setting a threshold TS, TS being the average value 0.3-0.5 Times, if the characteristic map Middle (f) If the texture consistency value of each window is greater than or equal to a threshold value TS, multiplying the characteristic values of all pixel points in the window by 0.1-0.3 times of weight, if the characteristic map Middle (f) If the texture consistency value of each window is smaller than the threshold value TS, the characteristic values of all pixel points in the window are kept unchanged, and a preliminary background suppression weight graph is obtained Preliminary background suppression weight map Input into a convolution layer, and output to obtain a background suppression weight map Enhancing distortion in weight map And background suppression weight map Distortion enhancement weight map to be multiplied by 0.65 weight in fusion layer inputted to stripe distortion feature enhancement unit With a background suppression weight map multiplied by 0.35 weight Performing element-by-element addition operation to obtain a weighted feature map Will weight the characteristic diagram Input into a convolution layer, and output to obtain a fused characteristic diagram Map the characteristics of Inputting the residual error into the residual error output layer of the stripe distortion characteristic enhancement unit, and mapping the characteristic image And feature map Adding elements by elements, inputting into BN layer, and outputting to obtain reinforced characteristic diagram ; S5-5. Characteristic diagram Inputting the characteristic map into a third convolution Conv module of a Backbone network of the backhaul, and outputting the characteristic map ; S5-6. Characteristic map Inputting the characteristic diagram into a second stripe distortion characteristic enhancement module of a Backbone network of the backhaul, and outputting the characteristic diagram after strengthening ; S5-7. Characteristic diagram Inputting the characteristic images into a fourth convolution Conv module of the Backbone network of the backhaul, and outputting the characteristic images ; S5-8. Characteristic diagram Inputting the characteristic diagram into a third stripe distortion characteristic enhancement module of a Backbone network of the backhaul, and outputting the characteristic diagram after strengthening ; S5-9. Characteristic diagram Inputting the characteristic map into a fifth convolution Conv module of a Backbone network of the backhaul, and outputting the characteristic map ; S5-10. Characteristic diagram Inputting the characteristic diagram into a fourth stripe distortion characteristic enhancement module of a Backbone network of a backhaul, and outputting the characteristic diagram after being enhanced ; S5-11. Characteristic map Inputting the core feature map into a sixth convolution Conv module of a Backbone network of the backhaul, and outputting to obtain the core feature map 。
  7. 7. The Fresnel lens bubble defect detection method based on the strip light source polishing scheme and the improvement YOLOv is characterized in that the convolution kernel sizes of the first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, the fifth convolution Conv module and the sixth convolution Conv module of the Backbone network of the backlight are 3×3, the padding is 1, the step sizes are 1, the first strip distortion feature enhancement module, the second strip distortion feature enhancement module, the third strip distortion feature enhancement module and the first convolution layer and the second convolution layer of the Backbone network of the backlight are 3×3, and the padding is 1.
  8. 8. The fresnel lens bubble defect detection method based on the stripe light source lighting scheme and the improvement YOLOv as set forth in claim 6, wherein the step S6 includes the steps of: S6-1, a Neck network of an improved YOLOv model is composed of a first convolution Conv module, a first stripe distortion feature enhancement module, a second convolution Conv module, a third convolution Conv module, a second stripe distortion feature enhancement module, a fourth convolution Conv module, a first stripe distortion feature enhancement unit, a third stripe distortion feature enhancement module, a fifth convolution Conv module, a second stripe distortion feature enhancement unit, a fourth stripe distortion feature enhancement module and a cross-scale feature enhancement unit, wherein the first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module and the fifth convolution Conv module are sequentially composed of convolution layers, batch Normalization layers and SiLU activation functions, and the first stripe distortion feature enhancement module, the second stripe distortion feature enhancement module, the third stripe distortion feature enhancement module and the fourth stripe distortion feature enhancement module are sequentially composed of a first convolution layer, a first Batch Normalization layer, a first SiLU activation function, a second convolution layer, a second Batch Normalization layer and a second SiLU activation function; s6-2. Core feature map Input into a first convolution Conv module of Neck networks, and output to obtain a feature map Map the characteristics of And feature map Performing splicing operation to obtain a feature map ; S6-3. Characteristic diagram Inputting the characteristic diagram into a first stripe distortion characteristic enhancement module of Neck network, and outputting to obtain a characteristic diagram ; S6-4. Characteristic diagram Input into a second convolution Conv module of Neck networks, and output to obtain a feature map ; S6-5. Characteristic diagram Inputting to a third convolution Conv module of Neck network, and outputting to obtain a feature map Map the characteristics of And feature map Performing splicing operation to obtain a feature map ; S6-6. Characteristic diagram Inputting the characteristic diagram into a second stripe distortion characteristic enhancement module of Neck network, and outputting to obtain the characteristic diagram ; S6-7. Characteristic diagrams Inputting to a fourth convolution Conv module of Neck network, and outputting to obtain a feature map ; S6-8. Characteristic diagram Inputting the characteristic diagram into a first stripe distortion characteristic enhancement unit of Neck network, and outputting to obtain a characteristic diagram Map the characteristics of And feature map Performing splicing operation to obtain a feature map ; S6-9. Characteristic diagram Inputting the characteristic diagram into a third stripe distortion characteristic enhancement module of Neck network, and outputting to obtain the characteristic diagram ; S6-10. Characteristic diagrams Inputting to a fifth convolution Conv module of Neck network, and outputting to obtain a feature map ; S6-11. Characteristic diagrams Inputting the characteristic diagram into a second stripe distortion characteristic enhancement unit of Neck network, and outputting to obtain a characteristic diagram Map the characteristics of And feature map Performing splicing operation to obtain a feature map ; S6-12. Characteristic diagram Inputting the characteristic diagram into a fourth stripe distortion characteristic enhancement module of Neck network, and outputting to obtain the characteristic diagram ; The trans-scale feature enhancement unit of the S6-13 Neck network consists of an attention mechanism and maps the features Input into a cross-scale feature enhancement unit, and output to obtain a feature map 。
  9. 9. The Fresnel lens bubble defect detection method based on the strip light source polishing scheme and the improvement YOLOv, which is disclosed in claim 8, is characterized in that the convolution kernel sizes of the first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module and the fifth convolution Conv module of the Neck network are 3×3, the packing is 1, the step sizes are 1, the first strip distortion feature enhancement module, the second strip distortion feature enhancement module, the third strip distortion feature enhancement module and the fourth strip distortion feature enhancement module of the Neck network are 3×3, the convolution kernel sizes of the first convolution layer and the second convolution layer of the fourth strip distortion feature enhancement module are 1, and the step sizes are 1.
  10. 10. The Fresnel lens bubble defect detection method based on the fringe light source lighting scheme and the improvement YOLOv, as recited in claim 1, further comprising training the improved YOLOv model with the loss Shape-IOU using the Adam optimizer after step S7.

Description

Fresnel lens bubble defect detection method based on stripe light source lighting scheme and improved YOLOv8 Technical Field The invention relates to the technical field of computer vision, in particular to a Fresnel lens bubble defect detection method based on a stripe light source polishing scheme and an improvement YOLOv. Background The Fresnel lens is used as an optical element with the characteristics of light weight, low cost, excellent light condensing/diffusing effect and the like, and the surface of the Fresnel lens is processed with a dense concentric circular insection structure, so that the Fresnel lens is widely applied to various optical systems. In the manufacturing processes of injection molding, pressing and the like of the Fresnel lens, bubble defects are extremely easy to generate in the lens or on the surface due to factors such as the purity of raw materials, improper control of processing technological parameters and the like. These bubbles can destroy the optical uniformity of the lens, cause light refraction and scattering anomalies, seriously affect the imaging quality and optical performance of the lens, and may even reduce the reliability and service life of the associated equipment. Therefore, in the Fresnel lens production process, accurate and efficient detection of bubble defects is a key link for guaranteeing product quality. At present, the bubble detection of the Fresnel lens mainly depends on a traditional optical detection method and a traditional machine vision detection method, and the prior art has the outstanding problems that the traditional optical detection method (such as manual visual detection and common light source auxiliary detection) depends on experience of detection personnel, the subjectivity is strong, the detection efficiency is low, the batch detection requirement of an industrial production line cannot be met, a large number of shadows can be formed by dense insections of the Fresnel lens under the projection of common light sources (natural light, surface light sources and point light sources), the dense insections are confused with gray features of bubbles, the bubble contrast is extremely low, especially tiny bubbles with the diameter of less than 50 mu m and hidden bubbles embedded in the interior are extremely easy to miss detection, and the detection precision is difficult to guarantee. The existing machine vision detection mostly adopts a general target detection algorithm (such as original YOLO v3/v5/v7, SSD and the like) to detect by combining with a general light source, and the core problem is that the algorithm, the light source and the detection object are not matched. On the one hand, the general light source imaging quality is poor, so that the characteristic signal-to-noise ratio of the bubble of the algorithm input image is low, the algorithm recognition difficulty is increased, and more importantly, the general algorithms such as original YOLO series and the like are not optimized for the insection interference of the Fresnel lens and the stripe distortion characteristics of the bubble, the Anchor Anchor frame parameters and the characteristic extraction network structure are all of general designs, the specific distortion characteristics of the bubble under stripe light cannot be accurately captured, the recognition precision of the bubble is low, the false detection rate is high, and the detection capability of the micro bubble is extremely poor. Meanwhile, the existing detection scheme based on the original YOLO series algorithm is not subjected to light weight optimization, so that the detection precision and speed are difficult to balance, and the speed requirement of industrial online detection of more than or equal to 30 frames/second cannot be met. Although the stripe light source has been tried to detect the defects of the transparent member, the prior art has two main defects, namely, firstly, the adaptation is single, the dense concentric circular stripe structure of the Fresnel lens is not considered for the flat transparent member such as the glass plate, the film and the like, the core parameters such as the stripe width, the spacing, the light and shade contrast of the stripe light source are not subjected to targeted matching design, the stripe and the bubble can not be distinguished by the stripe light projection, secondly, the projection angle is blindly designed, the angle optimization is not carried out by combining the extending direction of the Fresnel lens stripe and the light transmission characteristic, the stripe and the stripe interference are caused by the oblique projection in the prior art, and the defects can not be distinguished if the parameters are not matched in the vertical projection, so that the shadow distortion characteristics of the bubble can not be distinguished after the stripe light projection, and a new interference texture can be formed due to the interference of the stripe and the strip