CN113012157B - Visual detection method and system for equipment defects - Google Patents

Visual detection method and system for equipment defects Download PDF

Info

Publication number
CN113012157B
CN113012157B CN202110563508.2A CN202110563508A CN113012157B CN 113012157 B CN113012157 B CN 113012157B CN 202110563508 A CN202110563508 A CN 202110563508A CN 113012157 B CN113012157 B CN 113012157B
Authority
CN
China
Prior art keywords
picture
average gray
equipment
gray value
value
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.)
Active
Application number
CN202110563508.2A
Other languages
Chinese (zh)
Other versions
CN113012157A (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.)
Shenzhen Feifen Data Technology Co ltd
Original Assignee
Shenzhen Feifen Data Technology 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 Shenzhen Feifen Data Technology Co ltd filed Critical Shenzhen Feifen Data Technology Co ltd
Priority to CN202110563508.2A priority Critical patent/CN113012157B/en
Publication of CN113012157A publication Critical patent/CN113012157A/en
Application granted granted Critical
Publication of CN113012157B publication Critical patent/CN113012157B/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20021Dividing image into blocks, subimages or windows

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Data Mining & Analysis (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The invention provides a visual detection method and a system for equipment defects, which are characterized in that a standard picture model is established and a standard characteristic matrix is obtained, each picture of the picture model of the equipment to be detected is processed to obtain a detection characteristic matrix, a picture processing algorithm is optimized, the sizes of the pictures of all layers are selected and convolved in a step-by-step decreasing mode, the picture is divided into nine squares by adopting a mean filtering and median filtering combined algorithm based on the nine squares, the mean filtering method is adopted for a central picture to calculate the average gray level of pixels around each pixel point in the central picture, and the median filtering algorithm is adopted for other pictures, so that the accuracy of the equipment defect detection is improved.

Description

Visual detection method and system for equipment defects
Technical Field
The invention relates to the technical field of picture processing, in particular to a visual detection method, a visual detection system and a storage medium for equipment defects.
Background
With the development of artificial intelligence and computer vision technology, machine vision technology is applied more and more in industrial scenes, and occupies a higher and higher position. For example, machine vision technology is applied to quality control links in industrial production processes, and a mode of detecting article picture defects through picture recognition and picture detection is developed.
At present, for a mode of detecting defects of an article picture, an interested area characteristic that defects may exist in a picture of a target to be detected is firstly determined, and then defect information in the interested area characteristic is further determined.
Disclosure of Invention
Based on the problems, the invention provides a visual detection method, a system and a storage medium for equipment defects, which adopt a combined algorithm of mean filtering and median filtering based on nine squares to segment a picture into nine squares, adopt the mean filtering method for a central picture to calculate the average gray level of pixels around each pixel point in the central picture, adopt the median filtering algorithm for other 8 pictures of the nine squares, and utilize the combination of the advantages of the mean filtering algorithm and the median filtering algorithm to process the pictures, thereby improving the detection accuracy.
The equipment defect visual detection method comprises the following steps:
step 101, establishing a standard picture model, performing convolution processing on each picture in the standard picture model, extracting a characteristic value of each convolution layer, and recording the characteristic value into a standard characteristic matrix;
102, conveying equipment to be detected to a detection area, acquiring N directional pictures of the equipment, and establishing a picture model of the equipment to be detected, wherein N is more than or equal to 6;
103, processing each picture of a picture model of the equipment to be detected to obtain a noise reduction picture model, performing convolution on the noise reduction picture model, extracting a characteristic value of each convolution layer and recording the characteristic value into a detection characteristic matrix;
and 104, comparing the standard feature matrix with the detection feature matrix by adopting an edit distance similarity algorithm, and judging that the equipment is qualified if the similarity exceeds a preset threshold value.
Further, the establishing of the standard picture model specifically includes: the standard equipment to be detected is placed in an equipment collecting area, the standard equipment to be detected is equipment for detecting whether the equipment accords with an acceptance standard, a plurality of directional pictures of the equipment are respectively collected by a plurality of groups of high-definition cameras, and the collected directional pictures are standard pictures which are observed in head in the front or overlooked in the front.
Further, the processing each picture of the picture model of the device to be inspected to obtain a processed picture specifically includes: carrying out noise reduction on each picture of a picture model of equipment to be detected, dividing each picture into nine regions to be respectively processed, calculating the average gray scale of pixels around each pixel point in the central picture by adopting a mean filtering algorithm, assigning the average gray scale to the current pixel point, and traversing all the pixel points of the central picture in a circulating traversal mode; and sorting the pixel gray values of other pictures in the nine areas by adopting a median filtering algorithm, assigning the median gray values to the current pixel points, traversing all the pixel points of other pictures in a circulating traversal mode, and outputting a noise reduction picture model of the equipment to be detected after noise reduction treatment.
Further, the convolving the processed picture, extracting a feature value of each convolution layer and recording the feature value into a detection feature matrix specifically includes:
performing convolution processing on each picture in the noise reduction picture model, extracting a characteristic value of each convolution layer, and recording the characteristic value into a characteristic matrix;
the first layer to the fourth layer of the convolution layer are pyramid-shaped, the output of the first layer is 256, each picture of the noise-reduction picture model is subjected to convolution processing, a first average gray value of pixels around a central pixel is calculated, if the first average gray value is larger than a first preset threshold value, the first average gray value is marked as 1, otherwise, the first average gray value is marked as 0, and the first average gray value is assigned to a detection feature matrix; the output of the second layer is 128, convolution processing is carried out on each picture of the noise reduction picture model, a second average gray value of pixels around the central pixel is calculated, if the second average gray value is larger than a second preset threshold value, the second average gray value is marked as 1, otherwise, the second average gray value is marked as 0, and the second average gray value is assigned to the detection feature matrix; the output of the third layer is 64, convolution processing is carried out on each picture of the noise reduction picture model, the third average gray value of pixels around the central pixel is calculated, if the third average gray value is larger than a third preset threshold value, the third average gray value is marked as 1, otherwise, the third average gray value is marked as 0, and the third average gray value is assigned to the detection feature matrix; and the output of the fourth layer is 32, each picture of the noise-reduced picture model is subjected to convolution processing, a fourth average gray value of pixels around the central pixel is calculated, if the fourth average gray value is larger than a fourth preset threshold value, the fourth average gray value is marked as 1, otherwise, the fourth average gray value is marked as 0, and the fourth average gray value is assigned to the detection feature matrix.
In addition, the invention also provides an equipment defect visual detection system, which comprises:
a standard comparison module 201, configured to establish a standard image model, perform convolution processing on each image in the standard image model, extract a feature value of each convolution layer, and add the feature value into a standard feature matrix;
the modeling module 202 is used for transmitting the equipment to be detected to a detection area, acquiring N directional pictures of the equipment and establishing a picture model of the equipment to be detected, wherein N is more than or equal to 6;
the detection module 203 is used for processing each picture of the picture model of the device to be detected to obtain a noise reduction picture model, performing convolution on the noise reduction picture model, extracting a characteristic value of each convolution layer and recording the characteristic value into a detection characteristic matrix;
and the comparison module 204 is configured to compare the standard feature matrix with the detection feature matrix by using an edit distance similarity algorithm, and determine that the device is qualified if the similarity exceeds a preset threshold.
Further, the establishing of the standard picture model specifically includes: the standard equipment to be detected is placed in an equipment collecting area, the standard equipment to be detected is equipment for detecting whether the equipment accords with an acceptance standard, a plurality of directional pictures of the equipment are respectively collected by a plurality of groups of high-definition cameras, and the collected directional pictures are standard pictures which are observed in head in the front or overlooked in the front.
Further, the processing each picture of the picture model of the device to be inspected to obtain a processed picture specifically includes: carrying out noise reduction on each picture of a picture model of equipment to be detected, dividing each picture into nine regions to be respectively processed, calculating the average gray scale of pixels around each pixel point in the central picture by adopting a mean filtering algorithm, assigning the average gray scale to the current pixel point, and traversing all the pixel points of the central picture in a circulating traversal mode; and sorting the pixel gray values of other pictures in the nine areas by adopting a median filtering algorithm, assigning the median gray values to the current pixel points, traversing all the pixel points of other pictures in a circulating traversal mode, and outputting a noise reduction picture model of the equipment to be detected after noise reduction treatment.
Further, the convolving the processed picture, extracting a feature value of each convolution layer and recording the feature value into a detection feature matrix specifically includes:
performing convolution processing on each picture in the noise reduction picture model, extracting a characteristic value of each convolution layer, and recording the characteristic value into a characteristic matrix;
the first layer to the fourth layer of the convolution layer are pyramid-shaped, the output of the first layer is 256, each picture of the noise-reduction picture model is subjected to convolution processing, a first average gray value of pixels around a central pixel is calculated, if the first average gray value is larger than a first preset threshold value, the first average gray value is marked as 1, otherwise, the first average gray value is marked as 0, and the first average gray value is assigned to a detection feature matrix; the output of the second layer is 128, convolution processing is carried out on each picture of the noise reduction picture model, a second average gray value of pixels around the central pixel is calculated, if the second average gray value is larger than a second preset threshold value, the second average gray value is marked as 1, otherwise, the second average gray value is marked as 0, and the second average gray value is assigned to the detection feature matrix; the output of the third layer is 64, convolution processing is carried out on each picture of the noise reduction picture model, the third average gray value of pixels around the central pixel is calculated, if the third average gray value is larger than a third preset threshold value, the third average gray value is marked as 1, otherwise, the third average gray value is marked as 0, and the third average gray value is assigned to the detection feature matrix; and the output of the fourth layer is 32, each picture of the noise-reduced picture model is subjected to convolution processing, a fourth average gray value of pixels around the central pixel is calculated, if the fourth average gray value is larger than a fourth preset threshold value, the fourth average gray value is marked as 1, otherwise, the fourth average gray value is marked as 0, and the fourth average gray value is assigned to the detection feature matrix.
In addition, the invention also provides a computer readable storage medium for storing a computer program, wherein the computer program executes the device defect visual detection method.
In addition, the invention also provides electronic equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; a memory for storing a computer program; and the processor is used for realizing the equipment defect visual detection method when executing the program stored in the memory.
The invention provides a visual detection method and a system for equipment defects, which are characterized in that a standard picture model is established and a standard characteristic matrix is obtained, each picture of the picture model of the equipment to be detected is processed to obtain a detection characteristic matrix, a picture processing algorithm is optimized, the sizes of the pictures of all layers are selected and convolved in a step-by-step decreasing mode, the picture is divided into nine squares by adopting a mean filtering and median filtering combined algorithm based on the nine squares, the mean filtering method is adopted for a central picture to calculate the average gray level of pixels around each pixel point in the central picture, and the median filtering algorithm is adopted for other pictures, so that the accuracy of the equipment defect detection is improved.
Drawings
In order to more clearly illustrate the embodiments or technical solutions of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
FIG. 1 is a flow chart of a method for visually inspecting defects in an apparatus according to the present application;
FIG. 2 is a block diagram of a system for visual inspection of defects in an apparatus according to the present application;
FIG. 3 is a schematic diagram of the convolution algorithm of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it should be noted that the terms "first", "second", and the like are used only for distinguishing the description, and are not intended to indicate or imply relative importance.
In order to improve the accuracy of equipment defect detection, the invention provides an equipment defect visual detection method based on a Sudoku mean value filtering and median value filtering combined algorithm, which can improve the accuracy of equipment defect detection.
Specifically, a visual inspection method for equipment defects, as shown in fig. 1, includes:
step 101, establishing a standard picture model, performing convolution processing on each picture in the standard picture model, extracting a characteristic value of each convolution layer, and recording the characteristic value into a standard characteristic matrix;
the standard equipment to be detected is placed in an equipment acquisition area, the standard equipment to be detected is equipment for detecting and conforming to an acceptance standard, a plurality of groups of high-definition cameras are used for respectively acquiring a plurality of directional pictures of the equipment, the acquired pictures in the plurality of directions are standard pictures which are viewed from head in front or viewed from the top, wherein the optimal number of the groups of the high-definition cameras is 6, and a group of equipment standard picture model B is formedi jI represents the camera orientation, values 1 to 6, and j represents the device model.
Standard picture model B for equipmenti jPer picture, pair Pi jPerforming convolution processing on each picture, extracting characteristic value of each convolution layer, and adding the characteristic value into a standard matrix TPi j(g, u), g represents a convolutional layer, u represents the number of convolutions, and g is 4 in the most preferable case.
102, conveying the equipment to be detected to a detection area, acquiring N directional pictures of the equipment, and establishing a picture model of the equipment to be detected;
the equipment to be detected is conveyed to the detection area, 6 direction pictures of the equipment are respectively collected by 6 groups of high-definition cameras, and a group of picture models C of the equipment to be detected is formedi jAnd i represents the camera orientation and takes values from 1 to 6. j denotes the device model. The 6 directions are front, back, left and right pitch directions, and the 6 directions are provided in the embodiment of the present invention, but the technical solution of the present invention is not limited to the 6 directions, and may additionally include a perspective view, a side view, and the like.
103, processing each picture of a picture model of the equipment to be detected to obtain a noise reduction picture model, performing convolution on the noise reduction picture model, extracting a characteristic value of each convolution layer and recording the characteristic value into a detection characteristic matrix;
each picture of the picture model of the device to be detected is subjected to noise reduction treatmentThe image processing method comprises the steps of adopting a mean filtering and median filtering combined algorithm based on the nine-square grid, dividing the image into nine areas for processing respectively, enabling the mean filtering to be capable of blurring the image, enabling the median filtering to be capable of well filtering salt and pepper noise, and enabling the picture to be optimized to the greatest extent through the combination of the mean filtering and the median filtering. Firstly, carrying out noise reduction processing on a picture, dividing the picture into nine-grid squares, calculating the average gray scale of pixels around each pixel point in the central picture by adopting a mean value filtering algorithm on the central picture of the nine-grid squares, assigning the average gray scale to the pixel point of the point, and assigning the average gray scale to the pixel point of the point
Figure 624279DEST_PATH_IMAGE001
Taking x and y as pixel coordinates and r as a radius, taking the value of r as 2 as an example, selecting a current pixel (x and y), calculating the average gray value (marked as a first gray value) of 24 pixels around the pixel, assigning the average gray value to the current pixel (x and y), and traversing all pixels of the central picture in a circular traversal mode. For the other 8 images of the nine-square grid, a median filtering algorithm is adopted, for example, the current pixel point (x ', y') of the first image is taken as the radius with r =1, the gray values of 8 pixel points around the current pixel point (x ', y') are obtained, the gray values of the pixels are sorted, the median gray value (marked as a second gray value) is taken and assigned to the current pixel point (x ', y'), and all the pixel points of the other images are traversed in a circular traversal mode. Picture model C of equipment to be inspectedi jThe output is Z after noise reduction treatmenti j
To Zi jPerforming convolution processing on each picture, extracting characteristic value of each convolution layer, and recording the characteristic value into a matrix TZi j(g, u), g represents convolutional layer, u represents convolution number, and g is 4 in the same optimal case, and the schematic diagram of the convolution algorithm is shown in fig. 3, and includes: image 301, convolution layer 302, 3 x 3 convolution kernel 303, feature matrix 304.
Convolutional layers g1 through g4 are pyramidal in shape, g1 has an output of 256, and the picture size is 256 × 256 pixels. To Zi jEach picture of (2) is convoluted with a convolution kernel of 3 x 3, each time for the convolution kernelRecording the central pixel in convolution as S, calculating the average gray level of the pixels around the central pixel, establishing a mark value h of the gray level, if the average gray level is more than 150, h is 1, otherwise h is 0, and assigning h to the detection feature matrix TZi j (g,u)。
The output of g2 is 256, and the picture size is 128 x 128 pixels. To Zi jPerforming convolution processing on each picture, wherein the convolution kernel is 3 x 3, the central pixel in each convolution of the convolution kernel is marked as S, the average gray level of the pixels around the central pixel is calculated, a mark value h of the gray level is set, if the average gray level is more than 150, h is 1, otherwise, h is 0, and h is assigned to the detection feature matrix TZi j (g,u)。
The output of g3 is 256, and the picture size is 64 x 64 pixels. To Zi jPerforming convolution processing on each picture, wherein the convolution kernel is 3 x 3, the central pixel in each convolution of the convolution kernel is marked as S, the average gray level of the pixels around the central pixel is calculated, a mark value h of the gray level is set, if the average gray level is more than 150, h is 1, otherwise, h is 0, and h is assigned to the detection feature matrix TZi j (g,u)。
The output of g4 is 256, and the picture size is 32 x 32 pixels. To Zi jPerforming convolution processing on each picture, wherein the convolution kernel is 3 x 3, the central pixel in each convolution of the convolution kernel is marked as S, the average gray level of the pixels around the central pixel is calculated, a mark value h of the gray level is set, if the average gray level is more than 150, h is 1, otherwise, h is 0, and h is assigned to the detection feature matrix TZi j (g,u)。
In the step, a mean filtering and median filtering combined algorithm based on the nine-square lattices is adopted to divide the picture into the nine-square lattices, a mean filtering method is adopted for the central picture to calculate the mean gray level of pixels around each pixel point in the central picture, the mean gray level is assigned to the pixel value of the point, for other 8 pictures of the nine-square lattices, a median filtering algorithm is adopted, the advantages of the mean filtering algorithm and the median filtering algorithm are combined to process the picture, and the detection accuracy is improved. In addition, when convolution operation is carried out, the sizes of all layers are selected differently, convolution is carried out in a gradual and gradual reduction mode, a convolution algorithm is optimized, detection of the picture of the device to be detected can be optimized, and the method and the device are beneficial to improving the accuracy of detection on the whole.
And 104, comparing the standard feature matrix with the detection feature matrix by adopting an edit distance similarity algorithm, and judging that the equipment is qualified if the similarity exceeds a preset threshold value.
Comparing the TZ by adopting the existing edit distance similarity algorithmi j(g, u) and TPi j(g, u), the similarity exceeds 90% or other preset thresholds, the thresholds can be set according to different devices, and then the detection is passed, otherwise, the detection is not passed.
Polling is carried out on i, j and g, for the picture of the jth type equipment, the ith direction and the gth convolution layer, u represents the convolution times, TZi jThe maximum value of u in (g, u) is lu1, TPi jIn (g, u), the maximum value of u was lu2, len was lu1 and lu2, and editf (lu 1, lu 2) was set as the edit number counter. For TZi j(g, u), u from 1 to lu1, for each value of u, comparing TZi j(g, u) and TPi j(g, u), if different, editf (lu 1, lu 2) = editf (lu 1, lu 2) +1, similarity XSD =1-editf (lu 1, lu 2)/len, XSD is more than 99%, passing the detection, otherwise reminding not passing the detection.
Additionally, the present invention also provides an apparatus defect visual inspection system, as shown in fig. 2, including:
and the standard comparison module 201 is configured to establish a standard image model, perform convolution processing on each image in the standard image model, extract a feature value of each convolution layer, and add the feature value into a standard feature matrix.
The standard equipment to be detected is placed in an equipment acquisition area, the standard equipment to be detected is equipment for detecting and conforming to an acceptance standard, a plurality of groups of high-definition cameras are used for respectively acquiring a plurality of directional pictures of the equipment, the acquired pictures in the plurality of directions are standard pictures which are viewed from head in front or viewed from the top, wherein the optimal number of the groups of the high-definition cameras is 6, and a group of equipment standard picture model B is formedi jI represents the camera orientation, values 1 to 6, and j represents the device model.
Standard picture model B for equipmenti jPer picture, pair Pi jPerforming convolution processing on each picture, extracting characteristic value of each convolution layer, and adding the characteristic value into a standard matrix TPi j(g, u), g represents a convolutional layer, u represents the number of convolutions, and g is 4 in the most preferable case.
The modeling module 202 is used for transmitting the equipment to be detected to the detection area, acquiring N directional pictures of the equipment and establishing a picture model of the equipment to be detected;
the equipment to be detected is conveyed to the detection area, 6 direction pictures of the equipment are respectively collected by 6 groups of high-definition cameras, and a group of picture models C of the equipment to be detected is formedi jAnd i represents the camera orientation and takes values from 1 to 6. j denotes the device model. The 6 directions are front, back, left and right pitch directions, and the 6 directions are provided in the embodiment of the present invention, but the technical solution of the present invention is not limited to the 6 directions, and may additionally include a perspective view, a side view, and the like.
The detection module 203 is used for processing each picture of the picture model of the device to be detected to obtain a noise reduction picture model, performing convolution on the noise reduction picture model, extracting a characteristic value of each convolution layer and recording the characteristic value into a detection characteristic matrix;
every picture of a picture model of the equipment to be detected is subjected to noise reduction treatment, a combined algorithm of mean filtering and median filtering based on Sudoku is adopted, the Sudoku is used for dividing the picture into nine regions to be respectively treated, the mean filtering can fuzzify the image, the median filtering can well filter salt and pepper noise, and the picture can be optimized to the greatest extent by combining the mean filtering and the median filtering. Firstly, carrying out noise reduction processing on a picture, dividing the picture into nine-grid squares, calculating the average gray scale of pixels around each pixel point in the central picture by adopting a mean value filtering algorithm on the central picture of the nine-grid squares, assigning the average gray scale to the pixel point of the point, and assigning the average gray scale to the pixel point of the point
Figure 728370DEST_PATH_IMAGE002
X and y are pixel pointsAnd marking r as a radius, taking the value of r as 2 as an example, selecting a current pixel (x, y), calculating the average gray value (marked as a first gray value) of 24 pixels around the pixel, assigning the average gray value to the current pixel (x, y), and traversing all pixels of the central picture in a circular traversal mode. For the other 8 images of the nine-square grid, a median filtering algorithm is adopted, for example, the current pixel point (x ', y') of the first image is taken as the radius with r =1, the gray values of 8 pixel points around the current pixel point (x ', y') are obtained, the gray values of the pixels are sorted, the median gray value (marked as a second gray value) is taken and assigned to the current pixel point (x ', y'), and all the pixel points of the other images are traversed in a circular traversal mode. Picture model C of equipment to be inspectedi jThe output is Z after noise reduction treatmenti j
To Zi jPerforming convolution processing on each picture, extracting characteristic value of each convolution layer, and recording the characteristic value into a matrix TZi j(g, u), g represents the convolutional layer, u represents the number of convolutions, and g is 4 in the same optimum case, and the schematic diagram of the convolution algorithm is shown in FIG. 3.
Convolutional layers g1 through g4 are pyramidal in shape, g1 has an output of 256, and the picture size is 256 × 256 pixels. To Zi jPerforming convolution processing on each picture, wherein the convolution kernel is 3 x 3, the central pixel in each convolution of the convolution kernel is marked as S, the average gray level of the pixels around the central pixel is calculated, a mark value h of the gray level is set, if the average gray level is more than 150, h is 1, otherwise, h is 0, and h is assigned to the detection feature matrix TZi j (g,u)。
The output of g2 is 256, and the picture size is 128 x 128 pixels. To Zi jPerforming convolution processing on each picture, wherein the convolution kernel is 3 x 3, the central pixel in each convolution of the convolution kernel is marked as S, the average gray level of the pixels around the central pixel is calculated, a mark value h of the gray level is set, if the average gray level is more than 150, h is 1, otherwise, h is 0, and h is assigned to the detection feature matrix TZi j (g,u)。
The output of g3 is 256, and the picture size is 64 x 64 pixels. To Zi jPerforming convolution processing on each picture, wherein the convolution kernel is 3 x 3, the central pixel in each convolution of the convolution kernel is marked as S, the average gray level of the pixels around the central pixel is calculated, a mark value h of the gray level is set, if the average gray level is more than 150, h is 1, otherwise, h is 0, and h is assigned to the detection feature matrix TZi j (g,u)。
The output of g4 is 256, and the picture size is 32 x 32 pixels. To Zi jPerforming convolution processing on each picture, wherein the convolution kernel is 3 x 3, the central pixel in each convolution of the convolution kernel is marked as S, the average gray level of the pixels around the central pixel is calculated, a mark value h of the gray level is set, if the average gray level is more than 150, h is 1, otherwise, h is 0, and h is assigned to the detection feature matrix TZi j (g,u)。
In the step, a mean filtering and median filtering combined algorithm based on the nine-square lattices is adopted to divide the picture into the nine-square lattices, a mean filtering method is adopted for the central picture to calculate the mean gray level of pixels around each pixel point in the central picture, the mean gray level is assigned to the pixel value of the point, for other 8 pictures of the nine-square lattices, a median filtering algorithm is adopted, the advantages of the mean filtering algorithm and the median filtering algorithm are combined to process the picture, and the detection accuracy is improved. In addition, when convolution operation is carried out, the sizes of all layers are selected differently, convolution is carried out in a gradual and gradual reduction mode, a convolution algorithm is optimized, detection of the picture of the device to be detected can be optimized, and the method and the device are beneficial to improving the accuracy of detection on the whole.
And the comparison module 204 is configured to compare the standard feature matrix with the detection feature matrix by using an edit distance similarity algorithm, and determine that the device is qualified if the similarity exceeds a preset threshold.
Comparing the TZ by adopting the existing edit distance similarity algorithmi j(g, u) and TPi j(g, u), the similarity exceeds 90% or other preset thresholds, the thresholds can be set according to different devices, and then the detection is passed, otherwise, the detection is not passed.
Polling i, j, g, map of jth type device, ith direction, g convolutional layerPiece, u denotes the number of convolutions, TZi jThe maximum value of u in (g, u) is lu1, TPi jIn (g, u), the maximum value of u was lu2, len was lu1 and lu2, and editf (lu 1, lu 2) was set as the edit number counter. For TZi j(g, u), u from 1 to lu1, for each value of u, comparing TZi j(g, u) and TPi j(g, u), if different, editf (lu 1, lu 2) = editf (lu 1, lu 2) +1, similarity XSD =1-editf (lu 1, lu 2)/len, XSD is more than 99%, passing the detection, otherwise reminding not passing the detection.
In addition, the invention also provides a computer readable storage medium for storing a computer program, wherein the computer program executes the device defect visual detection method.
In addition, the invention also provides electronic equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; a memory for storing a computer program; the processor is used for realizing the method of the invention when executing the program stored in the memory.
The invention provides a visual detection method and a system for equipment defects, which are characterized in that a standard picture model is established and a standard characteristic matrix is obtained, each picture of the picture model of the equipment to be detected is processed to obtain a detection characteristic matrix, a picture processing algorithm is optimized, the sizes of the pictures of all layers are selected and convolved in a step-by-step decreasing mode, the picture is divided into nine squares by adopting a mean filtering and median filtering combined algorithm based on the nine squares, the mean filtering method is adopted for a central picture to calculate the average gray level of pixels around each pixel point in the central picture, and the median filtering algorithm is adopted for other pictures, so that the accuracy of the equipment defect detection is improved.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include elements inherent in the list. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element. In addition, parts of the above technical solutions provided in the embodiments of the present application, which are consistent with the implementation principles of corresponding technical solutions in the prior art, are not described in detail so as to avoid redundant description.
The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.

Claims (8)

1. A method for visual inspection of equipment defects, the method comprising:
step 101, establishing a standard picture model, performing convolution processing on each picture in the standard picture model, extracting a characteristic value of each convolution layer, and recording the characteristic value into a standard characteristic matrix;
102, conveying equipment to be detected to a detection area, acquiring N directional pictures of the equipment, and establishing a picture model of the equipment to be detected, wherein N is more than or equal to 6;
103, processing each picture of a picture model of the equipment to be detected to obtain a noise reduction picture model, performing convolution on the noise reduction picture model, extracting a characteristic value of each convolution layer and recording the characteristic value into a detection characteristic matrix;
the processing of each picture of the picture model of the device to be detected to obtain the noise reduction picture model specifically comprises: carrying out noise reduction on each picture of a picture model of equipment to be detected, dividing each picture into nine regions to be respectively processed, calculating the average gray scale of pixels around each pixel point in the central picture by adopting a mean filtering algorithm, assigning the average gray scale to the current pixel point, and traversing all the pixel points of the central picture in a circulating traversal mode; sorting the pixel gray values of other pictures in the nine areas by adopting a median filtering algorithm, assigning the median gray values to current pixel points, traversing all the pixel points of other pictures in a circulating traversal mode, and outputting a noise reduction picture model of the equipment to be detected after noise reduction treatment;
and 104, comparing the standard feature matrix with the detection feature matrix by adopting an edit distance similarity algorithm, and judging that the equipment is qualified if the similarity exceeds a preset threshold value.
2. The method according to claim 1, wherein the establishing a standard picture model specifically comprises: the standard equipment to be detected is placed in an equipment collecting area, the standard equipment to be detected is equipment for detecting whether the equipment accords with an acceptance standard, a plurality of directional pictures of the equipment are respectively collected by a plurality of groups of high-definition cameras, and the collected directional pictures are standard pictures which are observed in head in the front or overlooked in the front.
3. The method of claim 1, wherein convolving the noise-reduced picture model, extracting the feature values of each convolution layer and including the feature values in a detection feature matrix specifically comprises:
performing convolution processing on each picture in the noise reduction picture model, extracting a characteristic value of each convolution layer, and recording the characteristic value into a characteristic matrix;
the first layer to the fourth layer of the convolution layer are pyramid-shaped, the output of the first layer is 256, each picture of the noise-reduction picture model is subjected to convolution processing, a first average gray value of pixels around a central pixel is calculated, if the first average gray value is larger than a first preset threshold value, the first average gray value is marked as 1, otherwise, the first average gray value is marked as 0, and the first average gray value is assigned to a detection feature matrix; the output of the second layer is 128, convolution processing is carried out on each picture of the noise reduction picture model, a second average gray value of pixels around the central pixel is calculated, if the second average gray value is larger than a second preset threshold value, the second average gray value is marked as 1, otherwise, the second average gray value is marked as 0, and the second average gray value is assigned to the detection feature matrix; the output of the third layer is 64, convolution processing is carried out on each picture of the noise reduction picture model, the third average gray value of pixels around the central pixel is calculated, if the third average gray value is larger than a third preset threshold value, the third average gray value is marked as 1, otherwise, the third average gray value is marked as 0, and the third average gray value is assigned to the detection feature matrix; and the output of the fourth layer is 32, each picture of the noise-reduced picture model is subjected to convolution processing, a fourth average gray value of pixels around the central pixel is calculated, if the fourth average gray value is larger than a fourth preset threshold value, the fourth average gray value is marked as 1, otherwise, the fourth average gray value is marked as 0, and the fourth average gray value is assigned to the detection feature matrix.
4. A device defect visual inspection system, the system comprising: the system comprises a standard comparison module (201), a modeling module (202), a detection module (203) and a comparison module (204);
the standard comparison module (201) is used for establishing a standard picture model, performing convolution processing on each picture in the standard picture model, extracting a characteristic value of each convolution layer and recording the characteristic value into a standard characteristic matrix;
the modeling module (202) is used for transmitting the equipment to be detected to the detection area, acquiring N directional pictures of the equipment and establishing a picture model of the equipment to be detected, wherein N is more than or equal to 6;
the detection module (203) is used for processing each picture of the picture model of the equipment to be detected to obtain a noise reduction picture model, performing convolution on the noise reduction picture model, extracting the characteristic value of each convolution layer and recording the characteristic value into a detection characteristic matrix;
the processing of each picture of the picture model of the device to be detected to obtain the noise reduction picture model specifically comprises: carrying out noise reduction on each picture of a picture model of equipment to be detected, dividing each picture into nine regions to be respectively processed, calculating the average gray scale of pixels around each pixel point in the central picture by adopting a mean filtering algorithm, assigning the average gray scale to the current pixel point, and traversing all the pixel points of the central picture in a circulating traversal mode; sorting the pixel gray values of other pictures in the nine areas by adopting a median filtering algorithm, assigning the median gray values to current pixel points, traversing all the pixel points of other pictures in a circulating traversal mode, and outputting a noise reduction picture model of the equipment to be detected after noise reduction treatment;
and the comparison module (204) is used for comparing the standard characteristic matrix with the detection characteristic matrix by adopting an edit distance similarity algorithm, and if the similarity exceeds a preset threshold value, the equipment is judged to be qualified.
5. The system according to claim 4, wherein the establishing of the standard picture model specifically comprises: the standard equipment to be detected is placed in an equipment collecting area, the standard equipment to be detected is equipment for detecting whether the equipment accords with an acceptance standard, a plurality of directional pictures of the equipment are respectively collected by a plurality of groups of high-definition cameras, and the collected directional pictures are standard pictures which are observed in head in the front or overlooked in the front.
6. The system of claim 4, wherein convolving the noise-reduced picture model, extracting the feature values of each convolution layer and including in the detected feature matrix specifically comprises:
performing convolution processing on each picture in the noise reduction picture model, extracting a characteristic value of each convolution layer, and recording the characteristic value into a characteristic matrix;
the first layer to the fourth layer of the convolution layer are pyramid-shaped, the output of the first layer is 256, each picture of the noise-reduction picture model is subjected to convolution processing, a first average gray value of pixels around a central pixel is calculated, if the first average gray value is larger than a first preset threshold value, the first average gray value is marked as 1, otherwise, the first average gray value is marked as 0, and the first average gray value is assigned to a detection feature matrix; the output of the second layer is 128, convolution processing is carried out on each picture of the noise reduction picture model, a second average gray value of pixels around the central pixel is calculated, if the second average gray value is larger than a second preset threshold value, the second average gray value is marked as 1, otherwise, the second average gray value is marked as 0, and the second average gray value is assigned to the detection feature matrix; the output of the third layer is 64, convolution processing is carried out on each picture of the noise reduction picture model, the third average gray value of pixels around the central pixel is calculated, if the third average gray value is larger than a third preset threshold value, the third average gray value is marked as 1, otherwise, the third average gray value is marked as 0, and the third average gray value is assigned to the detection feature matrix; and the output of the fourth layer is 32, each picture of the noise-reduced picture model is subjected to convolution processing, a fourth average gray value of pixels around the central pixel is calculated, if the fourth average gray value is larger than a fourth preset threshold value, the fourth average gray value is marked as 1, otherwise, the fourth average gray value is marked as 0, and the fourth average gray value is assigned to the detection feature matrix.
7. A computer-readable storage medium, characterized in that the computer-readable storage medium is used to store a computer program, which executes the method of any of claims 1-3.
8. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; a memory for storing a computer program; a processor for implementing the method of any one of claims 1 to 3 when executing the computer program stored on the memory.
CN202110563508.2A 2021-05-24 2021-05-24 Visual detection method and system for equipment defects Active CN113012157B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110563508.2A CN113012157B (en) 2021-05-24 2021-05-24 Visual detection method and system for equipment defects

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110563508.2A CN113012157B (en) 2021-05-24 2021-05-24 Visual detection method and system for equipment defects

Publications (2)

Publication Number Publication Date
CN113012157A CN113012157A (en) 2021-06-22
CN113012157B true CN113012157B (en) 2021-07-20

Family

ID=76380782

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110563508.2A Active CN113012157B (en) 2021-05-24 2021-05-24 Visual detection method and system for equipment defects

Country Status (1)

Country Link
CN (1) CN113012157B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113696794B (en) * 2021-08-27 2022-07-08 南京邮电大学 Cooling system for cooling fuel cell for new energy automobile
CN113673542B (en) * 2021-10-23 2022-02-08 深圳希研工业科技有限公司 Express package damage identification method and system based on Internet of things
CN114565825B (en) * 2022-04-27 2022-07-19 南京正驰科技发展有限公司 Security check rechecking method and system based on image recognition
CN115358998B (en) * 2022-08-22 2023-06-16 法博思(宁波)半导体设备有限公司 Method and system for acquiring point coordinates in random array picture

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014191669A (en) * 2013-03-28 2014-10-06 Hitachi Zosen Corp Image processing device and inspection system using the same, and sheet image correction method and sheet inspection method using the same
CN107248159A (en) * 2017-08-04 2017-10-13 河海大学常州校区 A kind of metal works defect inspection method based on binocular vision
CN108109137A (en) * 2017-12-13 2018-06-01 重庆越畅汽车科技有限公司 The Machine Vision Inspecting System and method of vehicle part
CN112037203A (en) * 2020-08-31 2020-12-04 济南大学 Side surface defect detection method and system based on complex workpiece outer contour registration
CN112489037A (en) * 2020-12-15 2021-03-12 科大讯飞华南人工智能研究院(广州)有限公司 Defect detection and related model training method, electronic equipment and storage device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014191669A (en) * 2013-03-28 2014-10-06 Hitachi Zosen Corp Image processing device and inspection system using the same, and sheet image correction method and sheet inspection method using the same
CN107248159A (en) * 2017-08-04 2017-10-13 河海大学常州校区 A kind of metal works defect inspection method based on binocular vision
CN108109137A (en) * 2017-12-13 2018-06-01 重庆越畅汽车科技有限公司 The Machine Vision Inspecting System and method of vehicle part
CN112037203A (en) * 2020-08-31 2020-12-04 济南大学 Side surface defect detection method and system based on complex workpiece outer contour registration
CN112489037A (en) * 2020-12-15 2021-03-12 科大讯飞华南人工智能研究院(广州)有限公司 Defect detection and related model training method, electronic equipment and storage device

Also Published As

Publication number Publication date
CN113012157A (en) 2021-06-22

Similar Documents

Publication Publication Date Title
CN113012157B (en) Visual detection method and system for equipment defects
CN111507965A (en) Novel coronavirus pneumonia focus detection method, system, device and storage medium
CN110415208A (en) A kind of adaptive targets detection method and its device, equipment, storage medium
CN113538375A (en) PCB defect detection method based on YOLOv5
CN110276759B (en) Mobile phone screen bad line defect diagnosis method based on machine vision
CN112991374B (en) Canny algorithm-based edge enhancement method, canny algorithm-based edge enhancement device, canny algorithm-based edge enhancement equipment and storage medium
CN113421242B (en) Welding spot appearance quality detection method and device based on deep learning and terminal
CN113780110A (en) Method and device for detecting weak and small targets in image sequence in real time
CN113066088A (en) Detection method, detection device and storage medium in industrial detection
CN111144425B (en) Method and device for detecting shot screen picture, electronic equipment and storage medium
CN114170212A (en) False positive detection method and system based on small lung nodule in CT image
CN116128873A (en) Bearing retainer detection method, device and medium based on image recognition
CN114331961A (en) Method for defect detection of an object
CN110728692A (en) Image edge detection method based on Scharr operator improvement
CN113034432B (en) Product defect detection method, system, device and storage medium
CN115861220A (en) Cold-rolled strip steel surface defect detection method and system based on improved SSD algorithm
CN115630660A (en) Barcode positioning method and device based on convolutional neural network
CN112116561B (en) Power grid transmission line detection method and device based on image processing fusion network weight
CN112699898B (en) Image direction identification method based on multi-layer feature fusion
CN115273219A (en) Yoga action evaluation method and system, storage medium and electronic equipment
CN107123105A (en) Images match defect inspection method based on FAST algorithms
Nguyen et al. Joint image deblurring and binarization for license plate images using deep generative adversarial networks
CN115330687A (en) Workpiece counting method and device based on FIDT and computer readable storage medium
CN110717471A (en) B-ultrasonic image target detection method and B-ultrasonic scanner
CN111047550A (en) Product abnormity detection method, device and equipment based on machine vision

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