CN115965582B - Ultrahigh-resolution-based method for detecting surface defects of cylinder body and cylinder cover of engine - Google Patents
Ultrahigh-resolution-based method for detecting surface defects of cylinder body and cylinder cover of engine Download PDFInfo
- Publication number
- CN115965582B CN115965582B CN202211473914.0A CN202211473914A CN115965582B CN 115965582 B CN115965582 B CN 115965582B CN 202211473914 A CN202211473914 A CN 202211473914A CN 115965582 B CN115965582 B CN 115965582B
- Authority
- CN
- China
- Prior art keywords
- coordinates
- win
- data
- image
- training
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 44
- 230000007547 defect Effects 0.000 title claims abstract description 42
- 238000012549 training Methods 0.000 claims abstract description 58
- 238000001514 detection method Methods 0.000 claims abstract description 57
- 238000002372 labelling Methods 0.000 claims description 40
- 238000012795 verification Methods 0.000 claims description 22
- 238000013507 mapping Methods 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 9
- 238000010586 diagram Methods 0.000 claims description 6
- 238000006243 chemical reaction Methods 0.000 claims description 4
- 238000012216 screening Methods 0.000 claims description 4
- 238000012545 processing Methods 0.000 abstract description 13
- 238000010276 construction Methods 0.000 abstract description 4
- 238000003754 machining Methods 0.000 abstract 1
- 238000013527 convolutional neural network Methods 0.000 description 6
- 238000013135 deep learning Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000013459 approach Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 125000004122 cyclic group Chemical group 0.000 description 3
- 238000003491 array Methods 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Image Analysis (AREA)
Abstract
The invention discloses a method for detecting surface defects of a cylinder cover of an engine cylinder body based on ultra-high resolution. The invention relates to the technical field of defect detection, and discloses a method for detecting small target defects of a cylinder body and cylinder cover machining surface of an engine cylinder body based on a YOLOV7 algorithm. The method is to carry out multi-scale construction of the data set on the premise of high-resolution industrial camera shooting and on the basis of YOLOV 7. Training is performed by using a small image during training, and prediction is performed by using a sliding window during prediction. Finally, the requirement of accurately detecting the defects of the processing surface of the cylinder body and the cylinder cover is met under the condition that part time is increased. The final detection accuracy reaches more than 95%.
Description
Technical Field
The invention relates to the technical field of defect detection, in particular to a method for detecting defects on the surface of a cylinder cover of an engine cylinder body based on ultra-high resolution.
Background
Compared with the traditional algorithm, the method has the advantages that the problem that the detection precision and stability are difficult to maintain in complex background change in computer vision and target detection is solved, and the deep learning technology can achieve good feature extraction capability and detection precision through a large number of nonlinear combinations. The algorithm model based on the deep learning is higher in intelligence and self-adaption degree, and can have good detection precision in different backgrounds. Convolutional neural networks (convolutional neural network, CNN) develop most rapidly in deep learning and are most widely used in image processing tasks. Deep learning techniques have been widely used for target detection tasks, with 2 main approaches: one is Region Proposal-based target detection, the most representative is the R-CNN series, including R-CNN, fast R-CNN; another approach is an end-to-end approach, such as YOLO (you only look once), SSD (single shot multibox detector), etc., that has faster image processing speed.
Disclosure of Invention
The invention discloses a multi-scale detection method for small target defects of a cylinder body and cylinder cover processing surface of an engine cylinder body based on a YOLOV7 algorithm, which aims to overcome the defects of the prior art. The method is to carry out multi-scale construction of the data set on the premise of high-resolution industrial camera shooting and on the basis of YOLOV 7. Training is performed by using a small image during training, and prediction is performed by using a sliding window during prediction. Finally, the requirement of accurately detecting the defects of the processing surface of the cylinder body and the cylinder cover is met under the condition that part time is increased. The invention provides a method for detecting surface defects of a cylinder cover of an engine cylinder body based on ultra-high resolution.
It is noted that relational terms such as first and second, and the like are 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. Moreover, 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 only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
The invention provides a method for detecting surface defects of a cylinder cover of an engine cylinder body based on ultra-high resolution, which comprises the following steps:
the method for detecting the surface defects of the cylinder cover of the engine cylinder body based on the ultra-high resolution comprises the following steps:
step 1: and using a 2000 ten thousand pixel industrial camera and a plane light source, adjusting exposure to ensure that the shot defect pixel threshold value is obviously distinguished from the surface of the processing surface, and shooting and collecting a plurality of engine cylinder block cylinder head images as training data.
Step 2: rectangular frame labeling is carried out on the engine cylinder body and cylinder cover image dataset to obtain labeling data;
step 3: traversing the annotation data and the picture, randomly expanding to 640-1920 pixels in length and width, and cutting the original picture by taking the expanded coordinates as cutting coordinates to obtain a cut picture and the annotation data corresponding to the cut picture;
step 4: repeating the steps 2 to 3 to obtain a large number of cut pictures and corresponding labeling data;
step 5: converting the labeling data to obtain converted data;
step 6: dividing a training set and a verification set by adopting a random shuffling mode based on the converted data, putting the training set and the verification set into a yolov7 network for training, obtaining a trained weight file after training convergence, and taking the weight file with the best performance on the verification set as a training result;
step 7: and constructing an ROI. Json file according to the shooting position and the corresponding camera number, wherein the content is rectangular coordinates of the region of interest.
Step 8: judging the picture name according to the ROI file, clipping the input image according to the ROI coordinate, and recording the clipping xmin and ymin coordinates.
Step 9: circularly inputting and mapping the cut image back to the original image coordinates by adopting a sliding window to obtain a prediction result;
step 10: all predictions on the artwork coordinates were filtered again using a DIOU-NMS.
Preferably, the step 3 specifically includes: the method comprises the following steps:
traversing all the rectangular frame marking data, randomly expanding 640 to 1920 pixels in a range from the center to four directions by taking the center of the marked rectangular frame as the center, cutting the original image by taking the expanded coordinates as cutting coordinates, converting the marked rectangular frame coordinates in the cutting range into the cut marked rectangular frame coordinates, storing coordinate information into xml files, and obtaining new cut pictures and corresponding xml marked files, wherein the name prefix is the same as the name prefix of the cut pictures.
Preferably, the step 4 specifically includes:
converting the format of an xml markup file (c, xmin, xmax, ymax) into a coco format (c, x, y, w, h), wherein the xml markup file (c, xmin, xmax, ymax) is category information, xmin is an x-coordinate minimum, ymin is a y-coordinate minimum, xmax is an x-coordinate maximum, and ymax is a y-coordinate maximum; the coco format labels c are category information, x, y are center point relative coordinates, w, h are relative width and height.
Preferably, the input size is adjusted to 1280x1280 when the device is put into the yolov7 network for training in the step 6.
Preferably, the step 9 specifically includes:
the prediction is carried out by circularly cutting an input large-size image into a small image with 1280x1280 size by adopting a sliding window mode with a certain step length and inputting the small image into a network to obtain target detection results c, x, y, w, h, conf, category, x, y, w, h and confidence coefficient of the small image, wherein the x min, ymin, xmax and ymax coordinates of a detection frame relative to the small image are expressed by the following formula:
xmin=x*win-w/2*win
ymin=y*win-h/2*win
xmax=x*win+w/2*win
ymax=y*win+h/2*win
the coordinates of the large diagram corresponding to the detection frame are as follows:
xmin=xmin+x_i
ymin=ymin+y_i
xmax=xmax+x_i
ymax=ymax+y_i
the coordinates of the detection result are mapped back to the input large map.
Preferably, the step size is set to 640.
An ultra-high resolution engine block cylinder head surface defect detection system, the system comprising:
the marking module is used for marking the rectangular frame of the image dataset on the surface of the cylinder cover of the engine cylinder body to obtain marking data;
the traversing module traverses the labeling data, randomly expands the labeling data, and cuts the original image by taking the expanded coordinates as cutting coordinates to obtain a cut image and the labeling data corresponding to the cut image;
the repeating module repeats labeling and traversing to obtain a large number of cut pictures and labeling data corresponding to the cut pictures;
the conversion module is used for converting the annotation data to obtain converted data;
the network training module divides the training set and the verification set by adopting a random shuffling mode based on the converted data, and places the training set and the verification set into a yolov7 network for training to obtain the trained data;
a prediction module that: circularly inputting the data after training by adopting a sliding window and mapping back to the original image coordinates to obtain a prediction result;
and the screening module adopts DIOU-NMS to filter and screen all the prediction results on the original image coordinates again.
Preferably, a high resolution industrial camera is used to capture cylinder head surface images.
A computer-readable storage medium having stored thereon a computer program for execution by a processor for implementing a ultra-high resolution engine block cylinder head surface defect detection method.
The computer equipment comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes a method for detecting the surface defects of the cylinder cover of the engine cylinder body based on ultra-high resolution when executing the computer program.
The invention has the following beneficial effects:
the invention discloses a multi-scale detection method for small target defects of a machined surface of a cylinder body and a cylinder cover of an engine based on a YOLOV7 algorithm. The method is to carry out multi-scale construction of the data set on the premise of high-resolution industrial camera shooting and on the basis of YOLOV 7. Training is performed by using a small image during training, and prediction is performed by using a sliding window during prediction. Finally, the requirement of accurately detecting the defects of the processing surface of the cylinder body and the cylinder cover is met under the condition that part time is increased.
Detection of very small targets on the micrometer scale has been a challenge. Firstly, the problem of insufficient pixel number of a micrometer-scale target is solved by shooting with a high-resolution camera. The method solves the problem of input size limitation of the neural network in a mapping original image mode by using sliding window cyclic detection, and simultaneously enables the duty ratio of the target to the input image to be increased so as to change the detection from small target detection to large target detection. The detection effect is improved. The final detection accuracy reaches more than 95%.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of the method of the present invention;
fig. 2 is a diagram of rectangular coordinates of a region of interest.
Detailed Description
The following description of the embodiments of the present invention will be made apparent and fully in view of the accompanying drawings, in which some, but not all embodiments of the invention are shown. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present invention, it should be noted that, unless explicitly specified and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be either fixedly connected, detachably connected, or integrally connected, for example; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
In addition, the technical features of the different embodiments of the present invention described below may be combined with each other as long as they do not collide with each other.
The present invention will be described in detail with reference to specific examples.
First embodiment:
according to the specific optimization technical scheme adopted by the invention for solving the technical problems, as shown in the figures 1 to 2, the technical scheme is as follows: the invention relates to a method for detecting surface defects of a cylinder cover of an engine cylinder body based on ultra-high resolution.
The method for detecting the surface defects of the cylinder cover of the engine cylinder body based on the ultra-high resolution comprises the following steps:
step 1: and using a 2000 ten thousand pixel industrial camera and a plane light source, adjusting exposure to ensure that the shot defect pixel threshold value is obviously distinguished from the surface of the processing surface, and shooting and collecting a plurality of engine cylinder block cylinder head images as training data.
Step 2: rectangular frame labeling is carried out on the image dataset of the cylinder body and cylinder cover surface of the engine cylinder body, and labeling data are obtained;
step 3: traversing the labeling data, randomly expanding, and cutting the original image by taking the expanded coordinates as cutting coordinates to obtain a cut picture and the labeling data corresponding to the cut picture;
step 4: repeating the steps 2 to 3 to obtain a large number of cut pictures and corresponding labeling data;
step 5: converting the labeling data to obtain converted data;
step 6: dividing a training set and a verification set by adopting a random shuffling mode based on the converted data, putting the training set and the verification set into a yolov7 network for training, obtaining a trained weight file after training convergence, and taking the weight file with the best performance on the verification set as a training result;
step 7: and constructing an ROI. Json file according to the shooting position and the corresponding camera number, wherein the content is rectangular coordinates of the region of interest. The format is shown in fig. 2.
Step 8: judging the picture name according to the ROI file, clipping the input image according to the ROI coordinate, and recording the clipping xmin and ymin coordinates.
Step 9: circularly inputting and mapping the cut image back to the original image coordinates by adopting a sliding window to obtain a prediction result;
step 10: all predictions on the artwork coordinates were filtered again using a DIOU-NMS.
The invention has been a difficult problem for micro-scale extremely small target detection. Firstly, the problem of insufficient pixel number of a micrometer-scale target is solved by shooting with a high-resolution camera. The method solves the problem of input size limitation of the neural network in a mapping original image mode by using sliding window cyclic detection, and simultaneously enables the duty ratio of the target to the input image to be increased so as to change the detection from small target detection to large target detection. The detection effect is improved. The final detection accuracy reaches more than 95%.
Specific embodiment II:
the second embodiment of the present application differs from the first embodiment only in that:
the step 3 specifically comprises the following steps: the method comprises the following steps:
traversing all the rectangular frame marking data, randomly expanding 640 to 1920 pixels in a range from the center to four directions by taking the center of the marked rectangular frame as the center, cutting the original image by taking the expanded coordinates as cutting coordinates, converting the marked rectangular frame coordinates in the cutting range into the cut marked rectangular frame coordinates, storing coordinate information into xml files, and obtaining new cut pictures and corresponding xml marked files, wherein the name prefix is the same as the name prefix of the cut pictures.
Third embodiment:
the difference between the third embodiment and the second embodiment of the present application is only that:
the step 5 specifically comprises the following steps:
converting the format of an xml markup file (c, xmin, xmax, ymax) into a coco format (c, x, y, w, h), wherein the xml markup file (c, xmin, xmax, ymax) is category information, xmin is an x-coordinate minimum, ymin is a y-coordinate minimum, xmax is an x-coordinate maximum, and ymax is a y-coordinate maximum; the coco format labels c are category information, x, y are center point relative coordinates, w, h are relative width and height.
Fourth embodiment:
the fourth embodiment of the present application differs from the third embodiment only in that:
and in the step 6, the input size is adjusted to 1280x1280 when the device is put into a yolov7 network for training.
Fifth embodiment:
the fifth embodiment differs from the fourth embodiment only in that:
the step 9 specifically comprises the following steps:
the prediction is carried out by circularly cutting an input large-size image into a small image with 1280x1280 size by adopting a sliding window mode with a certain step length and inputting the small image into a network to obtain target detection results c, x, y, w, h, conf, category, x, y, w, h and confidence coefficient of the small image, wherein the x min, ymin, xmax and ymax coordinates of a detection frame relative to the small image are expressed by the following formula:
xmin=x*win-w/2*win
ymin=y*win-h/2*win
xmax=x*win+w/2*win
ymax=y*win+h/2*win
the coordinates of the large diagram corresponding to the detection frame are as follows:
xmin=xmin+x_i
ymin=ymin+y_i
xmax=xmax+x_i
ymax=ymax+y_i
the coordinates of the detection result are mapped back to the input large map.
Specific embodiment six:
the difference between the sixth embodiment and the fifth embodiment of the present application is only that:
the step size is set to 640.
Specific embodiment seven:
the seventh embodiment of the present application differs from the sixth embodiment only in that:
the invention provides a system for detecting surface defects of a cylinder cover of an engine cylinder body based on ultra-high resolution, which comprises the following components:
the marking module is used for marking the rectangular frame of the image dataset on the surface of the cylinder cover of the engine cylinder body to obtain marking data;
the traversing module traverses the labeling data, randomly expands the labeling data, and cuts the original image by taking the expanded coordinates as cutting coordinates to obtain a cut image and the labeling data corresponding to the cut image;
the repeating module repeats labeling and traversing to obtain a large number of cut pictures and labeling data corresponding to the cut pictures;
the conversion module is used for converting the annotation data to obtain converted data;
the network training module divides the training set and the verification set by adopting a random shuffling mode based on the converted data, and places the training set and the verification set into a yolov7 network for training to obtain the trained data;
a prediction module that: circularly inputting the data after training by adopting a sliding window and mapping back to the original image coordinates to obtain a prediction result;
and the screening module adopts DIOU-NMS to filter and screen all the prediction results on the original image coordinates again.
Specific embodiment eight:
the eighth embodiment of the present application differs from the seventh embodiment only in that:
and shooting the cylinder cover surface image by adopting a high-resolution industrial camera.
Specific embodiment nine:
embodiment nine of the present application differs from embodiment eight only in that:
the present invention provides a computer-readable storage medium having stored thereon a computer program for execution by a processor for implementing, for example, a method for ultra-high resolution based detection of surface defects of engine block cylinder heads.
The method comprises the following steps:
step 1: and using a 2000 ten thousand pixel industrial camera and a plane light source, adjusting exposure to ensure that the shot defect pixel threshold value is obviously distinguished from the surface of the processing surface, and shooting and collecting a plurality of engine cylinder block cylinder head images as training data.
Step 2: rectangular frame labeling is carried out on the engine cylinder body and cylinder cover image dataset to obtain labeling data;
step 3: traversing the annotation data and the picture, randomly expanding to 640-1920 pixels in length and width, and cutting the original picture by taking the expanded coordinates as cutting coordinates to obtain a cut picture and the annotation data corresponding to the cut picture;
step 4: repeating the steps 2 to 3 to obtain a large number of cut pictures and corresponding labeling data;
step 5: converting the labeling data to obtain converted data;
step 6: dividing a training set and a verification set by adopting a random shuffling mode based on the converted data, putting the training set and the verification set into a yolov7 network for training, obtaining a trained weight file after training convergence, and taking the weight file with the best performance on the verification set as a training result;
step 7: and constructing an ROI. Json file according to the shooting position and the corresponding camera number, wherein the content is rectangular coordinates of the region of interest. The format is shown in fig. 2.
Step 8: judging the picture name according to the ROI file, clipping the input image according to the ROI coordinate, and recording the clipping xmin and ymin coordinates.
Step 9: circularly inputting and mapping the cut image back to the original image coordinates by adopting a sliding window to obtain a prediction result;
step 10: all predictions on the artwork coordinates were filtered again using a DIOU-NMS.
Specific embodiment ten:
the tenth embodiment differs from the ninth embodiment only in that:
the invention provides computer equipment, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes a method for detecting the surface defects of a cylinder cover of an engine cylinder body based on ultra-high resolution when executing the computer program.
The method comprises the following steps:
step 1: and using a 2000 ten thousand pixel industrial camera and a plane light source, adjusting exposure to ensure that the shot defect pixel threshold value is obviously distinguished from the surface of the processing surface, and shooting and collecting a plurality of engine cylinder block cylinder head images as training data.
Step 2: rectangular frame labeling is carried out on the engine cylinder body and cylinder cover image dataset to obtain labeling data;
step 3: traversing the annotation data and the picture, randomly expanding to 640-1920 pixels in length and width, and cutting the original picture by taking the expanded coordinates as cutting coordinates to obtain a cut picture and the annotation data corresponding to the cut picture;
step 4: repeating the steps 2 to 3 to obtain a large number of cut pictures and corresponding labeling data;
step 5: converting the labeling data to obtain converted data;
step 6: dividing a training set and a verification set by adopting a random shuffling mode based on the converted data, putting the training set and the verification set into a yolov7 network for training, obtaining a trained weight file after training convergence, and taking the weight file with the best performance on the verification set as a training result;
step 7: and constructing an ROI. Json file according to the shooting position and the corresponding camera number, wherein the content is rectangular coordinates of the region of interest. The format is shown in fig. 2.
Step 8: judging the picture name according to the ROI file, clipping the input image according to the ROI coordinate, and recording the clipping xmin and ymin coordinates.
Step 9: circularly inputting and mapping the cut image back to the original image coordinates by adopting a sliding window to obtain a prediction result;
step 10: all predictions on the artwork coordinates were filtered again using a DIOU-NMS.
Specific example eleven:
embodiment eleven of the present application differs from embodiment eleven only in that:
(1) Carrying out original rectangular frame marking on the data set by using labelimg software to obtain an xml marking file;
(2) Traversing all the rectangular frame marking information, randomly expanding 640 to 1920 pixels in a range from the center to four directions by taking the center of the marked rectangular frame as the center, cutting the original image by taking the expanded coordinates as cutting coordinates, converting the marked rectangular frame coordinates in the cutting range into cut marked rectangular frame coordinates, storing the coordinate information as an xml file, and enabling the name prefix to be identical with the name prefix of the cut picture. Thus, a new cut picture and an xml markup document corresponding to the new cut picture are obtained;
(3) Repeating the step 2 for 2-3 times to form a large number of pictures and corresponding xml labeling data;
(4) Converting the format of the xml label (c, xmin, ymin, xmax, ymax) into the coco format (c, x, y, w, h), wherein c of the xml label is category information, xmin is an x-coordinate minimum, ymin is a y-coordinate minimum, xmax is an x-coordinate maximum, and ymax is a y-coordinate maximum. The coco format label c is category information, x, y is the relative coordinates of the center point, w and h are the relative width and height;
(5) Dividing a training set and a verification set by using a random shuffling mode;
(6) Training in yolov7 network, and adjusting input size to 1280x1280;
(7) The whole prediction adopts a sliding window mode with the window size of 1280x1280 (abbreviated as win) and the step length of 640 to circularly cut an input large-size image into a small image with the size of 1280x1280 and the coordinates x_i and y_i of the upper left corner corresponding to the window. When the small image is input into a network, target detection results c, x, y, w, h and conf (category, x, y, w, h and confidence) of the small image are obtained, and the xmin, xmax and ymax coordinates of the detection frame relative to the small image are as follows:
xmin=x*win-w/2*win
ymin=y*win-h/2*win
xmax=x*win+w/2*win
ymax=y*win+h/2*win
the coordinates of the large diagram corresponding to the detection frame are as follows:
xmin=xmin+x_i
ymin=ymin+y_i
xmax=xmax+x_i
ymax=ymax+y_i
this maps all detection result coordinates back onto the input large map.
(8) All predictions on the large graph are filtered again by the DIOU-NMS.
The invention discloses a multi-scale detection method for small target defects of a machined surface of a cylinder body and a cylinder cover of an engine based on a YOLOV7 algorithm. The method is to carry out multi-scale construction of the data set on the premise of high-resolution industrial camera shooting and on the basis of YOLOV 7. Training is performed by using a small image during training, and prediction is performed by using a sliding window during prediction. Finally, the requirement of accurately detecting the defects of the processing surface of the cylinder body and the cylinder cover is met under the condition that part time is increased.
Twelve specific embodiments:
the twelfth embodiment of the present application differs from the eleventh embodiment only in that:
the scheme of the multi-scale detection method for the small target defects of the engine cylinder body and cylinder cover processing surface based on the YOLOV7 algorithm is as follows:
(1) Shooting by using an industrial camera;
(2) The shot pictures are subjected to frame selection marking by labelimg;
(3) Performing multi-scale cutting processing on the original image and the mark;
(4) Performing format conversion from xml to coco data set on the cut pictures and labels;
(5) Randomly dividing a training set and a verification set;
(6) Training using a yolov7 network;
(7) The push-forward network is modified into a sliding window for cyclic input and mapping back to the original image coordinates;
(8) Filtering and screening all predicted results again through DIOU-NMS;
in the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or N embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction. Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "N" means at least two, for example, two, three, etc., unless specifically defined otherwise. Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more N executable instructions for implementing specific logical functions or steps of the process, and further implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present invention. Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or N wires, a portable computer cartridge (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory. It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the N steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. As with the other embodiments, if implemented in hardware, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
The above description is only a preferred embodiment of the method for detecting the surface defects of the cylinder cover of the engine cylinder body based on the ultra-high resolution, and the protection scope of the method for detecting the surface defects of the cylinder cover of the engine cylinder body based on the ultra-high resolution is not limited to the above embodiments, and all technical schemes under the concept belong to the protection scope of the invention. It should be noted that modifications and variations can be made by those skilled in the art without departing from the principles of the present invention, which is also considered to be within the scope of the present invention.
Claims (9)
1. A method for detecting surface defects of a cylinder cover of an engine cylinder body based on ultra-high resolution is characterized by comprising the following steps: the method comprises the following steps:
step 1: rectangular frame labeling is carried out on the image dataset of the cylinder body and cylinder cover surface of the engine cylinder body, and labeling data are obtained;
step 2: traversing the labeling data, randomly expanding, and cutting the original image by taking the expanded coordinates as cutting coordinates to obtain a cut picture and the labeling data corresponding to the cut picture;
step 3: repeating the steps 2 to 3 to obtain a large number of cut pictures and corresponding labeling data;
step 4: converting the labeling data to obtain converted data;
step 5: dividing a training set and a verification set by adopting a random shuffling mode based on the converted data, and putting the training set and the verification set into a yolov7 network for training to obtain trained data;
step 6: circularly inputting the data after training by adopting a sliding window and mapping back to the original image coordinates to obtain a prediction result;
the step 6 specifically comprises the following steps:
the prediction is carried out by circularly cutting an input large-size image into a small image with 1280x1280 size by adopting a sliding window mode with a certain step length, and inputting the small image into a network to obtain target detection results c, x, y, w, h and conf of the small image, wherein c, x, y, w, h and conf are respectively the types, x, y, w, h and confidence, and the xmin, xmax and ymax coordinates of a detection frame relative to the small image are expressed by the following formulas:
xmin=x*win-w/2*win
ymin=y*win-h/2*win
xmax=x*win+w/2*win
ymax=y*win+h/2*win
the coordinates of the large diagram corresponding to the detection frame are as follows:
xmin=xmin+x_i
ymin=ymin+y_i
xmax=xmax+x_i
ymax=ymax+y_i
mapping the detection result coordinates back to the input large graph;
step 7: all predictions on the artwork coordinates were filtered again using a DIOU-NMS.
2. The ultra-high resolution engine block cylinder head surface defect detection method based on claim 1, wherein the method comprises the following steps: the step 2 specifically comprises the following steps: the method comprises the following steps:
traversing all the rectangular frame marking data, randomly expanding 640 to 1920 pixels in a range from the center to four directions by taking the center of the marked rectangular frame as the center, cutting the original image by taking the expanded coordinates as cutting coordinates, converting the marked rectangular frame coordinates in the cutting range into the cut marked rectangular frame coordinates, storing coordinate information into xml files, and obtaining new cut pictures and corresponding xml marked files, wherein the name prefix is the same as the name prefix of the cut pictures.
3. The ultra-high resolution engine block cylinder head surface defect detection method based on claim 2, characterized by comprising the following steps: the step 4 specifically comprises the following steps:
converting the format of an xml markup file (c, xmin, xmax, ymax) into a coco format (c, x, y, w, h), wherein the xml markup file (c, xmin, xmax, ymax) is category information, xmin is an x-coordinate minimum, ymin is a y-coordinate minimum, xmax is an x-coordinate maximum, and ymax is a y-coordinate maximum; the coco format labels c are category information, x, y are center point relative coordinates, w, h are relative width and height.
4. The ultra-high resolution engine block cylinder head surface defect detection method based on claim 3, wherein the method comprises the following steps: and (3) in the step 5, the input size is adjusted to 1280x1280 when the training is carried out in a yolov7 network.
5. The ultra-high resolution engine block cylinder head surface defect detection method based on claim 1, wherein the method comprises the following steps: the step size is set to 640.
6. A defect detection system based on the surface of a cylinder cover of an ultrahigh resolution engine cylinder body is characterized in that: the system comprises:
the marking module is used for marking the rectangular frame of the image dataset on the surface of the cylinder cover of the engine cylinder body to obtain marking data;
the traversing module traverses the labeling data, randomly expands the labeling data, and cuts the original image by taking the expanded coordinates as cutting coordinates to obtain a cut image and the labeling data corresponding to the cut image;
the repeating module repeats labeling and traversing to obtain a large number of cut pictures and labeling data corresponding to the cut pictures;
the conversion module is used for converting the annotation data to obtain converted data;
the network training module divides the training set and the verification set by adopting a random shuffling mode based on the converted data, and places the training set and the verification set into a yolov7 network for training to obtain the trained data;
a prediction module that: circularly inputting the data after training by adopting a sliding window and mapping back to the original image coordinates to obtain a prediction result;
the prediction is carried out by circularly cutting an input large-size image into a small image with 1280x1280 size by adopting a sliding window mode with a certain step length, and inputting the small image into a network to obtain target detection results c, x, y, w, h and conf of the small image, wherein c, x, y, w, h and conf are respectively the types, x, y, w, h and confidence, and the xmin, xmax and ymax coordinates of a detection frame relative to the small image are expressed by the following formulas:
xmin=x*win-w/2*win
ymin=y*win-h/2*win
xmax=x*win+w/2*win
ymax=y*win+h/2*win
the coordinates of the large diagram corresponding to the detection frame are as follows:
xmin=xmin+x_i
ymin=ymin+y_i
xmax=xmax+x_i
ymax=ymax+y_i
mapping the detection result coordinates back to the input large graph;
and the screening module adopts DIOU-NMS to filter and screen all the prediction results on the original image coordinates again.
7. The ultra-high resolution engine block cylinder head surface defect detection system based on claim 6, wherein the system is characterized in that: and shooting the cylinder cover surface image by adopting a high-resolution industrial camera.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that the program is executed by a processor for realizing a ultra-high resolution engine block cylinder head surface defect detection method according to any one of claims 1-5.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized by: the processor, when executing the computer program, implements a method for detecting defects on a cylinder head surface of an engine cylinder block based on ultra-high resolution according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211473914.0A CN115965582B (en) | 2022-11-22 | 2022-11-22 | Ultrahigh-resolution-based method for detecting surface defects of cylinder body and cylinder cover of engine |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211473914.0A CN115965582B (en) | 2022-11-22 | 2022-11-22 | Ultrahigh-resolution-based method for detecting surface defects of cylinder body and cylinder cover of engine |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115965582A CN115965582A (en) | 2023-04-14 |
CN115965582B true CN115965582B (en) | 2024-03-08 |
Family
ID=87360655
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211473914.0A Active CN115965582B (en) | 2022-11-22 | 2022-11-22 | Ultrahigh-resolution-based method for detecting surface defects of cylinder body and cylinder cover of engine |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115965582B (en) |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108319949A (en) * | 2018-01-26 | 2018-07-24 | 中国电子科技集团公司第十五研究所 | Mostly towards Ship Target Detection and recognition methods in a kind of high-resolution remote sensing image |
CN109829879A (en) * | 2018-12-04 | 2019-05-31 | 国际竹藤中心 | The detection method and device of vascular bundle |
CN110508510A (en) * | 2019-08-27 | 2019-11-29 | 广东工业大学 | A kind of plastic pump defect inspection method, apparatus and system |
CN110599445A (en) * | 2019-07-24 | 2019-12-20 | 安徽南瑞继远电网技术有限公司 | Target robust detection and defect identification method and device for power grid nut and pin |
CN111161243A (en) * | 2019-12-30 | 2020-05-15 | 华南理工大学 | Industrial product surface defect detection method based on sample enhancement |
CN113160062A (en) * | 2021-05-25 | 2021-07-23 | 烟台艾睿光电科技有限公司 | Infrared image target detection method, device, equipment and storage medium |
CN113327255A (en) * | 2021-05-28 | 2021-08-31 | 宁波新胜中压电器有限公司 | Power transmission line inspection image processing method based on YOLOv3 detection, positioning and cutting and fine-tune |
WO2021237608A1 (en) * | 2020-05-28 | 2021-12-02 | 京东方科技集团股份有限公司 | Target detection method based on heterogeneous platform, and terminal device and storage medium |
CN113850324A (en) * | 2021-09-24 | 2021-12-28 | 郑州大学 | Multispectral target detection method based on Yolov4 |
CN113850799A (en) * | 2021-10-14 | 2021-12-28 | 长春工业大学 | YOLOv 5-based trace DNA extraction workstation workpiece detection method |
CN114359948A (en) * | 2021-12-23 | 2022-04-15 | 华南理工大学 | Power grid wiring diagram primitive identification method based on overlapping sliding window mechanism and YOLOV4 |
CN114549446A (en) * | 2022-02-17 | 2022-05-27 | 南京工程学院 | Cylinder sleeve defect mark detection method based on deep learning |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11967056B2 (en) * | 2020-12-31 | 2024-04-23 | Infrastructure Dl, Llc | Systems, methods and apparatuses for detecting and analyzing defects in underground infrastructure systems |
-
2022
- 2022-11-22 CN CN202211473914.0A patent/CN115965582B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108319949A (en) * | 2018-01-26 | 2018-07-24 | 中国电子科技集团公司第十五研究所 | Mostly towards Ship Target Detection and recognition methods in a kind of high-resolution remote sensing image |
CN109829879A (en) * | 2018-12-04 | 2019-05-31 | 国际竹藤中心 | The detection method and device of vascular bundle |
CN110599445A (en) * | 2019-07-24 | 2019-12-20 | 安徽南瑞继远电网技术有限公司 | Target robust detection and defect identification method and device for power grid nut and pin |
CN110508510A (en) * | 2019-08-27 | 2019-11-29 | 广东工业大学 | A kind of plastic pump defect inspection method, apparatus and system |
CN111161243A (en) * | 2019-12-30 | 2020-05-15 | 华南理工大学 | Industrial product surface defect detection method based on sample enhancement |
WO2021237608A1 (en) * | 2020-05-28 | 2021-12-02 | 京东方科技集团股份有限公司 | Target detection method based on heterogeneous platform, and terminal device and storage medium |
CN113160062A (en) * | 2021-05-25 | 2021-07-23 | 烟台艾睿光电科技有限公司 | Infrared image target detection method, device, equipment and storage medium |
CN113327255A (en) * | 2021-05-28 | 2021-08-31 | 宁波新胜中压电器有限公司 | Power transmission line inspection image processing method based on YOLOv3 detection, positioning and cutting and fine-tune |
CN113850324A (en) * | 2021-09-24 | 2021-12-28 | 郑州大学 | Multispectral target detection method based on Yolov4 |
CN113850799A (en) * | 2021-10-14 | 2021-12-28 | 长春工业大学 | YOLOv 5-based trace DNA extraction workstation workpiece detection method |
CN114359948A (en) * | 2021-12-23 | 2022-04-15 | 华南理工大学 | Power grid wiring diagram primitive identification method based on overlapping sliding window mechanism and YOLOV4 |
CN114549446A (en) * | 2022-02-17 | 2022-05-27 | 南京工程学院 | Cylinder sleeve defect mark detection method based on deep learning |
Non-Patent Citations (2)
Title |
---|
基于yolo的上课状态检测方法;常思远;;许昌学院学报;20200930(05);134-138 * |
基于深度学习的铁路接触网开口销状态检测方法研究;吴涛;中国优秀硕士学位论文全文数据库工程科技Ⅱ辑;20210315(第3期);C033-117 * |
Also Published As
Publication number | Publication date |
---|---|
CN115965582A (en) | 2023-04-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110059694B (en) | Intelligent identification method for character data in complex scene of power industry | |
JP7099509B2 (en) | Computer vision system for digitization of industrial equipment gauges and alarms | |
CN110008956B (en) | Invoice key information positioning method, invoice key information positioning device, computer equipment and storage medium | |
CN104766058B (en) | A kind of method and apparatus for obtaining lane line | |
CN109583345B (en) | Road recognition method, device, computer device and computer readable storage medium | |
CN111914698B (en) | Human body segmentation method, segmentation system, electronic equipment and storage medium in image | |
CN105608456A (en) | Multi-directional text detection method based on full convolution network | |
CN104537705B (en) | Mobile platform three dimensional biological molecular display system and method based on augmented reality | |
CN111339902B (en) | Liquid crystal display indication recognition method and device for digital display instrument | |
DE112011103690T5 (en) | Detection and tracking of moving objects | |
CN110807775A (en) | Traditional Chinese medicine tongue image segmentation device and method based on artificial intelligence and storage medium | |
CN110349138B (en) | Target object detection method and device based on example segmentation framework | |
CN106297755A (en) | A kind of electronic equipment for musical score image identification and recognition methods | |
CN113159064A (en) | Method and device for detecting electronic element target based on simplified YOLOv3 circuit board | |
CN109711241A (en) | Object detecting method, device and electronic equipment | |
CN117079117B (en) | Underwater image processing and target identification method and device, storage medium and electronic equipment | |
CN114677596A (en) | Remote sensing image ship detection method and device based on attention model | |
CN113095441A (en) | Pig herd bundling detection method, device, equipment and readable storage medium | |
CN116245882A (en) | Circuit board electronic element detection method and device and computer equipment | |
CN115965582B (en) | Ultrahigh-resolution-based method for detecting surface defects of cylinder body and cylinder cover of engine | |
CN116612357B (en) | Method, system and storage medium for constructing unsupervised RGBD multi-mode data set | |
CN111340040B (en) | Paper character recognition method and device, electronic equipment and storage medium | |
CN113158856A (en) | Processing method and device for extracting target area in remote sensing image | |
CN117218672A (en) | Deep learning-based medical records text recognition method and system | |
CN111222355A (en) | Method and system for positioning bar code on PCB |
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 |