CN115496740A - Lens defect detection method and system based on convolutional neural network - Google Patents

Lens defect detection method and system based on convolutional neural network Download PDF

Info

Publication number
CN115496740A
CN115496740A CN202211231659.9A CN202211231659A CN115496740A CN 115496740 A CN115496740 A CN 115496740A CN 202211231659 A CN202211231659 A CN 202211231659A CN 115496740 A CN115496740 A CN 115496740A
Authority
CN
China
Prior art keywords
channel
binary pattern
neural network
map
local binary
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202211231659.9A
Other languages
Chinese (zh)
Other versions
CN115496740B (en
Inventor
陈龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hubei Huaxin Photoelectric Co ltd
Original Assignee
Hubei Huaxin Photoelectric Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hubei Huaxin Photoelectric Co ltd filed Critical Hubei Huaxin Photoelectric Co ltd
Priority to CN202211231659.9A priority Critical patent/CN115496740B/en
Publication of CN115496740A publication Critical patent/CN115496740A/en
Application granted granted Critical
Publication of CN115496740B publication Critical patent/CN115496740B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • G06T7/0006Industrial image inspection using a design-rule based approach
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Multimedia (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Quality & Reliability (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Image Analysis (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)

Abstract

The application discloses a lens defect detection method based on a convolutional neural network. The method comprises the steps of firstly obtaining a first monochromatic image of a lens to be detected under the irradiation of a first monochromatic light source and a second monochromatic image of the lens to be detected under the irradiation of a second monochromatic light source, then extracting a first LBP local binary pattern map of the first monochromatic image and a second LBP local binary pattern map of the second monochromatic image, then aggregating the first LBP local binary pattern map and the second LBP local binary pattern map along the channel dimension to obtain a multi-channel LBP local binary pattern map, then obtaining a detection feature map by the multi-channel LBP local binary pattern map through a trained convolutional neural network model using a CBAM attention block, and finally obtaining a classification result for representing whether the lens to be detected has defects or not by the trained classifier. By the method, the defect detection can be efficiently and accurately carried out on the surface of the lens.

Description

Lens defect detection method and system based on convolutional neural network
Technical Field
The present application relates to the field of intelligent detection technologies, and more particularly, to a method and a system for detecting lens defects based on a convolutional neural network.
Background
The mobile phone camera module in the current market has more and more extensive application range, and the customer has more and more high requirements for the quality of the camera module, and the surface defect of the inner lens of the camera module greatly determines the imaging quality of the mobile phone camera module. The primary optical form of a cell phone lens is an aspheric lens having a structure that includes a central zone and an edge zone, i.e., an aspheric zone and a flat zone. The appearance yield of the product is generally controlled in an artificial visual inspection mode for detecting the defects of the mobile phone lens, and whether the surface defects meet the acceptance standards of customers or not is judged by directly clamping the coated lens for visual observation. The detection mode has low efficiency and long personnel training period, and the mode of manual observation has larger subjective difference and is easy to make mistakes.
Therefore, an optimized lens defect detection scheme is desired.
Disclosure of Invention
The present application is proposed to solve the above-mentioned technical problems. The embodiment of the application provides a lens defect detection method based on a convolutional neural network. The method comprises the steps of firstly obtaining a first monochromatic image of a lens to be detected under the irradiation of a first monochromatic light source and a second monochromatic image of the lens to be detected under the irradiation of a second monochromatic light source, then extracting a first LBP local binary pattern map of the first monochromatic image and a second LBP local binary pattern map of the second monochromatic image, then aggregating the first LBP local binary pattern map and the second LBP local binary pattern map along the channel dimension to obtain a multi-channel LBP local binary pattern map, then obtaining a detection feature map by the multi-channel LBP local binary pattern map through a trained convolutional neural network model using a CBAM attention block, and finally obtaining a classification result for representing whether the lens to be detected has defects or not by the trained classifier. By the method, the defect detection can be efficiently and accurately carried out on the surface of the lens.
According to one aspect of the application, a convolutional neural network-based lens defect detection method is provided, which includes:
acquiring a first monochromatic image of a lens to be detected under the irradiation of a first monochromatic light source and a second monochromatic image under the irradiation of a second monochromatic light source;
extracting a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image;
aggregating the first LBP local binary pattern map and the second LBP local binary pattern map along a channel dimension to obtain a multi-channel LBP local binary pattern map;
obtaining a detection feature map by the multi-channel LBP local binary pattern map through a trained convolutional neural network model using a CBAM attention block; and
and obtaining a classification result by the trained classifier of the detection characteristic diagram, wherein the classification result is used for indicating whether the lens to be detected has defects or not.
In the above-mentioned lens defect detecting method based on convolutional neural network, the extracting a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image includes:
converting the first monochromatic image and the second monochromatic image into grayscale images respectively to obtain a first grayscale image and a second grayscale image;
determining an LBP value of each pixel in the first gray-scale image based on the pixel value distribution of the neighborhood pixels of each pixel in the first gray-scale image to obtain a first LBP local binary pattern map; and
and determining the LBP value of each pixel in the second gray scale image based on the pixel value distribution of the neighborhood pixels of each pixel in the second gray scale image so as to obtain the second LBP local binary pattern map.
In the above method for detecting lens defects based on a convolutional neural network, the training the multichannel LBP local binary pattern map to obtain a detection feature map by using a convolutional neural network model of a CBAM attention block includes:
inputting the multichannel LBP local binary pattern graph into a convolution coding part of the convolution neural network model to obtain a convolution coding feature graph;
inputting the convolutional encoding feature map into a channel attention unit of a CBAM attention block of the convolutional neural network model to obtain a channel enhanced convolutional encoding feature map; and
inputting the channel enhanced convolutional coding feature map into a spatial attention unit of a CBAM attention block of the convolutional neural network model to obtain the detection feature map.
In the above convolutional neural network-based lens defect detection method, the inputting the multi-channel LBP local binary pattern map into a convolutional coding part of the convolutional neural network model to obtain a convolutional coding feature map includes: and performing convolution processing, pooling processing and nonlinear activation processing on input data in layer forward pass by using each layer of the convolution coding part to obtain the convolution coding feature map, wherein the input of the first layer of the convolution coding part is the multi-channel LBP local binary pattern map.
In the above method for detecting a lens defect based on a convolutional neural network, the inputting the convolutional encoding feature map into a channel attention unit of a CBAM attention block of the convolutional neural network model to obtain a channel enhanced convolutional encoding feature map includes:
calculating the global mean value of each feature matrix of the convolutional encoding feature map along the channel dimension to obtain a channel feature vector;
inputting the channel feature vector into a Softmax activation function to obtain a channel attention weighting vector; and
and respectively weighting each feature matrix of the convolution coding feature map along the channel dimension by taking the feature value of each position in the channel attention weighting vector as a weight so as to obtain the channel enhanced convolution coding feature map.
In the above method for detecting a lens defect based on a convolutional neural network, the inputting the channel enhanced convolutional coding feature map into a spatial attention unit of a CBAM attention block of the convolutional neural network model to obtain the detection feature map includes:
inputting the channel enhancement convolution coding feature map into a spatial attention unit of a CBAM attention block of the convolution neural network model to obtain a spatial attention map;
the space attention diagram is activated through a Softmax activation function to obtain a space attention feature diagram; and
and calculating the spatial attention feature map and the channel enhanced convolutional coding feature map, and multiplying the spatial attention feature map and the channel enhanced convolutional coding feature map according to position points to obtain the detection feature map.
In the above method for detecting a lens defect based on a convolutional neural network, the training the detection feature map by a trained classifier to obtain a classification result includes:
processing the detection feature map by using the classifier according to the following formula to obtain the classification result, wherein the formula is as follows:
Figure DEST_PATH_IMAGE001
wherein
Figure 595519DEST_PATH_IMAGE002
to
Figure DEST_PATH_IMAGE003
In order to be a weight matrix, the weight matrix,
Figure 599379DEST_PATH_IMAGE004
to
Figure DEST_PATH_IMAGE005
In order to be a vector of the offset,
Figure 89266DEST_PATH_IMAGE006
and projecting the detection feature map into a vector.
In the above method for detecting a lens defect based on a convolutional neural network, the method further comprises the steps of: training the convolutional neural network model using the CBAM attention block and the classifier;
wherein the training the convolutional neural network model using the CBAM attention block and the classifier comprises:
acquiring training data, wherein the training data comprises a first training monochromatic image of a test lens under the irradiation of the first monochromatic light source, a second training monochromatic image of the test lens under the irradiation of the second monochromatic light source and a real value of whether the test lens has defects or not;
extracting a first training LBP local binary pattern map of the first training monochrome image and a second training LBP local binary pattern map of the second training monochrome image;
aggregating the first training LBP local binary pattern graph and the second training LBP local binary pattern graph along a channel dimension to obtain a multi-channel training LBP local binary pattern graph;
passing the multichannel training LBP local binary pattern map through the convolutional neural network model using the CBAM attention block to obtain a training detection feature map and a training channel attention weighting vector;
passing the detected feature map through the classifier to obtain a classification loss function value;
calculating a local scene metric loss function value of a context statistic of the training channel attention weighting vector, the local scene metric loss function value of the context statistic being related to a mean and a variance of a set of eigenvalues for all positions of the training channel attention weighting vector; and
training the convolutional neural network model using CBAM attention blocks and the classifier with a weighted sum of the classification loss function values and the context-statistical local scene metric loss function values as loss function values.
In the above convolutional neural network-based lens defect detection method, the calculating a local scene metric loss function value of context statistics of the training channel attention weighting vector includes:
calculating a local scene metric loss function value of context statistics of the training channel attention weighting vector with the following formula;
wherein the formula is:
Figure 681921DEST_PATH_IMAGE008
wherein,
Figure DEST_PATH_IMAGE009
a feature value representing each position of the training channel attention weighting vector,
Figure 41971DEST_PATH_IMAGE010
and
Figure DEST_PATH_IMAGE011
respectively representing the mean and variance of the set of eigenvalues for each position in the training channel attention weighting vector,
Figure 516815DEST_PATH_IMAGE012
is the length of the training channel attention weighting vector,
Figure DEST_PATH_IMAGE013
an exponential operation representing a numerical value representing a calculation of a natural exponential function value raised to the numerical value.
According to another aspect of the present application, there is provided a convolutional neural network-based lens defect detection system, comprising:
the image acquisition module is used for acquiring a first monochromatic image of the lens to be detected under the irradiation of the first monochromatic light source and a second monochromatic image under the irradiation of the second monochromatic light source;
a local binary pattern map extraction module for extracting a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image;
an aggregation module configured to aggregate the first LBP local binary pattern map and the second LBP local binary pattern map along a channel dimension to obtain a multi-channel LBP local binary pattern map;
the coding module is used for obtaining a detection feature map by training the multichannel LBP local binary pattern map through a convolutional neural network model which is finished by training and uses a CBAM attention block; and
and the classification result generation module is used for obtaining a classification result by the trained classifier of the detection characteristic diagram, and the classification result is used for indicating whether the lens to be detected has defects or not.
Compared with the prior art, the lens defect detection method based on the convolutional neural network comprises the steps of firstly obtaining a first monochromatic image of a lens to be detected under the irradiation of a first monochromatic light source and a second monochromatic image of the lens to be detected under the irradiation of a second monochromatic light source, then extracting a first LBP local binary pattern map of the first monochromatic image and a second LBP local binary pattern map of the second monochromatic image, then aggregating the first LBP local binary pattern map and the second LBP local binary pattern map along a channel dimension to obtain a multi-channel LBP local binary pattern map, then enabling the multi-channel LBP local binary pattern map to pass through a trained convolutional neural network model which uses a CBAM attention block to obtain a detection feature map, and finally enabling the detection feature map to pass through a trained classifier to obtain a classification result which is used for representing whether the lens to be detected has defects. By the method, the defect detection can be efficiently and accurately carried out on the surface of the lens.
Drawings
The above and other objects, features and advantages of the present application will become more apparent by describing in more detail embodiments of the present application with reference to the attached drawings. The accompanying drawings are included to provide a further understanding of the embodiments of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the principles of the application. In the drawings, like reference numbers generally indicate like parts or steps.
Fig. 1 is a scene schematic diagram of a convolutional neural network-based lens defect detection method according to an embodiment of the present application.
Fig. 2 is a flowchart of a convolutional neural network-based lens defect detection method according to an embodiment of the present application.
Fig. 3 is a schematic configuration diagram of a convolutional neural network-based lens defect detection method according to an embodiment of the present disclosure.
Fig. 4 is a flowchart of the sub-step of step S120 in the convolutional neural network-based lens defect detection method according to the embodiment of the present application.
Fig. 5 is a flowchart of the sub-step of step S140 in the convolutional neural network-based lens defect detection method according to the embodiment of the present application.
Fig. 6 is a flowchart of the sub-step of step S142 in the convolutional neural network-based lens defect detection method according to the embodiment of the present application.
Fig. 7 is a flowchart of the sub-step of step S143 in the convolutional neural network based lens defect detection method according to the embodiment of the present application.
Fig. 8 is a flowchart of the substeps of training the convolutional neural network model using CBAM attention block and the classifier further included in the convolutional neural network based lens defect detection method according to the embodiment of the present application.
FIG. 9 is a block diagram of a convolutional neural network-based lens defect detection system according to an embodiment of the present application.
Detailed Description
Hereinafter, example embodiments according to the present application will be described in detail with reference to the accompanying drawings. It should be understood that the described embodiments are only some embodiments of the present application and not all embodiments of the present application, and that the present application is not limited by the example embodiments described herein.
Overview of a scene
As described above, the defect detection of the mobile phone lens usually adopts an artificial visual inspection mode to control the appearance yield of the product, and the coated lens is directly clamped and visually observed to judge whether the surface defect meets the customer acceptance standard. The detection mode has low efficiency and long personnel training period, and the mode of manual observation has large subjective difference and is easy to make mistakes. Therefore, an optimized lens defect detection scheme is desired.
The applicant of the present application has found that although the mobile phone lens is transparent in natural light, if an image of the mobile phone lens in natural light is collected, the surface defect of the mobile phone lens cannot be shown at the image end, but if the mobile phone lens is illuminated by a monochromatic light source, the surface defect of the mobile phone lens is highlighted in the image with the monochromatic light as the background. Based on the characteristic, in the technical scheme of the application, the lens to be detected is placed under the first monochromatic light source and the second monochromatic light source respectively, and the first monochromatic image of the lens to be detected under the irradiation of the first monochromatic light source and the second monochromatic image of the lens to be detected under the irradiation of the second monochromatic light source are collected. In one particular example, the first monochromatic light source is blue light and the second monochromatic light source is red light.
That is, in the technical solution of the present application, the lens defect detection problem may be converted into a classification problem based on the first monochromatic image and the second monochromatic image. Specifically, image features are extracted from the first monochromatic image and the second monochromatic image, and the image features are processed by a classifier to obtain a classification result for indicating whether the lens to be detected has defects or not.
The defects of the lens are considered to be mainly embodied on the texture feature level of the first monochromatic image and the second monochromatic image. Therefore, in the technical solution of the present application, before performing feature extraction by using a convolutional neural network model as a feature extractor, the first monochrome image and the second monochrome image are first processed to obtain a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image.
Here, the local binary pattern is a very effective texture description feature in the field of computer vision, and has many advantages, such as rotation invariance, translation invariance, and the problem of illumination change elimination, etc., and the specific principle is that 3 × 3 is taken as a window unit, if the peripheral pixel value is greater than the central pixel value, the pixel point is marked as 1, otherwise, the pixel point is marked as 0, then the neighborhood pixels are binarized, and the obtained values are multiplied by the binary sequence correspondingly and added to obtain the LBP value of the central pixel.
LBP is an operator used to extract local texture features of an image, describing its strong discriminative power in texture classification, namely:
Figure DEST_PATH_IMAGE015
Figure DEST_PATH_IMAGE017
wherein,
Figure 889021DEST_PATH_IMAGE018
is the coordinates of the center pixel and is,
Figure DEST_PATH_IMAGE019
is the gray value of the neighboring pixel,
Figure 336183DEST_PATH_IMAGE020
is the gray value of the center pixel point,
Figure DEST_PATH_IMAGE021
is a function of the sign.
After obtaining the first LBP local binary pattern map and the second LBP local binary pattern map, aggregating the first LBP local binary pattern map and the second LBP local binary pattern map along a channel dimension to obtain a multi-channel LBP local binary pattern map.
In the technical scenario of lens defect detection, the importance of pixels at different positions on the multi-channel LBP local binary pattern map may be different, and the importance of pixels in different channels may also be different. Therefore, the attention mechanism can be introduced to adjust the influence of different pixels on the defect detection result by using a specific network, so as to separate more remarkable features. Specifically, in the technical solution of the present application, the multichannel LBP local binary pattern map is subjected to a convolutional neural network model using a CBAM attention block (convolutional block association module) to obtain a detection feature map. Here, the CBAM attention block can learn importance weights of different positions or different channels in the feature map, and then multiply the learned importance weights with the median of the original feature map to output a new feature map.
And finally, the detection characteristic graph passes through a classifier to obtain a classification result, and the classification result is used for indicating whether the lens to be detected has defects or not. Therefore, the lens defect detection scheme is constructed by combining the convolutional neural network-based feature extractor with the image reconstruction technology and the like, and has relatively high detection accuracy and high intelligence.
In particular, in the convolutional neural network model of the CBAM attention block, the channel attention block obtains the channel attention weighting vector by globally pooling each feature matrix of the input feature map along the channel dimension, but since the feature value of each position of the channel attention weighting vector is obtained by pooling the global mean of the feature matrix of the corresponding channel position of the input feature map, the contextual relevance between the feature values of the channel attention weighting vector is weaker than that of the input feature map along the channel dimension, so that the contextual feature relevance expression capability of the channel attention weighting vector to the input feature map is weakened.
Therefore, in order to improve the context feature association expression capability of the channel attention weighting vector for the input feature map, in the technical solution of the present application, a local scene metric loss function of context statistics for the channel attention weighting vector is introduced, which is expressed as:
Figure 338905DEST_PATH_IMAGE008
here, ,
Figure 35466DEST_PATH_IMAGE010
and
Figure 132735DEST_PATH_IMAGE011
is a feature set
Figure 965562DEST_PATH_IMAGE022
The mean and the variance of (a) are,
Figure 60557DEST_PATH_IMAGE009
is the channel attention weighting vector
Figure DEST_PATH_IMAGE023
A characteristic value of each position of the image, and
Figure 260725DEST_PATH_IMAGE012
is the channel attention weighting vector
Figure 427264DEST_PATH_IMAGE023
Length of (d).
Here, the context statistical local scene metric loss function weights the channel attention weight vector based on the global pooling of each feature matrix along the channel based on the input feature map
Figure 849018DEST_PATH_IMAGE023
The feature value of each position is regarded as a separate channel feature descriptor to serve as a squeezing representation of the channel scene of the feature, so that the relevance of the local scene of each channel can be improved based on the context statistical measure of the class probability expression of the feature set as a loss function, and the context feature relevance expression capability of the channel attention weighting vector on the input feature map is improved. Thus, the accuracy of lens defect detection is improved.
Based on this, the present application provides a convolutional neural network-based lens defect detection method, which includes: acquiring a first monochromatic image of a lens to be detected under the irradiation of a first monochromatic light source and a second monochromatic image under the irradiation of a second monochromatic light source; extracting a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image; aggregating the first LBP local binary pattern map and the second LBP local binary pattern map along a channel dimension to obtain a multi-channel LBP local binary pattern map; obtaining a detection feature map by the multi-channel LBP local binary pattern map through a trained convolutional neural network model using a CBAM attention block; and obtaining a classification result by the trained classifier of the detection characteristic diagram, wherein the classification result is used for indicating whether the lens to be detected has defects or not.
Fig. 1 illustrates an application scenario of a convolutional neural network-based lens defect detection method according to an embodiment of the present application. As shown in fig. 1, in this application scenario, a first monochromatic image (e.g., D1 as illustrated in fig. 1) of a lens to be detected (e.g., L as illustrated in fig. 1) under irradiation of a first monochromatic light source (e.g., G1 as illustrated in fig. 1) and a second monochromatic image (e.g., D2 as illustrated in fig. 1) under irradiation of a second monochromatic light source (e.g., G2 as illustrated in fig. 1) are acquired by a device such as a camera (e.g., C as illustrated in fig. 1), and then the first monochromatic image and the second monochromatic image are input to a server (e.g., S as illustrated in fig. 1) in which a convolutional neural network-based lens defect detection algorithm is deployed, wherein the server is capable of generating a classification result for indicating whether the lens to be detected has defects based on the convolutional neural network-based lens defect detection algorithm. In one specific example, the first monochromatic light source is blue light, and the second monochromatic light source is red light.
Having described the general principles of the present application, various non-limiting embodiments of the present application will now be described with reference to the accompanying drawings.
Exemplary method
Fig. 2 illustrates a flow chart of a convolutional neural network-based lens defect detection method according to an embodiment of the present application. As shown in fig. 2, a convolutional neural network-based lens defect detection method according to an embodiment of the present application includes the steps of: s110, acquiring a first monochromatic image of a lens to be detected under the irradiation of a first monochromatic light source and a second monochromatic image under the irradiation of a second monochromatic light source; s120, extracting a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image; s130, aggregating the first LBP local binary pattern map and the second LBP local binary pattern map along a channel dimension to obtain a multi-channel LBP local binary pattern map; s140, obtaining a detection feature map by the multi-channel LBP local binary pattern map through a trained convolutional neural network model using a CBAM (cone beam-based adaptive spatial multiplexing) attention block; and S150, obtaining a classification result by the classifier which is trained and completed on the detection characteristic diagram, wherein the classification result is used for indicating whether the lens to be detected has defects or not.
Fig. 3 illustrates an architecture diagram of a convolutional neural network-based lens defect detection method according to an embodiment of the present application. As shown in fig. 3, in the network architecture, first, a first monochromatic image of a lens to be detected under illumination of a first monochromatic light source and a second monochromatic image under illumination of a second monochromatic light source are obtained; next, extracting a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image; then, aggregating the first LBP local binary pattern map and the second LBP local binary pattern map along a channel dimension to obtain a multi-channel LBP local binary pattern map; secondly, obtaining a detection characteristic map by the multi-channel LBP local binary pattern map through a trained convolutional neural network model using a CBAM attention block; and finally, obtaining a classification result by the trained classifier of the detection characteristic diagram, wherein the classification result is used for indicating whether the lens to be detected has defects or not.
More specifically, in step S110, a first monochromatic image of the lens to be detected under the illumination of the first monochromatic light source and a second monochromatic image under the illumination of the second monochromatic light source are acquired. The mobile phone lens is transparent under natural light, so if an image of the mobile phone lens under natural light is collected, the surface defect of the mobile phone lens cannot be presented at the image end, but if the mobile phone lens is irradiated under a monochromatic light source, the surface defect of the mobile phone lens can be highlighted in the image with the monochromatic light as the background. Based on the characteristic, in the technical scheme of the application, the lens to be detected is placed under the first monochromatic light source and the second monochromatic light source respectively, and the first monochromatic image of the lens to be detected under the irradiation of the first monochromatic light source and the second monochromatic image of the lens to be detected under the irradiation of the second monochromatic light source are collected. In one particular example, the first monochromatic light source is blue light and the second monochromatic light source is red light.
More specifically, in step S120, a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image are extracted. The defects of the lens are considered to be mainly embodied on the texture feature level of the first monochromatic image and the second monochromatic image. Therefore, in the technical solution of the present application, before performing feature extraction by using a convolutional neural network model as a feature extractor, the first monochrome image and the second monochrome image are first processed to obtain a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image. Here, the local binary pattern is a very effective texture description feature in the field of computer vision, and has many advantages, such as rotation invariance, translation invariance, and the problem of illumination change elimination.
Accordingly, in a specific example, as shown in fig. 4, in the convolutional neural network-based lens defect detection method, the extracting a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image includes: s121, converting the first monochromatic image and the second monochromatic image into grayscale images respectively to obtain a first grayscale image and a second grayscale image; s122, determining, based on the pixel value distribution of the neighborhood pixels of each pixel in the first grayscale image, an LBP value of each pixel in the first grayscale image to obtain the first LBP local binary pattern map; and S123, determining the LBP value of each pixel in the second gray scale image based on the pixel value distribution of the neighborhood pixels of each pixel in the second gray scale image to obtain the second LBP local binary pattern map.
More specifically, in step S130, the first LBP local binary pattern map and the second LBP local binary pattern map are aggregated along a channel dimension to obtain a multi-channel LBP local binary pattern map.
In the technical scenario of lens defect detection, the importance of pixels at different positions on the multi-channel LBP local binary pattern map may be different, and the importance of pixels in different channels may also be different. Therefore, the attention-drawing mechanism can adjust the influence of different pixels on the defect detection result by using a specific network, thereby separating more remarkable features. Specifically, in the technical solution of the present application, the multichannel LBP local binary pattern map is subjected to a convolutional neural network model using a CBAM attention block (convolutional block association module) to obtain a detection feature map. Here, the CBAM attention block can learn importance weights of different positions or different channels in the feature map, and then multiply the learned importance weights with the median of the original feature map to output a new feature map. And finally, passing the detection characteristic diagram through a classifier to obtain a classification result, wherein the classification result is used for indicating whether the lens to be detected has defects or not. Therefore, the lens defect detection scheme is constructed by combining the convolutional neural network-based feature extractor with the image reconstruction technology and the like, and has relatively high detection accuracy and high intelligence.
More specifically, in step S140, the multi-channel LBP local binary pattern map is trained by using a convolutional neural network model of CBAM attention block to obtain a detection feature map.
Accordingly, in a specific example, as shown in fig. 5, in the convolutional neural network-based lens defect detection method, the training the multichannel LBP local binary pattern map to obtain a detection feature map by using a convolutional neural network model of a CBAM attention block includes: s141, inputting the multichannel LBP local binary pattern diagram into a convolution coding part of the convolution neural network model to obtain a convolution coding feature diagram; s142, inputting the convolutional encoding feature map into a channel attention unit of a CBAM attention block of the convolutional neural network model to obtain a channel enhanced convolutional encoding feature map; and S143, inputting the channel enhancement convolution coding feature map into a spatial attention unit of a CBAM attention block of the convolution neural network model to obtain the detection feature map.
Accordingly, in a specific example, in the convolutional neural network-based lens defect detection method, the inputting the multichannel LBP local binary pattern map into a convolutional encoding part of the convolutional neural network model to obtain a convolutional encoding feature map includes: and performing convolution processing, pooling processing and nonlinear activation processing on input data in layer forward pass by using each layer of the convolution coding part to obtain the convolution coding feature map, wherein the input of the first layer of the convolution coding part is the multi-channel LBP local binary pattern map.
Accordingly, in a specific example, as shown in fig. 6, in the convolutional neural network based eyeglass defect detection method, the inputting the convolutional encoding feature map into a channel attention unit of a CBAM attention block of the convolutional neural network model to obtain a channel enhanced convolutional encoding feature map includes: s1421, calculating a global mean value of each feature matrix along a channel dimension of the convolutional encoding feature map to obtain a channel feature vector; s1422, inputting the channel feature vector into a Softmax activation function to obtain a channel attention weighting vector; and S1423, weighting each feature matrix of the convolution coding feature map along the channel dimension by taking the feature value of each position in the channel attention weighting vector as a weight to obtain the channel enhanced convolution coding feature map.
Accordingly, in a specific example, as shown in fig. 7, in the method for detecting a lens defect based on a convolutional neural network, the inputting the channel enhanced convolutional coding feature map into a spatial attention unit of a CBAM attention block of the convolutional neural network model to obtain the detection feature map includes: s1431, inputting the channel enhancement convolution coding feature map into a spatial attention unit of a CBAM (convolutional neural network) attention block of the convolutional neural network model to obtain a spatial attention map; s1432, activating a function of the space attention diagram through Softmax to obtain a space attention feature diagram; and S1433, calculating the position-point-by-position multiplication of the spatial attention feature map and the channel enhancement convolutional coding feature map to obtain the detection feature map.
More specifically, in step S150, the detection feature map is processed through a trained classifier to obtain a classification result, where the classification result is used to indicate whether the lens to be detected has a defect.
Accordingly, in a specific example, in the convolutional neural network-based lens defect detection method, the training the detection feature map through a trained classifier to obtain a classification result includes: processing the detection feature map by using the classifier according to the following formula to obtain the classification result, wherein the formula is as follows:
Figure 925034DEST_PATH_IMAGE001
wherein
Figure 65028DEST_PATH_IMAGE002
to
Figure 972941DEST_PATH_IMAGE003
In the form of a matrix of weights,
Figure 514781DEST_PATH_IMAGE004
to
Figure 13896DEST_PATH_IMAGE005
In order to be a vector of the offset,
Figure 657498DEST_PATH_IMAGE006
and projecting the detection characteristic diagram into a vector.
Accordingly, in a specific example, as shown in fig. 8, in the convolutional neural network-based lens defect detection method, the method further includes the steps of: training the convolutional neural network model using the CBAM attention block and the classifier; wherein the training the convolutional neural network model using the CBAM attention block and the classifier comprises: s210, acquiring training data, wherein the training data comprises a first training monochromatic image of a test lens under the irradiation of the first monochromatic light source, a second training monochromatic image of the test lens under the irradiation of the second monochromatic light source, and a true value of whether the test lens has defects or not; s220, extracting a first training LBP local binary pattern map of the first training monochrome image and a second training LBP local binary pattern map of the second training monochrome image; s230, aggregating the first training LBP local binary pattern graph and the second training LBP local binary pattern graph along a channel dimension to obtain a multi-channel training LBP local binary pattern graph; s240, enabling the multichannel training LBP local binary pattern map to pass through the convolutional neural network model using the CBAM attention block to obtain a training detection feature map and a training channel attention weighting vector; s250, passing the detection characteristic diagram through the classifier to obtain a classification loss function value; s260, calculating a local scene metric loss function value of context statistics of the training channel attention weighting vector, where the local scene metric loss function value of context statistics is related to a mean and a variance of feature value sets of all positions of the training channel attention weighting vector; and S270, training the convolutional neural network model using the CBAM attention block and the classifier with a weighted sum of the classification loss function values and the context-statistical local scene metric loss function values as loss function values.
In particular, in the convolutional neural network model of the CBAM attention block, the channel attention block obtains the channel attention weighting vector by globally pooling each feature matrix of the input feature map along the channel dimension, but since the feature value of each position of the channel attention weighting vector is obtained by pooling the global mean of the feature matrix of the corresponding channel position of the input feature map, the contextual relevance between the feature values of the channel attention weighting vector is weaker than that of the input feature map along the channel dimension, so that the contextual feature relevance expression capability of the channel attention weighting vector to the input feature map is weakened. Therefore, in order to improve the context feature association expression capability of the channel attention weighting vector for the input feature map, in the technical solution of the present application, a local scene metric loss function of context statistics for the channel attention weighting vector is introduced.
Accordingly, in one specific example, in the convolutional neural network-based lens defect detection method, the calculating a local scene metric loss function value of context statistics of the training channel attention weighting vector includes: calculating a local scene metric loss function value of context statistics of the training channel attention weighting vector in the following formula; wherein the formula is:
Figure 900260DEST_PATH_IMAGE008
wherein,
Figure 296606DEST_PATH_IMAGE009
a feature value representing each position of the training channel attention weight vector,
Figure 966622DEST_PATH_IMAGE010
and
Figure 284471DEST_PATH_IMAGE011
means and variances representing sets of eigenvalues for respective positions in the training channel attention weighting vector respectively,
Figure 816078DEST_PATH_IMAGE012
is the length of the training channel attention weight vector,
Figure 332510DEST_PATH_IMAGE013
an exponential operation representing a numerical value representing a calculation of a natural exponential function value raised to the numerical value.
Here, the context-statistical local scene metric loss function is based on the input feature map-based edge-passGlobal pooling of each feature matrix of a lane, weighting vectors of the lane attention
Figure 439006DEST_PATH_IMAGE023
The feature value of each position of the input feature map is regarded as a separate channel feature descriptor to serve as a squeezing representation of the channel scene of the feature, so that the relevance of the local scene of each channel can be improved based on the context statistical measure of the class probability expression of the feature set as a loss function, and the context feature relevance expression capability of the channel attention weighting vector on the input feature map is improved. Thus, the accuracy of lens defect detection is improved.
In summary, according to the lens defect detection method based on the convolutional neural network in the embodiment of the present application, a first monochromatic image of a lens to be detected under the irradiation of a first monochromatic light source and a second monochromatic image of the lens to be detected under the irradiation of a second monochromatic light source are first obtained, then, a first LBP local binary pattern map of the first monochromatic image and a second LBP local binary pattern map of the second monochromatic image are extracted, then, the first LBP local binary pattern map and the second LBP local binary pattern map are aggregated along a channel dimension to obtain a multi-channel LBP local binary pattern map, then, the multi-channel LBP local binary pattern map is passed through a trained convolutional neural network model using a CBAM attention block to obtain a detection feature map, and finally, the detection feature map is passed through a trained classifier to obtain a classification result for representing whether the lens to be detected has a defect. By the method, the defect detection can be efficiently and accurately carried out on the surface of the lens.
Exemplary System
FIG. 9 illustrates a block diagram of a convolutional neural network-based lens defect detection system 100 in accordance with an embodiment of the present application. As shown in fig. 9, a convolutional neural network based lens defect detection system 100 according to an embodiment of the present application includes: the image acquisition module 110 is used for acquiring a first monochromatic image of the lens to be detected under the irradiation of the first monochromatic light source and a second monochromatic image under the irradiation of the second monochromatic light source; a local binary pattern map extraction module 120 for extracting a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image; an aggregation module 130, configured to aggregate the first LBP local binary pattern map and the second LBP local binary pattern map along a channel dimension to obtain a multi-channel LBP local binary pattern map; the encoding module 140 is configured to obtain a detection feature map from the multi-channel LBP local binary pattern map through a trained convolutional neural network model using a CBAM attention block; and a classification result generating module 150, configured to obtain a classification result by using the trained classifier of the detection feature map, where the classification result is used to indicate whether the lens to be detected has a defect.
In one example, in the above convolutional neural network based lens defect detection system 100, the local binary pattern map extraction module 120 includes: a grayscale image obtaining unit, configured to convert the first monochrome image and the second monochrome image into grayscale images to obtain a first grayscale image and a second grayscale image, respectively; a first LBP local binary pattern map obtaining unit, configured to determine, based on a pixel value distribution of a neighborhood pixel of each pixel in the first grayscale image, an LBP value of each pixel in the first grayscale image to obtain the first LBP local binary pattern map; and a second LBP local binary pattern map obtaining unit, configured to determine, based on a pixel value distribution of a neighborhood pixel of each pixel in the second gray scale image, an LBP value of each pixel in the second gray scale image to obtain the second LBP local binary pattern map.
In one example, in the above convolutional neural network-based lens defect detection system 100, the encoding module 140 includes: a convolution coding feature map obtaining unit, configured to input the multi-channel LBP local binary pattern map into a convolution coding portion of the convolution neural network model to obtain a convolution coding feature map; the channel enhancement unit is used for inputting the convolutional coding feature map into a channel attention unit of a CBAM attention block of the convolutional neural network model to obtain a channel enhancement convolutional coding feature map; and the detection characteristic map acquisition unit is used for inputting the channel enhancement convolution coding characteristic map into a space attention unit of a CBAM attention block of the convolution neural network model to obtain the detection characteristic map.
In an example, in the above convolutional neural network based lens defect detection system 100, the convolutional encoding feature map obtaining unit is further configured to: and respectively carrying out convolution processing, pooling processing and nonlinear activation processing on input data in forward pass of layers by using each layer of the convolution coding part to obtain the convolution coding feature map, wherein the input of the first layer of the convolution coding part is the multi-channel LBP local binary pattern map.
In one example, in the above convolutional neural network-based lens defect detection system 100, the channel enhancement unit is further configured to: calculating the global mean value of each feature matrix of the convolutional encoding feature map along the channel dimension to obtain a channel feature vector; inputting the channel feature vector into a Softmax activation function to obtain a channel attention weighting vector; and respectively weighting each feature matrix of the convolutional encoding feature map along the channel dimension by taking the feature value of each position in the channel attention weighting vector as a weight so as to obtain the channel enhanced convolutional encoding feature map.
In an example, in the above convolutional neural network-based lens defect detecting system 100, the detection feature map obtaining unit is further configured to: inputting the channel enhanced convolutional coding feature map into a spatial attention unit of a CBAM attention block of the convolutional neural network model to obtain a spatial attention map; passing the spatial attention map through a Softmax activation function to obtain a spatial attention feature map; and calculating the position-point-by-position multiplication of the spatial attention feature map and the channel enhancement convolutional coding feature map to obtain the detection feature map.
In one example, in the above convolutional neural network based lens defect detection system 100, the classification result generating module 150 is further configured to: using the classifier to perform the detection on the feature map according to the following formulaProcessing to obtain the classification result, wherein the formula is:
Figure 40889DEST_PATH_IMAGE001
wherein
Figure 376186DEST_PATH_IMAGE002
to
Figure 747125DEST_PATH_IMAGE003
In order to be a weight matrix, the weight matrix,
Figure 962205DEST_PATH_IMAGE004
to
Figure 785805DEST_PATH_IMAGE005
In order to be a vector of the offset,
Figure 174061DEST_PATH_IMAGE006
and projecting the detection characteristic diagram into a vector.
In one example, in the convolutional neural network based eyeglass defect detection system 100 described above, the convolutional neural network based eyeglass defect detection system further comprises: a training module for training the convolutional neural network model using the CBAM attention block and the classifier; wherein the training module comprises: a training data acquisition unit for acquiring training data including a first training monochrome image of a test lens under illumination of the first monochromatic light source, a second training monochrome image of the test lens under illumination of the second monochromatic light source, and a true value of whether the test lens has a defect; a training LBP local binary pattern map extracting unit for extracting a first training LBP local binary pattern map of the first training monochrome image and a second training LBP local binary pattern map of the second training monochrome image; a training aggregation unit, configured to aggregate the first training LBP local binary pattern map and the second training LBP local binary pattern map along a channel dimension to obtain a multi-channel training LBP local binary pattern map; the training coding unit is used for enabling the multichannel training LBP local binary pattern map to pass through the convolutional neural network model using the CBAM attention block so as to obtain a training detection feature map and a training channel attention weighting vector; the classification loss function value acquisition unit is used for enabling the detection characteristic diagram to pass through the classifier so as to obtain a classification loss function value; a local scene metric loss function value calculation unit for calculating a local scene metric loss function value of context statistics of the training channel attention weighting vector, the local scene metric loss function value of context statistics being related to a mean and a variance of a set of eigenvalues of all positions of the training channel attention weighting vector; and a convolutional neural network model and classifier training unit to train the convolutional neural network model using CBAM attention block and the classifier with a weighted sum of the classification loss function values and the context-statistical local scene metric loss function values as a loss function value.
In one example, in the above convolutional neural network based lens defect detection system 100, the local scene metric loss function value calculating unit is further configured to: calculating a local scene metric loss function value of context statistics of the training channel attention weighting vector in the following formula; wherein the formula is:
Figure 147309DEST_PATH_IMAGE008
wherein,
Figure 595607DEST_PATH_IMAGE009
a feature value representing each position of the training channel attention weighting vector,
Figure 172082DEST_PATH_IMAGE010
and
Figure 98450DEST_PATH_IMAGE011
respectively representing the mean and variance of the set of eigenvalues for each position in the training channel attention weighting vector,
Figure 929134DEST_PATH_IMAGE012
is the length of the training channel attention weight vector,
Figure 751596DEST_PATH_IMAGE013
an exponential operation representing a numerical value representing a calculation of a natural exponential function value raised to the numerical value.
Here, it can be understood by those skilled in the art that the specific functions and operations of the respective units and modules in the convolutional neural network-based eyeglass defect detection system 100 have been described in detail in the above description of the convolutional neural network-based eyeglass defect detection method with reference to fig. 1 to 8, and thus, a repetitive description thereof will be omitted.
As described above, the convolutional neural network based lens defect detection system 100 according to the embodiment of the present application may be implemented in various wireless terminals, such as a server of a convolutional neural network based lens defect detection algorithm, and the like. In one example, the convolutional neural network-based lens defect detection system 100 according to an embodiment of the present application may be integrated into a wireless terminal as one software module and/or hardware module. For example, the convolutional neural network-based lens defect detection system 100 may be a software module in the operating system of the wireless terminal, or may be an application developed for the wireless terminal; of course, the convolutional neural network-based lens defect detection system 100 can also be one of many hardware modules of the wireless terminal.
Alternatively, in another example, the convolutional neural network based lens defect detection system 100 and the wireless terminal may also be separate devices, and the convolutional neural network based lens defect detection system 100 may be connected to the wireless terminal through a wired and/or wireless network and transmit the mutual information according to an agreed data format.
The foregoing describes the general principles of the present application in conjunction with specific embodiments, however, it is noted that the advantages, effects, etc. mentioned in the present application are merely examples and are not limiting, and they should not be considered essential to the various embodiments of the present application. Furthermore, the foregoing disclosure of specific details is for the purpose of illustration and description and is not intended to be limiting, since the foregoing disclosure is not intended to be exhaustive or to limit the disclosure to the precise details disclosed.
The block diagrams of devices, apparatuses, systems referred to in this application are only given as illustrative examples and are not intended to require or imply that the connections, arrangements, configurations, etc. must be made in the manner shown in the block diagrams. These devices, apparatuses, devices, systems may be connected, arranged, configured in any manner, as will be appreciated by one skilled in the art. Words such as "including," "comprising," "having," and the like are open-ended words that mean "including, but not limited to," and are used interchangeably therewith. As used herein, the words "or" and "refer to, and are used interchangeably with, the word" and/or, "unless the context clearly dictates otherwise. The word "such as" is used herein to mean, and is used interchangeably with, the phrase "such as but not limited to".
It should also be noted that in the devices, apparatuses, and methods of the present application, the components or steps may be decomposed and/or recombined. These decompositions and/or recombinations are to be considered as equivalents of the present application.
The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the application. Thus, the present application is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, the description is not intended to limit embodiments of the application to the form disclosed herein. While a number of example aspects and embodiments have been discussed above, those of skill in the art will recognize certain variations, modifications, alterations, additions and sub-combinations thereof.

Claims (10)

1. A lens defect detection method based on a convolutional neural network is characterized by comprising the following steps:
acquiring a first monochromatic image of a lens to be detected under the irradiation of a first monochromatic light source and a second monochromatic image under the irradiation of a second monochromatic light source;
extracting a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image;
aggregating the first LBP local binary pattern map and the second LBP local binary pattern map along a channel dimension to obtain a multi-channel LBP local binary pattern map;
obtaining a detection feature map by the multi-channel LBP local binary pattern map through a trained convolutional neural network model using a CBAM attention block; and
and obtaining a classification result by the trained classifier of the detection characteristic diagram, wherein the classification result is used for indicating whether the lens to be detected has defects or not.
2. The convolutional neural network-based lens defect detection method of claim 1, wherein said extracting a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image comprises:
converting the first monochromatic image and the second monochromatic image into grayscale images respectively to obtain a first grayscale image and a second grayscale image;
determining an LBP value of each pixel in the first gray-scale image based on the pixel value distribution of the neighborhood pixels of each pixel in the first gray-scale image to obtain a first LBP local binary pattern map; and
and determining LBP values of all pixels in the second gray scale image based on the pixel value distribution of the neighborhood pixels of all pixels in the second gray scale image to obtain a second LBP local binary pattern map.
3. The convolutional neural network-based lens defect detection method as claimed in claim 2, wherein said training the multi-channel LBP local binary pattern map by using a convolutional neural network model of CBAM attention block to obtain a detection feature map comprises:
inputting the multichannel LBP local binary pattern graph into a convolution coding part of the convolution neural network model to obtain a convolution coding feature graph;
inputting the convolutional encoding feature map into a channel attention unit of a CBAM attention block of the convolutional neural network model to obtain a channel enhanced convolutional encoding feature map; and
and inputting the channel enhancement convolution coding feature map into a spatial attention unit of a CBAM (convolutional code amplitude modulation) attention block of the convolutional neural network model to obtain the detection feature map.
4. The convolutional neural network based lens defect detection method of claim 3, wherein said inputting the multi-channel LBP local binary pattern map into a convolutional encoding part of the convolutional neural network model to obtain a convolutional encoding feature map comprises: and performing convolution processing, pooling processing and nonlinear activation processing on input data in layer forward pass by using each layer of the convolution coding part to obtain the convolution coding feature map, wherein the input of the first layer of the convolution coding part is the multi-channel LBP local binary pattern map.
5. The convolutional neural network-based lens defect detection method of claim 4, wherein the inputting the convolutional encoding feature map into a channel attention unit of a CBAM attention block of the convolutional neural network model to obtain a channel enhanced convolutional encoding feature map comprises:
calculating the global mean value of each feature matrix of the convolutional encoding feature map along the channel dimension to obtain a channel feature vector;
inputting the channel feature vector into a Softmax activation function to obtain a channel attention weighting vector; and
and respectively weighting each feature matrix of the convolution coding feature map along the channel dimension by taking the feature value of each position in the channel attention weighting vector as a weight so as to obtain the channel enhanced convolution coding feature map.
6. The convolutional neural network-based lens defect detection method of claim 5, wherein the inputting the channel enhanced convolutional encoding feature map into a spatial attention unit of a CBAM attention block of the convolutional neural network model to obtain the detection feature map comprises:
inputting the channel enhanced convolutional coding feature map into a spatial attention unit of a CBAM attention block of the convolutional neural network model to obtain a spatial attention map;
the space attention diagram is activated through a Softmax activation function to obtain a space attention feature diagram; and
and calculating the spatial attention feature map and the channel enhanced convolutional coding feature map, and multiplying the spatial attention feature map and the channel enhanced convolutional coding feature map according to position points to obtain the detection feature map.
7. The convolutional neural network-based lens defect detection method as claimed in claim 6, wherein the passing the detection feature map through a trained classifier to obtain a classification result comprises:
processing the detection feature map by using the classifier according to the following formula to obtain the classification result, wherein the formula is as follows:
Figure DEST_PATH_IMAGE002
wherein, in the process,
Figure DEST_PATH_IMAGE004
to
Figure DEST_PATH_IMAGE006
In order to be a weight matrix, the weight matrix,
Figure DEST_PATH_IMAGE008
to
Figure DEST_PATH_IMAGE010
In order to be a vector of the offset,
Figure DEST_PATH_IMAGE012
and projecting the detection feature map into a vector.
8. The convolutional neural network-based lens defect detection method of claim 7, further comprising the steps of: training the convolutional neural network model using the CBAM attention block and the classifier;
wherein training the convolutional neural network model using the CBAM attention block and the classifier comprises:
acquiring training data, wherein the training data comprises a first training monochromatic image of a test lens under the irradiation of the first monochromatic light source, a second training monochromatic image of the test lens under the irradiation of the second monochromatic light source and a real value of whether the test lens has defects or not;
extracting a first training LBP local binary pattern map of the first training monochrome image and a second training LBP local binary pattern map of the second training monochrome image;
aggregating the first training LBP local binary pattern graph and the second training LBP local binary pattern graph along a channel dimension to obtain a multi-channel training LBP local binary pattern graph;
passing the multichannel training LBP local binary pattern map through the convolutional neural network model using the CBAM attention block to obtain a training detection feature map and a training channel attention weighting vector;
enabling the detection characteristic graph to pass through the classifier to obtain a classification loss function value;
calculating a local scene metric loss function value of a context statistic of the training channel attention weighting vector, the local scene metric loss function value of the context statistic being related to a mean and a variance of a set of eigenvalues for all positions of the training channel attention weighting vector; and
training the convolutional neural network model using CBAM attention blocks and the classifier with a weighted sum of the classification loss function values and the context-statistical local scene metric loss function values as a loss function value.
9. The convolutional neural network-based lens defect detection method of claim 8, wherein said computing a local scene metric loss function value for context statistics of the training channel attention weighting vector comprises:
calculating a local scene metric loss function value of context statistics of the training channel attention weighting vector with the following formula;
wherein the formula is:
Figure DEST_PATH_IMAGE014
wherein,
Figure DEST_PATH_IMAGE016
a feature value representing each position of the training channel attention weight vector,
Figure DEST_PATH_IMAGE018
and
Figure DEST_PATH_IMAGE020
means and variances representing sets of eigenvalues for respective positions in the training channel attention weighting vector respectively,
Figure DEST_PATH_IMAGE022
is the length of the training channel attention weight vector,
Figure DEST_PATH_IMAGE024
an exponential operation representing a numerical value representing a calculation of a natural exponential function value raised to the numerical value.
10. A convolutional neural network based lens defect detection system, comprising:
the image acquisition module is used for acquiring a first monochromatic image of the lens to be detected under the irradiation of the first monochromatic light source and a second monochromatic image under the irradiation of the second monochromatic light source;
a local binary pattern map extraction module for extracting a first LBP local binary pattern map of the first monochrome image and a second LBP local binary pattern map of the second monochrome image;
an aggregation module, configured to aggregate the first LBP local binary pattern map and the second LBP local binary pattern map along a channel dimension to obtain a multi-channel LBP local binary pattern map;
the coding module is used for obtaining a detection feature map by training the multichannel LBP local binary pattern map through a convolutional neural network model which uses a CBAM attention block; and
and the classification result generation module is used for obtaining a classification result by the trained classifier of the detection characteristic diagram, and the classification result is used for indicating whether the lens to be detected has defects or not.
CN202211231659.9A 2022-10-10 2022-10-10 Lens defect detection method and system based on convolutional neural network Active CN115496740B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211231659.9A CN115496740B (en) 2022-10-10 2022-10-10 Lens defect detection method and system based on convolutional neural network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211231659.9A CN115496740B (en) 2022-10-10 2022-10-10 Lens defect detection method and system based on convolutional neural network

Publications (2)

Publication Number Publication Date
CN115496740A true CN115496740A (en) 2022-12-20
CN115496740B CN115496740B (en) 2023-05-16

Family

ID=84475224

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211231659.9A Active CN115496740B (en) 2022-10-10 2022-10-10 Lens defect detection method and system based on convolutional neural network

Country Status (1)

Country Link
CN (1) CN115496740B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115737102A (en) * 2023-01-10 2023-03-07 杭州糖吉医疗科技有限公司 Laser cutting assembly type gastric bypass stent and preparation method thereof
CN115937792A (en) * 2023-01-10 2023-04-07 浙江非线数联科技股份有限公司 Intelligent community operation management system based on block chain
CN116051506A (en) * 2023-01-28 2023-05-02 东莞市言科新能源有限公司 Intelligent production system and method for polymer lithium ion battery
CN116259012A (en) * 2023-05-16 2023-06-13 新疆克拉玛依市荣昌有限责任公司 Monitoring system and method for embedded supercharged diesel tank
CN116523905A (en) * 2023-06-27 2023-08-01 广东华辉煌光电科技有限公司 Defect detection method and system for lamp beads
CN116797533A (en) * 2023-03-24 2023-09-22 东莞市冠锦电子科技有限公司 Appearance defect detection method and system for power adapter

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015194348A (en) * 2014-03-31 2015-11-05 大日本印刷株式会社 Inspection system and inspection method
CN112270666A (en) * 2020-11-03 2021-01-26 辽宁工程技术大学 Non-small cell lung cancer pathological section identification method based on deep convolutional neural network
CN112380948A (en) * 2020-11-09 2021-02-19 济南骏驰企业管理咨询有限公司 Training method and system for object re-recognition neural network and electronic equipment
CN112767330A (en) * 2021-01-08 2021-05-07 南通欧皇网络科技有限公司 Spraying quality detection method for pipeline inner wall based on monochrome image characteristic weighting
CN113362320A (en) * 2021-07-07 2021-09-07 北京工业大学 Wafer surface defect mode detection method based on deep attention network
CN113393438A (en) * 2021-06-15 2021-09-14 哈尔滨理工大学 Resin lens defect detection method based on convolutional neural network
CN114627090A (en) * 2022-03-22 2022-06-14 重庆大学 Convolutional neural network optical lens defect detection method based on attention mechanism
CN114757904A (en) * 2022-04-07 2022-07-15 河南大学 Surface defect detection method based on AI deep learning algorithm

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015194348A (en) * 2014-03-31 2015-11-05 大日本印刷株式会社 Inspection system and inspection method
CN112270666A (en) * 2020-11-03 2021-01-26 辽宁工程技术大学 Non-small cell lung cancer pathological section identification method based on deep convolutional neural network
CN112380948A (en) * 2020-11-09 2021-02-19 济南骏驰企业管理咨询有限公司 Training method and system for object re-recognition neural network and electronic equipment
CN112767330A (en) * 2021-01-08 2021-05-07 南通欧皇网络科技有限公司 Spraying quality detection method for pipeline inner wall based on monochrome image characteristic weighting
CN113393438A (en) * 2021-06-15 2021-09-14 哈尔滨理工大学 Resin lens defect detection method based on convolutional neural network
CN113362320A (en) * 2021-07-07 2021-09-07 北京工业大学 Wafer surface defect mode detection method based on deep attention network
CN114627090A (en) * 2022-03-22 2022-06-14 重庆大学 Convolutional neural network optical lens defect detection method based on attention mechanism
CN114757904A (en) * 2022-04-07 2022-07-15 河南大学 Surface defect detection method based on AI deep learning algorithm

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
LING MA 等: "A real-time detection network for surface defects of mobile phone lens" *
SANGHYUN WOO等: "CBAM: Convolutional Block Attention Module" *
文彩虹: "基于机器学习的镜片疵病检测与识别" *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115737102A (en) * 2023-01-10 2023-03-07 杭州糖吉医疗科技有限公司 Laser cutting assembly type gastric bypass stent and preparation method thereof
CN115937792A (en) * 2023-01-10 2023-04-07 浙江非线数联科技股份有限公司 Intelligent community operation management system based on block chain
CN115937792B (en) * 2023-01-10 2023-09-12 浙江非线数联科技股份有限公司 Intelligent community operation management system based on block chain
CN116051506A (en) * 2023-01-28 2023-05-02 东莞市言科新能源有限公司 Intelligent production system and method for polymer lithium ion battery
CN116797533A (en) * 2023-03-24 2023-09-22 东莞市冠锦电子科技有限公司 Appearance defect detection method and system for power adapter
CN116797533B (en) * 2023-03-24 2024-01-23 东莞市冠锦电子科技有限公司 Appearance defect detection method and system for power adapter
CN116259012A (en) * 2023-05-16 2023-06-13 新疆克拉玛依市荣昌有限责任公司 Monitoring system and method for embedded supercharged diesel tank
CN116523905A (en) * 2023-06-27 2023-08-01 广东华辉煌光电科技有限公司 Defect detection method and system for lamp beads
CN116523905B (en) * 2023-06-27 2023-10-20 广东华辉煌光电科技有限公司 Defect detection method and system for lamp beads

Also Published As

Publication number Publication date
CN115496740B (en) 2023-05-16

Similar Documents

Publication Publication Date Title
CN115496740B (en) Lens defect detection method and system based on convolutional neural network
CN112733950A (en) Power equipment fault diagnosis method based on combination of image fusion and target detection
CN113628261B (en) Infrared and visible light image registration method in electric power inspection scene
CN111931857B (en) MSCFF-based low-illumination target detection method
CN114241340A (en) Image target detection method and system based on double-path depth residual error network
CN112534243A (en) Inspection apparatus and method
CN109859166A (en) It is a kind of based on multiple row convolutional neural networks without ginseng 3D rendering method for evaluating quality
CN108647696B (en) Picture color value determining method and device, electronic equipment and storage medium
CN113781510A (en) Edge detection method and device and electronic equipment
WO2024021461A1 (en) Defect detection method and apparatus, device, and storage medium
CN113705361A (en) Method and device for detecting model in living body and electronic equipment
WO2018039667A1 (en) Process to isolate object of interest in image
CN116543433A (en) Mask wearing detection method and device based on improved YOLOv7 model
CN114708434A (en) Cross-domain remote sensing image semantic segmentation method based on adaptation and self-training in iterative domain
CN117593193A (en) Sheet metal image enhancement method and system based on machine learning
CN116485802B (en) Insulator flashover defect detection method, device, equipment and storage medium
CN112270404A (en) Detection structure and method for bulge defect of fastener product based on ResNet64 network
CN114820395A (en) Underwater image enhancement method based on multi-field information fusion
JP2023519527A (en) Generating segmentation masks based on autoencoders in alpha channel
Li et al. Context convolution dehazing network with channel attention
CN113076819A (en) Fruit identification method and device under homochromatic background and fruit picking robot
CN117557775B (en) Substation power equipment detection method and system based on infrared and visible light fusion
Mo et al. Contrastive adaptive frequency decomposition network guided by haze discrimination for real-world image dehazing
CN116071268B (en) Image illumination removal model based on contrast learning and training method thereof
CN117078608B (en) Double-mask guide-based high-reflection leather surface defect detection method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant