Lens defect detection method, device, equipment, medium and program product

By transforming in the YOLO model, removing the downsampling layer and reducing the number of channels, the target YOLO model is obtained for lens defect detection, which solves the problem of difficulty in identifying multiple types of defects at the same time in the prior art, and achieves general rapid detection of multiple defects.

CN119600414APending Publication Date: 2025-03-11GOERTEK INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411729641.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The existing lens defect detection models are difficult to identify multiple types of defects at the same time, and they are poor in their application to defect detection on different lenses, making it difficult to cope with the detection requirements of multiple varieties and short-cycle lens product production lines.

Method used

By removing the downsampling layer of the first target convolution layer in the network structure of the YOLO model and reducing the number of channels of the second target convolution layer, the target YOLO model is obtained for defect detection on the lens image. While maintaining the ability to detect large-size defects, this method improves the ability to detect small-size defects and realizes general and fast detection.

Benefits of technology

It realizes simultaneous detection of defects of various types of lenses, improves the detection ability of small-size defects, reduces model complexity, improves processing speed, and can cope with the detection requirements of multiple varieties and short-cycle lens product production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119600414A_ABST
    Figure CN119600414A_ABST
Patent Text Reader

Abstract

The invention discloses a lens defect detection method and device, equipment, a medium and a program product, and relates to the technical field of defect detection.An existing YOLO model is transformed, in a network structure of the YOLO model, a down-sampling layer of a first target convolutional layer is removed, the number of channels of a second target convolutional layer is reduced, and a target YOLO model is obtained; and detecting lens defects of the to-be-detected lens based on the target YOLO model. When multiple defects possibly existing on a lens and different defects on different lenses simultaneously exist, a new defect detection model does not need to be trained and applied, and the capability of detecting other large-size defects can be reserved while the capability of detecting small-size defects can be improved through the modified YOLO model, so that the detection efficiency is improved, and the detection cost is reduced. Universal and rapid detection is realized, and the detection requirements of multiple varieties and short period of a lens product production line can be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of defect detection, and in particular to a lens defect detection method, a lens defect detection apparatus, a lens defect detection device, a storage medium and a computer program product. Background Art

[0002] During the refined production process of lens products such as XR (Extended Reality) lenses, process fluctuations, mechanical positioning errors, and environmental factors within the factory can cause various flaws and defects to appear on the surface or inside the lenses.

[0003] With the development of computer vision, a series of AI-based defect detection solutions have emerged, such as anomaly detection, object classification, and object detection technologies. These solutions can process massive data and accurately identify tiny defects.

[0004] However, the defect detection model currently trained by the dataset of a single type of lens defects can often only identify and detect a single type of defect. Furthermore, the defect detection model can only identify and detect two or several types of lens defects at most, and it is difficult to detect more types of defects at the same time.

[0005] When faced with multiple defects that may exist on a lens at the same time and different defects on different lenses, it is necessary to collect new training data to train a new defect detection model and switch to the new defect detection model for defect detection. This makes it difficult to cope with the multi-variety and short-cycle detection requirements of lens product production lines.

[0006] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0007] The main purpose of this application is to provide a lens defect detection method, a lens defect detection device, a lens defect detection equipment, a storage medium and a computer program product, aiming to solve the current technical problems of lens defect detection being highly targeted but poorly applicable.

[0008] To achieve the above objectives, the present application proposes a lens defect detection method, which comprises:

[0009] In the network structure of the YOLO model, the downsampling layer of the first target convolution layer is removed and the number of channels of the second target convolution layer is reduced to obtain the target YOLO model;

[0010] Collecting a lens image of the lens to be inspected;

[0011] Defect detection is performed on the lens image based on the target YOLO model, and lens defects present in the lens to be detected are determined according to the defect detection result.

[0012] In one embodiment, the step of acquiring a lens image of the lens to be inspected comprises:

[0013] Taking images of the lens to be inspected from the front and back sides under different light sources and focal lengths to obtain multiple lens images of the lens to be inspected;

[0014] The step of performing defect detection on the lens image based on the target YOLO model includes:

[0015] The lens image where the blurred lens defect is located is eliminated to obtain the defect detection result in the lens image where the clear lens defect is located.

[0016] In one embodiment, the step of removing the lens image where the blurred lens defect is located comprises:

[0017] The standard deviation of pixel values ​​in the region where the same lens defect is located in the plurality of lens images is calculated, and the lens image where the blurred lens defect is located is eliminated based on the standard deviation.

[0018] In one embodiment, the step of acquiring the lens image of the lens to be inspected comprises:

[0019] The lens images are cropped to obtain lens sub-images with overlapping regions between each other, wherein any pixel point of the lens image is located in one of the lens sub-images;

[0020] The step of performing defect detection on the lens image based on the target YOLO model comprises:

[0021] Based on the target YOLO model, defect detection is simultaneously performed on the lens sub-images of the lens image;

[0022] The step of performing defect detection on the lens image based on the target YOLO model includes:

[0023] The lens defects in the lens sub-image are deduplicated, and the deduplicated lens defects are mapped back into the lens image.

[0024] In one embodiment, the step of removing duplicate lens defects in the lens sub-image comprises:

[0025] Obtaining coordinate information and feature information of lens defects in each lens sub-image;

[0026] Based on the coordinate information and the feature information, it is determined that there are repeated lens defects in each lens sub-image.

[0027] In one embodiment, the step of determining the lens defects existing in the lens to be inspected according to the defect detection result comprises:

[0028] The lens defects present in the lens to be inspected are determined based on the area, position and / or number of the lens defects in the lens image and with reference to a preset inspection standard for the area and / or number of the lens defects in a preset area.

[0029] In addition, to achieve the above-mentioned purpose, the present application also proposes a lens defect detection device, the lens defect detection device comprising:

[0030] A transformation module, used for removing the downsampling layer of the first target convolution layer and reducing the number of channels of the second target convolution layer in the network structure of the YOLO model, to obtain a target YOLO model;

[0031] An acquisition module, used for acquiring a lens image of a lens to be inspected;

[0032] The determination module is used to perform defect detection on the lens image based on the target YOLO model, and determine the lens defects existing in the lens to be detected according to the defect detection result.

[0033] In addition, to achieve the above-mentioned purpose, the present application also proposes a lens defect detection device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the lens defect detection method described above.

[0034] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the lens defect detection method described above are implemented.

[0035] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the lens defect detection method described above are implemented.

[0036] One or more technical solutions proposed in this application have at least the following technical effects:

[0037] In this application, a general method for lens defect detection is proposed. By modifying the existing YOLO model, in the network structure of the YOLO model, the downsampling layer of the first target convolution layer is removed and the number of channels of the second target convolution layer is reduced to obtain a target YOLO model, and then the lens defects of the lens to be detected are detected based on the target YOLO model.

[0038] Among them, the downsampling layer is used to reduce the size of the feature map. The present application avoids the reduction of the feature map size by removing the downsampling layer of the first target convolution layer, that is, reduces the degree of reduction in the spatial resolution of the feature map, so that the YOLO model can retain more detailed information about small-sized defect targets, which is conducive to improving the detection capability of small-sized defects. At the same time, since more detailed information about small-sized defect targets is retained, when faced with the processing requirements of more data, the number of channels of some convolutional layers in the YOLO model network is reduced. In this way, while maintaining the detection capability of the YOLO model, the complexity of the YOLO model is effectively reduced, the processing speed is improved, and the actual detection efficiency is ensured.

[0039] Therefore, when faced with multiple defects that may exist on the lens at the same time and different defects on different lenses, there is no need to train and apply new defect detection models. Instead, the modified YOLO model can improve the detection capability of small-size defects while retaining the detection capability of other large-size defects, thereby achieving universal and rapid detection, which can meet the multi-variety and short-cycle detection requirements of lens product production lines. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0042] Figure 1 A schematic diagram of a process flow provided for Embodiment 1 of the lens defect detection method of the present application;

[0043] Figure 2 This is the first schematic diagram of the YOLOv5 network structure;

[0044] Figure 3 This is the second schematic diagram of the YOLOv5 network structure;

[0045] Figure 4 A schematic diagram of the YOLOv5 network transformation provided in Example 1 of the lens defect detection method of the present application;

[0046] Figure 5 A schematic diagram of blur defects provided in Example 2 of the lens defect detection method of the present application;

[0047] Figure 6A schematic diagram of lens area division provided in Embodiment 4 of the lens defect detection method of the present application;

[0048] Figure 7 A schematic diagram of a black spot defect provided in Example 4 of the lens defect detection method of the present application;

[0049] Figure 8 A schematic diagram of a coating hole defect provided in Example 4 of the lens defect detection method of the present application;

[0050] Fig. 9 A schematic diagram of dirt defects provided in Example 4 of the lens defect detection method of the present application;

[0051] Fig.10 A schematic diagram of a scratch defect provided in Example 4 of the lens defect detection method of the present application;

[0052] Fig.11 A schematic diagram of a bubble defect provided in Example 4 of the lens defect detection method of the present application;

[0053] Fig.12 This is a schematic diagram of the application of the lens defect detection method of this application;

[0054] Fig.13 This is a schematic diagram of the module structure of the lens defect detection device according to an embodiment of the present application;

[0055] Fig.14 Schematic diagram of the device structure of the hardware operating environment involved in the lens defect detection method in the embodiment of the present application.

[0056] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0057] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0058] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0059] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a lens defect detection device, etc. The following takes the lens defect detection device as an example to illustrate this embodiment and the following embodiments.

[0060] Based on this, the present application embodiment provides a lens defect detection method, referring to Figure 1 , Figure 1This is a flow chart of the first embodiment of the lens defect detection method of the present application.

[0061] In this embodiment, the lens defect detection method includes steps S10 to S30:

[0062] Step S10, in the network structure of the YOLO model, removing the downsampling layer of the first target convolutional layer and reducing the number of channels of the second target convolutional layer to obtain a target YOLO model;

[0063] Step S20, collecting a lens image of the lens to be tested;

[0064] Step S30, performing defect detection on the lens image based on the target YOLO model, and determining the lens defects existing in the lens to be detected according to the defect detection result.

[0065] Preferably, the embodiments of the present application are applied to the lens defect detection of XR (Extended Reality) lenses, wherein XR products include AR (augmented reality), VR (virtual reality) and MR (mixed reality) products.

[0066] Taking YOLOv5 as an example, the YOLOv5 network structure is explained. Figure 2 ,YOLOv5 network structure consists of three parts: Backbone network, Neck structure and Head structure. Among them, Backbone is responsible for feature extraction; Neck is responsible for feature fusion; Head contains three detection heads, which are responsible for outputting detection information.

[0067] In the YOLO object detection network, the detection head is located at the end of the network and is responsible for converting the network's feature map into the final detection result. The detection head usually includes a series of convolutional layers to predict the location of the bounding box, the confidence of the object, and the category probability. In other words, the detection head in the YOLO network is located after the front-end feature extraction (Backbone) and intermediate feature fusion (Neck) of the entire network. It is the final output part of the network and is directly responsible for producing the final result of object detection.

[0068] Further, see Figure 3, the downsampling layer is used to reduce the spatial resolution of the feature map, that is, to reduce the width and height of the feature map, thereby compressing the amount of data. The main purposes of downsampling include reducing the amount of calculation, increasing the receptive field, and preventing overfitting. Through downsampling, the model can more easily capture global or large-scale features and perceive a wider range of contextual information, which helps the model recognize more complex patterns and structures. The convolution layer is responsible for extracting local features from the input data through convolution operations, and extracting local information on the input feature map by sliding the convolution kernel (also called a filter) to obtain the output feature map. The convolution layer and the downsampling layer are used in combination. The convolution layer is used for feature extraction, while the downsampling layer (such as the pooling layer) is used to reduce the size of the feature map, helping the network to shift from local features to larger context or global features.

[0069] At present, the YOLO model has limitations in stably identifying tiny lens defects such as black spots and coating hole defects. Therefore, in this embodiment, the YOLO model is modified to enhance the model's sensitivity and detection stability for small-sized targets while keeping the detection efficiency as unaffected as possible. Figure 4 ,1. Adjust the network structure: remove the downsampling layer of the first target convolution layer. This adjustment reduces the degree of spatial resolution reduction of the feature map, allowing the YOLO model to retain more detailed information about small targets, thereby improving the detection ability of small-sized defects. The downsampling layer of the convolution layer before the detection head can be removed, for example Figure 4 The downsampling layer of the convolutional layer before the second C3 in , that is Figure 4 The stride in the layer is 1, no downsampling is performed (the downsampling layer is removed), and the number of channels is aligned with the next layer, which is 1. If the number of channels in the next layer is doubled, it is also doubled at the same time.

[0070] 2. Reduce the number of channels: In order to balance detection accuracy and computational efficiency, reduce the number of channels in the second target convolutional layer in the network. This strategy effectively reduces the complexity of the model, improves the processing speed, and ensures detection efficiency in practical applications while maintaining the detection capability of the model. The number of channels in some convolutional layers in the network can be halved, for example Figure 4 The number of channels after the convolution layer with the downsampling layer removed is halved, wherein the number of channels removed can also be reduced by 1 / 4 or other proportions, that is, part of the number of channels can also be removed.

[0071] As described above, in this embodiment, a YOLO variant model that is more suitable for small target detection is constructed. This model achieves reasonable maintenance of detection efficiency while ensuring stable detection of small target defects.

[0072] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. On this basis, step S20 includes:

[0073] Taking images of the lens to be inspected from the front and back sides under different light sources and focal lengths to obtain multiple lens images of the lens to be inspected;

[0074] The step of performing defect detection on the lens image based on the target YOLO model includes:

[0075] The lens image where the blurred lens defect is located is eliminated to obtain the defect detection result in the lens image where the clear lens defect is located.

[0076] At present, regarding lens imaging, firstly, defects are generally small. Even with a high-magnification camera (6500W pixels), a defect with an area of ​​0.0017mm^2 is only about 5*5 pixels. Secondly, due to the thickness of the lens, the defects inside the lens will appear blurred to different degrees at different focal lengths, such as Figure 5 shown.

[0077] Therefore, in this embodiment, multiple light sources such as backlight and coaxial light are selected to capture images from the front and back of the lens at different focal lengths to obtain multiple lens images of the lens to be inspected. Further, after defect detection is performed on each lens image based on the target YOLO model, the lens image where the blurred lens defect is located is removed to obtain the defect detection result in the lens image where the clear lens defect is located.

[0078] In addition, since the target detection dataset constructed covering multiple categories of lenses contains image data to be detected with various defects, the ability to identify similar defects in new lens products is enhanced.

[0079] In this embodiment, the specific features of the defects (such as edge clarity, contrast, etc.) can be used to identify and eliminate defects with blurred or uncertain imaging, thereby obtaining clear lens defects, thereby effectively reducing the false detection rate and improving the credibility of the detection results.

[0080] In a feasible implementation manner, the step of removing the lens image where the blurred lens defect is located comprises:

[0081] The standard deviation of the pixel values ​​in the region where the same lens defect is located in multiple lens images is calculated, and the lens image where the blurred lens defect is located is eliminated based on the standard deviation.

[0082] In this embodiment, the standard deviation of the pixel values ​​in each defect area is first calculated, and this value serves as an important indicator to measure the clarity of the defect area. The larger the standard deviation, the richer the detail information of the area in the image, that is, the clearer the image; conversely, a smaller standard deviation may indicate that the image is blurred or details are lost. Next, the standard deviation values ​​of multiple images of the same defect taken at different focal lengths are compared. Through this comparative analysis, blurred images caused by different defect depths can be intelligently identified and eliminated, and only those images with the clearest defects (largest standard deviation) are retained. This process ensures that subsequent defect area calculation, shape analysis and other steps are based on the highest quality image data, thereby greatly improving the accuracy and reliability of defect detection.

[0083] In summary, by introducing the standard deviation-based image clarity evaluation and screening mechanism, the problem of inconsistent clarity when the camera takes images at different focal lengths is effectively solved, providing a clear and accurate image basis for subsequent defect analysis, ensuring the efficiency and accuracy of the entire inspection process.

[0084] Based on the first embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above description, and will not be described in detail later. On this basis, the following steps are included after step S20:

[0085] The lens image is cropped to obtain lens sub-images with overlapping regions between each other, wherein any pixel point of the lens image is located in one of the lens sub-images;

[0086] Step S30 includes:

[0087] Based on the target YOLO model, defect detection is performed on the lens sub-images of the lens image simultaneously;

[0088] The step of performing defect detection on the lens image based on the target YOLO model includes:

[0089] The lens defects in the lens sub-image are deduplicated, and the deduplicated lens defects are mapped back to the lens image.

[0090] In this embodiment, first, for the lens image of the lens to be inspected, which is a high-resolution image (e.g., 9344x7000 pixels), in order to optimize the processing speed and memory usage, the lens image of the lens to be inspected is intelligently cropped to obtain lens sub-images with overlapping areas between each other. In one embodiment, it is divided into four medium-resolution sub-images of the same size (4100x3600 pixels), and the size of the overlapping area between each other can be 100 pixels. In this way, the amount of data processed for a single defect recognition is effectively reduced. It should be noted that the purpose of the overlapping area is to avoid missing defects or cropping defects into different sub-defects during the image cropping process, which may lead to defect recognition errors.

[0091] Secondly, based on the target YOLO model, defect detection is performed on the lens sub-images of the lens image at the same time. In one embodiment, parallel reasoning is performed on the four sub-images after intelligent cropping preprocessing. Through parallel computing, the detection efficiency is significantly improved, and the processing time of each image can be controlled within about 600 milliseconds.

[0092] Next, the lens defects in the lens sub-images are deduplicated and mapped back to the lens image. The defect coordinates in each small image are mapped back to the original large image to facilitate the subsequent determination of the defect area and location, thereby ensuring the accuracy of the detection results.

[0093] In a feasible implementation manner, the step of removing duplicate lens defects in the lens sub-image comprises:

[0094] Obtaining coordinate information and feature information of lens defects in each lens sub-image;

[0095] Based on the coordinate information and the feature information, it is determined that there are repeated lens defects in each lens sub-image.

[0096] In this embodiment, the coordinate information and feature information of the defects detected in each sub-image are used to determine and remove the defects detected repeatedly in the sub-image, so as to eliminate the repeated detection phenomenon caused by image splitting. It should be noted that the defects detected repeatedly in the sub-image refer to a defect that is detected simultaneously in different sub-images. If the repeatedly detected defects are not removed, the number of defects counted will be wrong, which will lead to misjudgment. In this way, the false detection rate is further effectively reduced and the reliability of the detection results is improved.

[0097] Based on the first embodiment of the present application, in the fourth embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above description, and will not be described in detail later. On this basis, the step of determining the lens defects existing in the lens to be inspected according to the defect detection result includes:

[0098] According to the area, position and / or number of the lens defects in the lens image, and with reference to the preset detection standard of the area and / or number of the preset lens defects in the preset area, the lens defects existing in the lens to be inspected are determined.

[0099] In this embodiment, in order to obtain an accurate value of the defect area, an image binarization method is used to clearly segment the detected defect area from the background, convert the defect area into a uniform pixel value (such as white or black), and the background maintains another uniform pixel value. By calculating the number of pixels occupied by the defect area in the binary image and considering the actual size and resolution of the image, the actual area of ​​the defect can be accurately calculated. In this process, the interference of background noise and color changes is effectively eliminated, ensuring the accuracy and reliability of area calculation.

[0100] In addition, based on the coordinate information of the defect and the pre-set lens area division rules, by comparing the relative positions of the defect coordinates and the area boundaries, the area where the defect is located can be quickly and accurately determined. Figure 6 , the lens is divided into area A and area B, and the area ranges of area A and area B are determined to obtain the area boundaries, wherein area B is about 2 mm away from the edge area of ​​the lens.

[0101] Then, according to the specific quality standards and requirements of the production line, each defect is further classified and evaluated with reference to the preset detection standards for the area and / or number of the preset lens defects in the preset area. In one embodiment, typical lens defects are as follows: Figure 7-11 As shown, they are black spots, coating holes, dirt, scratches and bubbles. The preset detection standards refer to Table 1 below.

[0102]

[0103]

[0104] Table 1

[0105] The above-mentioned methods have further improved the precision and accuracy of defect detection by introducing area calculation methods and regional positioning technology.

[0106] In the application scenario of a lens defect detection method of the present application, reference is made to Fig.12First, obtain the image acquisition result of camera 1, that is, the lens image of the lens to be detected taken by camera 1; then, in the image preprocessing stage, split it into several sub-images; secondly, in the AI ​​target detection model, that is, the target YOLO model, detect defects in several sub-images in parallel; in the image post-processing module I, remove the repeated false detection defects caused by the sub-images by restoring the detection result coordinates and removing the overlapping frames; in the image post-processing module II, remove the blurred defects in the 1-n lens images. Then, determine the defects in the lens images of the same lens to be detected taken by cameras 1-m. Finally, after summarizing all the defects in the lens image, refer to the preset detection standards for the area and / or number of preset lens defects in the preset area to determine the lens defects existing in the lens to be detected.

[0107] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the lens defect detection method of the present application. More simple transformations based on this technical concept are all within the protection scope of the present application.

[0108] This application also provides a lens defect detection device, please refer to Fig.13 , the lens defect detection device comprises:

[0109] A transformation module 10 is used to remove the downsampling layer of the first target convolution layer and reduce the number of channels of the second target convolution layer in the network structure of the YOLO model to obtain a target YOLO model;

[0110] The acquisition module 20 is used to acquire the lens image of the lens to be tested;

[0111] The determination module 30 is used to perform defect detection on the lens image based on the target YOLO model, and determine the lens defects existing in the lens to be detected according to the defect detection result.

[0112] In one embodiment, the acquisition module 20 is further used for:

[0113] Taking images of the lens to be inspected from the front and back sides under different light sources and focal lengths to obtain multiple lens images of the lens to be inspected;

[0114] The determining module 30 is further used for:

[0115] After the step of performing defect detection on the lens image based on the target YOLO model:

[0116] The lens image where the blurred lens defect is located is eliminated to obtain the defect detection result in the lens image where the clear lens defect is located.

[0117] In one embodiment, the determining module 30 is further configured to:

[0118] The standard deviation of the pixel values ​​in the region where the same lens defect is located in multiple lens images is calculated, and the lens image where the blurred lens defect is located is eliminated based on the standard deviation.

[0119] In one embodiment, the acquisition module 20 is further used for:

[0120] After the step of acquiring the lens image of the lens to be inspected:

[0121] The lens image is cropped to obtain lens sub-images with overlapping regions between each other, wherein any pixel point of the lens image is located in one of the lens sub-images;

[0122] The determining module 30 is further used for:

[0123] Based on the target YOLO model, defect detection is performed on the lens sub-images of the lens image simultaneously;

[0124] The determining module 30 is further used for:

[0125] After the step of performing defect detection on the lens image based on the target YOLO model:

[0126] The lens defects in the lens sub-image are deduplicated, and the deduplicated lens defects are mapped back to the lens image.

[0127] The determining module 30 is further used for:

[0128] Before the step of removing duplicate lens defects in the lens sub-image:

[0129] Obtaining coordinate information and feature information of lens defects in each lens sub-image;

[0130] Based on the coordinate information and the feature information, it is determined that there are repeated lens defects in each lens sub-image.

[0131] The determining module 30 is further used for:

[0132] According to the area, position and / or number of the lens defects in the lens image, and with reference to the preset detection standard of the area and / or number of the preset lens defects in the preset area, the lens defects existing in the lens to be inspected are determined.

[0133] The lens defect detection device provided by the present application adopts the lens defect detection method in the above embodiment, which can solve the technical problem that the current lens defect detection is highly targeted but poorly applicable. Compared with the prior art, the beneficial effects of the lens defect detection device provided by the present application are the same as the beneficial effects of the lens defect detection method provided by the above embodiment, and other technical features in the lens defect detection device are the same as the features disclosed in the above embodiment method, which will not be described in detail here.

[0134] The present application provides a lens defect detection device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the lens defect detection method in the above-mentioned embodiment one.

[0135] Reference below Fig.14 , which shows a schematic diagram of the structure of a lens defect detection device suitable for implementing the embodiment of the present application. The lens defect detection device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.14 The lens defect detection device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0136] like Fig.14As shown, the lens defect detection device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM) 1004. In the RAM 1004, various programs and data required for the operation of the lens defect detection device are also stored. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the lens defect detection device to communicate with other devices wirelessly or by wire to exchange data. Although the lens defect detection device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0137] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0138] The lens defect detection device provided by the present application adopts the lens defect detection method in the above embodiment, which can solve the technical problem that the current lens defect detection is highly targeted but poorly applicable. Compared with the prior art, the beneficial effects of the lens defect detection device provided by the present application are the same as the beneficial effects of the lens defect detection method provided by the above embodiment, and other technical features in the lens defect detection device are the same as the features disclosed in the method of the previous embodiment, which will not be described in detail here.

[0139] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0140] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0141] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the lens defect detection method in the above-mentioned embodiment.

[0142] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0143] The computer-readable storage medium may be included in the lens defect detection device; or may exist independently without being assembled into the lens defect detection device.

[0144] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the lens defect detection device, the lens defect detection device: in the network structure of the YOLO model, removes the downsampling layer of the first target convolution layer and reduces the number of channels of the second target convolution layer to obtain a target YOLO model; collects a lens image of the lens to be detected; performs defect detection on the lens image based on the target YOLO model, and determines the lens defects existing in the lens to be detected according to the defect detection results.

[0145] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0146] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0147] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0148] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned lens defect detection method, and can solve the technical problem that the current lens defect detection has strong pertinence and poor applicability. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the lens defect detection method provided by the above-mentioned embodiment, and will not be repeated here.

[0149] The present application also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the lens defect detection method as described above are implemented.

[0150] The computer program product provided by the present application can solve the technical problem that the current lens defect detection is highly targeted but poorly applicable. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the lens defect detection method provided by the above embodiment, which will not be elaborated here.

[0151] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A lens defect detection method, characterized in that: The lens defect detection method comprises: In the network structure of the YOLO model, the downsampling layer of the first target convolution layer is removed and the number of channels of the second target convolution layer is reduced to obtain the target YOLO model; Collecting a lens image of the lens to be inspected; Defect detection is performed on the lens image based on the target YOLO model, and lens defects present in the lens to be detected are determined according to the defect detection result.

2. The lens defect detection method according to claim 1, characterized in that: The step of acquiring the lens image of the lens to be inspected comprises: Taking images of the lens to be inspected from the front and back sides under different light sources and focal lengths to obtain multiple lens images of the lens to be inspected; The step of performing defect detection on the lens image based on the target YOLO model includes: The lens image where the blurred lens defect is located is eliminated to obtain the defect detection result in the lens image where the clear lens defect is located.

3. The lens defect detection method according to claim 2, characterized in that: The step of removing the lens image where the blurred lens defect is located comprises: The standard deviation of pixel values ​​in the region where the same lens defect is located in the plurality of lens images is calculated, and the lens image where the blurred lens defect is located is eliminated based on the standard deviation.

4. The lens defect detection method according to claim 1, characterized in that: The step of acquiring the lens image of the lens to be inspected comprises: The lens images are cropped to obtain lens sub-images with overlapping regions between each other, wherein any pixel point of the lens image is located in one of the lens sub-images; The step of performing defect detection on the lens image based on the target YOLO model comprises: Based on the target YOLO model, defect detection is simultaneously performed on the lens sub-images of the lens image; The step of performing defect detection on the lens image based on the target YOLO model includes: The lens defects in the lens sub-image are deduplicated, and the deduplicated lens defects are mapped back into the lens image.

5. The lens defect detection method according to claim 4, characterized in that: The step of removing duplicate lens defects in the lens sub-image comprises: Obtaining coordinate information and feature information of lens defects in each lens sub-image; Based on the coordinate information and the feature information, it is determined that there are repeated lens defects in each lens sub-image.

6. The lens defect detection method according to claim 1, characterized in that: The step of determining the lens defects existing in the lens to be inspected according to the defect detection result comprises: The lens defects present in the lens to be inspected are determined based on the area, position and / or number of the lens defects in the lens image and with reference to a preset inspection standard for the area and / or number of the lens defects in a preset area.

7. A lens defect detection device, characterized in that: The lens defect detection device comprises: A transformation module, used for removing the downsampling layer of the first target convolution layer and reducing the number of channels of the second target convolution layer in the network structure of the YOLO model, to obtain a target YOLO model; An acquisition module, used for acquiring a lens image of a lens to be inspected; The determination module is used to perform defect detection on the lens image based on the target YOLO model, and determine the lens defects existing in the lens to be detected according to the defect detection result.

8. A lens defect detection device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the lens defect detection method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the lens defect detection method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the lens defect detection method according to any one of claims 1 to 6 are implemented.