CN115965582A - Ultrahigh-resolution-based engine cylinder body and cylinder cover surface defect detection method - Google Patents
Ultrahigh-resolution-based engine cylinder body and cylinder cover surface defect detection method Download PDFInfo
- Publication number
- CN115965582A CN115965582A CN202211473914.0A CN202211473914A CN115965582A CN 115965582 A CN115965582 A CN 115965582A CN 202211473914 A CN202211473914 A CN 202211473914A CN 115965582 A CN115965582 A CN 115965582A
- Authority
- CN
- China
- Prior art keywords
- data
- coordinates
- image
- cylinder cover
- 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.)
- Granted
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 55
- 230000007547 defect Effects 0.000 title claims abstract description 43
- 238000012549 training Methods 0.000 claims abstract description 56
- 238000000034 method Methods 0.000 claims abstract description 55
- 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
- 238000002372 labelling Methods 0.000 claims description 8
- 238000012216 screening Methods 0.000 claims description 7
- 238000006243 chemical reaction Methods 0.000 claims description 4
- 238000001914 filtration Methods 0.000 claims description 4
- 238000012545 processing Methods 0.000 abstract description 11
- 238000010276 construction Methods 0.000 abstract description 4
- 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
- 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
- 230000008859 change Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000605 extraction 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
Images
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 based on ultrahigh resolution. The invention relates to the technical field of defect detection, and discloses a small target defect multi-scale detection method for a cylinder cover processing surface of an engine cylinder block based on a YOLOV7 algorithm. The method is used for carrying out multi-scale construction on a data set on the premise of high-resolution industrial camera shooting and on the basis of YOLOV 7. And during training, training by using a small graph, and during prediction, predicting by using a sliding window. Finally, the requirement for accurately detecting the defects of the machined surface of the cylinder body and the cylinder cover is met under the condition that the time consumption of the part is increased. And the final detection accuracy rate reaches more than 95%.
Description
Technical Field
The invention relates to the technical field of defect detection, in particular to a method for detecting surface defects of a cylinder cover of an engine cylinder body based on ultrahigh resolution.
Background
Compared with the traditional algorithm, the method has the advantages that the detection precision and stability are difficult to maintain in complex background change in computer vision and target detection, 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 deep learning has higher intelligence and self-adaption degree, and can have good detection precision in different backgrounds. Convolutional Neural Networks (CNNs) are most rapidly developed in deep learning and most widely used in image processing tasks. Deep learning techniques have been widely applied to target detection tasks, and there are mainly 2 methods: one is the object detection based on Region Proposal, and the most representative is the R-CNN series, including R-CNN, fast R-CNN, faster R-CNN; another method is an end-to-end method, such as YOLO (you only look once), SSD (single shot multi box detector), etc., which has a faster image processing speed.
Disclosure of Invention
The invention discloses a small target defect multi-scale detection method for a cylinder cover processing surface of an engine cylinder block based on a YOLOV7 algorithm, aiming at overcoming the defects of the prior art. The method is used for carrying out multi-scale construction on a data set on the premise of shooting by a high-resolution industrial camera and on the basis of YOLOV 7. During training, the small graph is adopted for training, and during prediction, sliding window prediction is adopted. Finally, the requirement for accurately detecting the defects of the machined surface of the cylinder body and the cylinder cover is met under the condition that the time consumption of the part is increased. The invention provides a method for detecting surface defects of a cylinder cover of an engine cylinder based on ultrahigh resolution.
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. Also, 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 based on ultrahigh resolution, which provides the following technical scheme:
a method for detecting surface defects of a cylinder cover based on an ultrahigh-resolution engine cylinder body comprises the following steps:
step 1: the method comprises the steps of adjusting exposure by using 2000 ten thousand pixel industrial cameras and a plane light source to enable a shot defect pixel threshold value to be obviously distinguished from the surface of a processing surface, and shooting and collecting images of a cylinder body and a cylinder cover of a plurality of engine cylinders to serve as training data.
And 2, step: carrying out rectangular frame marking on an image data set of a cylinder body and a cylinder cover of an engine cylinder to obtain marked data;
and 3, step 3: traversing the labeled data and the picture, randomly expanding the labeled data and the picture to have the length and the width of 640-1920 pixels, and cutting the original picture by taking the expanded coordinate as a cutting coordinate to obtain the cut picture and the labeled data corresponding to the cut picture;
and 4, step 4: repeating the steps 2 to 3 to obtain a large number of the cut pictures and the corresponding labeled data;
and 5: converting the marked 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 the training is converged, and taking the weight file which is best represented on the verification set as a training result;
and 7: json file is constructed according to the shooting position and the corresponding camera number, and the content is the rectangular coordinate of the region of interest.
And 8: and judging the picture name according to the ROI file, clipping the input image according to the ROI coordinates, and recording clipped xmin and ymin coordinates.
And step 9: circularly inputting the cut image by adopting a sliding window and mapping the image back to the coordinates of the original image to obtain a prediction result;
step 10: and adopting DIOU-NMS to filter and screen all the prediction results on the original image coordinates again.
Preferably, the step 3 specifically comprises: the method comprises the following steps:
traversing all the rectangular frame label data, taking the center of the labeled rectangular frame as the center, randomly expanding the range from 640 pixels to 1920 pixels from the center to four directions, taking the expanded coordinates as cutting coordinates to cut the original image, converting the coordinates of the labeled rectangular frame in the cutting range into the coordinates of the labeled rectangular frame after cutting, storing the coordinate information into an xml file, and obtaining a new cut image and an xml label file corresponding to the new cut image, wherein the name prefix is the same as the name prefix of the cut image.
Preferably, the step 4 specifically includes:
converting the format of the xml label file (c, xmin, ymin, xmax, ymax) into a coco format (c, x, y, w, h), wherein the format of the xml label file (c) is the category information, xmin is the minimum value of an x coordinate, ymin is the minimum value of a y coordinate, xmax is the maximum value of the x coordinate, and ymax is the maximum value of the y coordinate; the coco format labels c are category information, x, y are center point relative coordinates, and w, h are relative width and height.
Preferably, the input size of step 6 is adjusted to 1280x1280 when the device is placed in yolov7 network for training.
Preferably, the step 9 specifically includes:
the method includes the steps that a window size is 1280x1280, an input large-size image is cut into a small image with the size of 1280x1280 in a circulating mode in a sliding window mode with a certain step length, the small image is input into a network, and target detection results c, x, y, w, h, conf, types, x, y, w, h and confidence coefficients of the small image and xmin, ymin, xmax and ymax coordinates of a detection frame relative to the small image are obtained through 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 detection frame corresponding to the big picture are as follows:
xmin=xmin+x_i
ymin=ymin+y_i
xmax=xmax+x_i
ymax=ymax+y_i
and mapping the detection result coordinates back to the input large graph.
Preferably, the step size is set to 640.
A surface defect detection system based on an ultrahigh resolution engine cylinder block and cylinder head, the system comprising:
the marking module is used for marking the image data set on the surface of the cylinder cover of the engine cylinder body by a rectangular frame to obtain marking data;
the traversal module traverses the labeled data, randomly expands the labeled data, and cuts the original image by taking the expanded coordinates as cutting coordinates to obtain a cut image and labeled data corresponding to the cut image;
the repeating module is used for repeatedly marking and traversing to obtain a large number of cut pictures and marking data corresponding to the cut pictures;
the conversion module is used for converting the labeling data to obtain converted data;
the network training module divides a training set and a verification set by adopting a random shuffling mode based on the converted data, and puts the training set and the verification set into a yolov7 network for training to obtain trained data;
a prediction module that: circularly inputting the trained data by adopting a sliding window and mapping the data back to the original image coordinates to obtain a prediction result;
and the screening module is used for filtering and screening all the prediction results on the original image coordinates again by adopting DIOU-NMS.
Preferably, a high-resolution industrial camera is used for shooting the surface image of the cylinder body and the cylinder cover.
A computer readable storage medium having stored thereon a computer program for execution by a processor for implementing a method for ultrahigh resolution engine block-based cylinder head surface defect detection.
A computer device comprises a storage and a processor, wherein the storage stores a computer program, and the processor executes the computer program to realize a surface defect detection method based on a cylinder body and a cylinder cover of an ultrahigh-resolution engine.
The invention has the following beneficial effects:
the invention discloses a YOLOV7 algorithm-based multi-scale detection method for small target defects on a cylinder cover processing surface of an engine cylinder body. The method is used for carrying out multi-scale construction on a data set on the premise of high-resolution industrial camera shooting and on the basis of YOLOV 7. And during training, training by using a small graph, and during prediction, predicting by using a sliding window. Finally, the requirement for accurately detecting the defects of the machined surface of the cylinder body and the cylinder cover is met under the condition that the time consumption of the part is increased.
Detection of very small targets on the micrometer scale has been a challenge. Firstly, a high-resolution camera is used for shooting, so that the problem of insufficient pixel number of the micron-sized target is solved. The method for mapping the original image back by using the sliding window cycle detection solves the problem of input size limitation of the neural network, and simultaneously, the ratio of the target to the input image is increased, so that the detection is changed from small target detection to large target detection. The detection effect is improved. And the final detection accuracy rate reaches over 95 percent.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, 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 some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart of the method of the present invention;
fig. 2 is a diagram of a rectangular coordinate form with the content of a region of interest.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present 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 "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular 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 otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
Furthermore, the technical features involved in the different embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
The present invention will be described in detail with reference to specific examples.
The first embodiment is as follows:
as shown in fig. 1 to fig. 2, the specific optimization technical solution adopted by the present invention to solve the above technical problems is: the invention relates to a method for detecting surface defects of a cylinder cover of an engine cylinder based on ultrahigh resolution.
A surface defect detection method based on an ultrahigh resolution engine cylinder block and a cylinder cover comprises the following steps:
step 1: the method comprises the steps of adjusting exposure by using a 2000-ten-thousand-pixel industrial camera and a plane light source to enable a shot defect pixel threshold value to be obviously distinguished from the surface of a machined surface, and shooting and collecting images of a cylinder body and a cylinder cover of a plurality of engine cylinders to serve as training data.
And 2, step: carrying out rectangular frame labeling on the image data set on the surface of the cylinder cover of the engine cylinder body to obtain labeled data;
and step 3: traversing the labeled data, randomly expanding, and cutting the original image by taking the expanded coordinates as cutting coordinates to obtain a cut image and labeled data corresponding to the cut image;
and 4, step 4: repeating the steps 2 to 3 to obtain a large number of the cut pictures and the corresponding labeled data;
and 5: converting the marked 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 the training is converged, and taking the weight file which is best represented on the verification set as a training result;
and 7: json file is constructed according to the shooting position and the corresponding camera number, and the content is the rectangular coordinate of the region of interest. The format is shown in fig. 2.
And 8: and judging the picture name according to the ROI file, clipping the input image according to the ROI coordinates, and recording clipped xmin and ymin coordinates.
And step 9: circularly inputting the clipped image by adopting a sliding window and mapping the image back to the original image coordinate to obtain a prediction result;
step 10: and adopting DIOU-NMS to filter and screen all the prediction results on the original image coordinates again.
The invention has been a difficult problem for the detection of micron-scale extremely small targets. Firstly, a high-resolution camera is used for shooting, so that the problem of insufficient pixel number of the micron-sized target is solved. The method for mapping the original image back by using the sliding window cycle detection solves the problem of the input size limitation of the neural network, and simultaneously, the ratio of the target to the input image is increased, so that the detection is changed from small target detection to large target detection. The detection effect is improved. And the final detection accuracy rate reaches more than 95%.
The second embodiment is as follows:
the difference between the second embodiment and the first embodiment is only that:
the step 3 specifically comprises the following steps: the method comprises the following steps:
traversing all the rectangular frame label data, taking the center of the labeled rectangular frame as the center, randomly expanding the range from 640 pixels to 1920 pixels from the center to four directions, taking the expanded coordinates as cutting coordinates to cut the original image, converting the coordinates of the labeled rectangular frame in the cutting range into the coordinates of the labeled rectangular frame after cutting, storing the coordinate information into an xml file, and obtaining a new cut image and an xml label file corresponding to the new cut image, wherein the name prefix is the same as the name prefix of the cut image.
The third concrete example:
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 the xml label file (c, xmin, ymin, xmax, ymax) into a coco format (c, x, y, w, h), wherein the c labeled by the xml is the category information, the xmin is the minimum value of an x coordinate, the ymin is the minimum value of a y coordinate, the xmax is the maximum value of the x coordinate, and the ymax is the maximum value of the y coordinate; the coco format labels c are category information, x, y are center point relative coordinates, and w, h are relative width and height.
The fourth concrete example:
the difference between the fourth embodiment and the third embodiment is only that:
the input size in the step 6 is adjusted to 1280x1280 when the training is carried out by putting the training medium into a yolov7 network.
The fifth concrete embodiment:
the difference between the fifth embodiment and the fourth embodiment is only that:
the step 9 specifically comprises:
the method includes the steps that a window size is 1280x1280, an input large-size image is cut into a small image with the size of 1280x1280 in a circulating mode in a sliding window mode with a certain step length, the small image is input into a network, and target detection results c, x, y, w, h, conf, types, x, y, w, h and confidence coefficients of the small image and xmin, ymin, xmax and ymax coordinates of a detection frame relative to the small image are obtained through 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 detection frame corresponding to the large graph are as follows:
xmin=xmin+x_i
ymin=ymin+y_i
xmax=xmax+x_i
ymax=ymax+y_i
and mapping the detection result coordinates back to the input large graph.
The sixth specific embodiment:
the difference between the sixth embodiment and the fifth embodiment is only that:
the step size is set to 640.
The seventh specific embodiment:
the seventh embodiment of the present application differs from the sixth embodiment only in that:
the invention provides a surface defect detection system based on an engine cylinder body and a cylinder cover with ultrahigh resolution, which comprises:
the marking module is used for marking the image data set on the surface of the cylinder cover of the engine cylinder body by a rectangular frame to obtain marking data;
the traversal module traverses the labeled data, randomly expands the labeled data, and cuts the original image by taking the expanded coordinates as cutting coordinates to obtain a cut image and labeled data corresponding to the cut image;
the repeating module is used for repeatedly marking and traversing to obtain a large number of cut pictures and marking data corresponding to the cut pictures;
the conversion module is used for converting the marking data to obtain converted data;
the network training module divides a training set and a verification set by adopting a random shuffling mode based on the converted data, and puts the training set and the verification set into a yolov7 network for training to obtain trained data;
a prediction module that: circularly inputting the trained data by adopting a sliding window and mapping the trained data back to the coordinates of the original image to obtain a prediction result;
and the screening module is used for filtering and screening all the prediction results on the original image coordinates again by adopting DIOU-NMS.
The eighth embodiment:
the eighth embodiment of the present application differs from the seventh embodiment only in that:
and shooting the surface image of the cylinder body and the cylinder cover by adopting a high-resolution industrial camera.
The specific embodiment is nine:
the difference between the ninth embodiment and the eighth embodiment is only 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, an ultra-high resolution engine block-based cylinder head surface defect detection method.
The method comprises the following steps:
step 1: the method comprises the steps of adjusting exposure by using 2000 ten thousand pixel industrial cameras and a plane light source to enable a shot defect pixel threshold value to be obviously distinguished from the surface of a processing surface, and shooting and collecting images of a cylinder body and a cylinder cover of a plurality of engine cylinders to serve as training data.
Step 2: carrying out rectangular frame marking on an image data set of a cylinder body and a cylinder cover of an engine cylinder to obtain marked data;
and step 3: traversing the annotation data and the picture, randomly expanding the annotation data and the picture to the length and width of 640-1920 pixels, and cutting the original picture by using the expanded coordinate as a cutting coordinate to obtain the cut picture and the corresponding annotation data;
and 4, step 4: repeating the steps 2 to 3 to obtain a large number of the cut pictures and the corresponding labeled data;
and 5: converting the marked data to obtain converted data;
and 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 the training is converged, and taking the weight file which is best represented on the verification set as a training result;
and 7: json file is constructed according to the shooting position and the corresponding camera number, and the content is the rectangular coordinate of the region of interest. The format is shown in fig. 2.
And step 8: and judging the picture name according to the ROI file, clipping the input image according to the ROI coordinates, and recording clipped xmin and ymin coordinates.
And step 9: circularly inputting the cut image by adopting a sliding window and mapping the image back to the coordinates of the original image to obtain a prediction result;
step 10: and adopting DIOU-NMS to filter and screen all the prediction results on the original image coordinates again.
The specific embodiment ten:
the difference between the tenth embodiment and the ninth embodiment is only 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 defects on the surface of a cylinder cover of an engine cylinder based on ultrahigh resolution when executing the computer program.
The method comprises the following steps:
step 1: the method comprises the steps of adjusting exposure by using 2000 ten thousand pixel industrial cameras and a plane light source to enable a shot defect pixel threshold value to be obviously distinguished from the surface of a processing surface, and shooting and collecting images of a cylinder body and a cylinder cover of a plurality of engine cylinders to serve as training data.
Step 2: carrying out rectangular frame marking on an image data set of a cylinder body and a cylinder cover of an engine cylinder to obtain marked data;
and 3, step 3: traversing the labeled data and the picture, randomly expanding the labeled data and the picture to have the length and the width of 640-1920 pixels, and cutting the original picture by taking the expanded coordinate as a cutting coordinate to obtain the cut picture and the labeled data corresponding to the cut picture;
and 4, step 4: repeating the step 2 to the step 3 to obtain a large number of cut pictures and corresponding labeled data;
and 5: converting the marked data to obtain converted data;
and 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 the training is converged, and taking the weight file which is best represented on the verification set as a training result;
and 7: json file is constructed according to the shooting position and the corresponding camera number, and the content is the rectangular coordinate of the region of interest. The format is shown in fig. 2.
And step 8: and judging the picture name according to the ROI file, clipping the input image according to the ROI coordinates, and recording clipped xmin and ymin coordinates.
And step 9: circularly inputting the clipped image by adopting a sliding window and mapping the image back to the original image coordinate to obtain a prediction result;
step 10: and adopting DIOU-NMS to filter and screen all the prediction results on the original image coordinates again.
The first specific embodiment:
the eleventh embodiment of the present application differs from the tenth embodiment only in that:
(1) Using labellimg software to perform original rectangular frame labeling on the data set to obtain an xml labeling file;
(2) Traversing all the rectangular frame mark information, taking the center of the marked rectangular frame as the center, randomly expanding the range from the center to four directions to be 640-1920 pixels, cutting the original image by taking the expanded coordinates as cutting coordinates, converting the coordinates of the marked rectangular frame in the cutting range into the coordinates of the marked rectangular frame after cutting, and storing the coordinate information as an xml file, wherein the name prefix is the same as the name prefix of the cut picture. Thus obtaining a new cut picture and an xml markup file corresponding to the new cut picture;
(3) Repeating the step 2 to the step 3 for 2 times to form a large number of pictures and corresponding xml labeling data;
(4) Converting the format of xml label (c, xmin, ymin, xmax) into the format of coco (c, x, y, w, h), wherein c of xml label is the category information, xmin is the minimum value of x coordinate, ymin is the minimum value of y coordinate, xmax is the maximum value of x coordinate, and ymax is the maximum value of y coordinate. c marked in the coco format is category information, x and y are relative coordinates of a central point, and w and h are relative width and height;
(5) Dividing a training set and a verification set by using a random shuffling mode;
(6) Putting the obtained product into a yolov7 network for training, and adjusting the input size to 1280x1280;
(7) The overall prediction adopts a sliding window mode with the window size of 1280x1280 (win for short) and the step length of 640 to circularly cut the input large-size image into a small image with the size of 1280x1280 and coordinates x _ i and y _ i of the upper left corner point corresponding to the window. When the small graph is input into the network to obtain the target detection result c, x, y, w, h, conf (category, x, y, w, h, confidence) of the small graph, the xmin, ymin, xmax, ymax coordinates of the detection box relative to the small graph are:
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 detection frame corresponding to the big picture are as follows:
xmin=xmin+x_i
ymin=ymin+y_i
xmax=xmax+x_i
ymax=ymax+y_i
this maps all the detection result coordinates back onto the input large map.
(8) All predicted results were filtered again on the large graph by DIOU-NMS.
The invention discloses a YOLOV7 algorithm-based multi-scale detection method for small target defects on a cylinder cover processing surface of an engine cylinder body. The method is used for carrying out multi-scale construction on a data set on the premise of high-resolution industrial camera shooting and on the basis of YOLOV 7. And during training, training by using a small graph, and during prediction, predicting by using a sliding window. Finally, the requirement for accurately detecting the defects of the machined surface of the cylinder body and the cylinder cover is met under the condition that the time consumption of the part is increased.
The specific example twelve:
the twelfth embodiment of the present application differs from the eleventh embodiment only in that:
a scheme of a small target defect multi-scale detection method for a cylinder head processing surface of an engine cylinder body based on a YOLOV7 algorithm comprises the following steps:
(1) Shooting by using an industrial camera;
(2) Performing frame selection and labeling on the shot picture by using labellimg;
(3) Carrying out multi-scale clipping processing on the original image and the label;
(4) Carrying out 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 yolov7 network;
(7) The forward network is modified into a sliding window for cycle input and is mapped back to the original image coordinates;
(8) Filtering and screening all predicted results again through DIOU-NMS;
in the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean 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 invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer 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. Moreover, various embodiments or examples and features of various embodiments or examples described in this specification can be combined and combined by one skilled in the art without being mutually inconsistent. Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or to implicitly indicate the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "N" means at least two, e.g., two, three, etc., unless specifically limited 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 steps of a custom logic function or process, and alternate 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 implementing the embodiments of the present invention. The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement 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 diskette (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). Further, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can 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 should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above 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. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are well known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
The above is only a preferred embodiment of the method for detecting the surface defect of the cylinder head and the cylinder block of the engine based on the ultrahigh resolution, and the protection range of the method for detecting the surface defect of the cylinder head and the cylinder block of the engine based on the ultrahigh resolution is not limited to the above embodiments, and all technical solutions belonging to the idea belong to the protection range of the present invention. It should be noted that modifications and variations that do not depart from the gist of the invention are intended to be within the scope of the invention.
Claims (10)
1. A surface defect detection method based on an engine cylinder body and a cylinder cover with ultrahigh resolution is characterized by comprising the following steps: the method comprises the following steps:
step 1: carrying out rectangular frame labeling on the image data set on the surface of the cylinder cover of the engine cylinder body to obtain labeled data;
step 2: traversing the labeled data, randomly expanding the labeled data, and cutting the original image by using the expanded coordinates as cutting coordinates to obtain a cut image and labeled data corresponding to the cut image;
and step 3: repeating the steps 2 to 3 to obtain a large number of the cut pictures and the corresponding labeled data;
and 4, step 4: converting the marked data to obtain converted data;
and 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;
and 6: circularly inputting the trained data by adopting a sliding window and mapping the data back to the original image coordinates to obtain a prediction result;
and 7: and adopting DIOU-NMS to filter and screen all the prediction results on the original image coordinates again.
2. The method for detecting the surface defects of the cylinder body and the cylinder cover of the engine based on the ultrahigh resolution as claimed in 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 label data, taking the center of the labeled rectangular frame as the center, randomly expanding the range from 640 pixels to 1920 pixels from the center to four directions, taking the expanded coordinates as cutting coordinates to cut the original image, converting the coordinates of the labeled rectangular frame in the cutting range into the coordinates of the labeled rectangular frame after cutting, storing the coordinate information into an xml file, and obtaining a new cut image and an xml label file corresponding to the new cut image, wherein the name prefix is the same as the name prefix of the cut image.
3. The method for detecting the surface defects of the cylinder block and the cylinder cover of the engine based on the ultrahigh resolution as claimed in claim 2, wherein the method comprises the following steps: the step 4 specifically comprises the following steps:
converting the format of the xml label file (c, xmin, ymin, xmax, ymax) into a coco format (c, x, y, w, h), wherein the format of the xml label file (c) is the category information, xmin is the minimum value of an x coordinate, ymin is the minimum value of a y coordinate, xmax is the maximum value of the x coordinate, and ymax is the maximum value of the y coordinate; the coco format labels c are category information, x, y are center point relative coordinates, and w, h are relative width and height.
4. The method for detecting the surface defects of the cylinder cover and the cylinder block of the engine based on the ultrahigh resolution as claimed in claim 3, wherein the method comprises the following steps: the input size is adjusted to 1280x1280 when the training is performed by putting the training medium in the yolov7 network in the step 5.
5. The method for detecting the surface defects of the cylinder cover and the cylinder block of the engine based on the ultrahigh resolution as claimed in claim 4, wherein the method comprises the following steps: the step 6 specifically comprises the following steps:
the method includes the steps that a window size is 1280x1280, an input large-size image is cut into a small image with the size of 1280x1280 in a circulating mode in a sliding window mode with a certain step length, the small image is input into a network, and target detection results c, x, y, w, h, conf, types, x, y, w, h and confidence coefficients of the small image and xmin, ymin, xmax and ymax coordinates of a detection frame relative to the small image are obtained through 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 detection frame corresponding to the big picture are as follows:
xmin=xmin+x_i
ymin=ymin+y_i
xmax=xmax+x_i
ymax=ymax+y_i
and mapping the detection result coordinates back to the input large graph.
6. The method for detecting the surface defects of the cylinder body and the cylinder cover of the engine based on the ultrahigh resolution as claimed in claim 5, wherein the method comprises the following steps: the step size is set to 640.
7. A surface defect detection system based on an engine cylinder body and a cylinder cover with ultrahigh resolution is characterized in that: the system comprises:
the marking module is used for marking the image data set on the surface of the cylinder cover of the engine cylinder body by a rectangular frame to obtain marking data;
the traversal module traverses the labeled data, randomly expands the labeled data, and cuts the original image by taking the expanded coordinates as cutting coordinates to obtain a cut image and labeled data corresponding to the cut image;
the repeating module is used for repeatedly marking and traversing to obtain a large number of cut pictures and marking data corresponding to the cut pictures;
the conversion module is used for converting the labeling data to obtain converted data;
the network training module divides a training set and a verification set by adopting a random shuffling mode based on the converted data, and puts the training set and the verification set into a yolov7 network for training to obtain trained data;
a prediction module that: circularly inputting the trained data by adopting a sliding window and mapping the data back to the original image coordinates to obtain a prediction result;
and the screening module is used for filtering and screening all the prediction results on the original image coordinates again by adopting DIOU-NMS.
8. The system for detecting the surface defects of the cylinder cover and the cylinder block of the engine based on the ultrahigh resolution as claimed in claim 7, wherein: and shooting the surface image of the cylinder body and the cylinder cover by adopting a high-resolution industrial camera.
9. A computer readable storage medium having stored thereon a computer program for execution by a processor for implementing an ultra high resolution engine block-based cylinder head surface defect detection method according to any one of claims 1 to 6.
10. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that: the processor realizes the method for detecting the surface defects of the cylinder cover and the cylinder block of the engine based on the ultrahigh resolution according to any one of claims 1 to 6 when executing the computer program.
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 true CN115965582A (en) | 2023-04-14 |
CN115965582B 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 (13)
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 |
CN113850799A (en) * | 2021-10-14 | 2021-12-28 | 长春工业大学 | YOLOv 5-based trace DNA extraction workstation workpiece detection method |
CN113850324A (en) * | 2021-09-24 | 2021-12-28 | 郑州大学 | Multispectral target detection method based on Yolov4 |
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 |
US20220207693A1 (en) * | 2020-12-31 | 2022-06-30 | Infrastructure Dl, Llc | Systems, Methods and Apparatuses for Detecting Defects in Underground Infrastructure Systems |
-
2022
- 2022-11-22 CN CN202211473914.0A patent/CN115965582B/en active Active
Patent Citations (13)
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 |
US20220207693A1 (en) * | 2020-12-31 | 2022-06-30 | Infrastructure Dl, Llc | Systems, Methods and Apparatuses for Detecting Defects in Underground Infrastructure Systems |
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 |
---|
吴涛: "基于深度学习的铁路接触网开口销状态检测方法研究", 中国优秀硕士学位论文全文数据库工程科技Ⅱ辑, no. 3, 15 March 2021 (2021-03-15), pages 033 - 117 * |
常思远;: "基于yolo的上课状态检测方法", 许昌学院学报, no. 05, 30 September 2020 (2020-09-30), pages 134 - 138 * |
Also Published As
Publication number | Publication date |
---|---|
CN115965582B (en) | 2024-03-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109978839B (en) | Method for detecting wafer low-texture defects | |
CN110796048B (en) | Ship target real-time detection method based on deep neural network | |
CN110378308B (en) | Improved port SAR image near-shore ship detection method based on fast R-CNN | |
DE112011103690T5 (en) | Detection and tracking of moving objects | |
CN108830149B (en) | Target bacterium detection method and terminal equipment | |
CN110807775A (en) | Traditional Chinese medicine tongue image segmentation device and method based on artificial intelligence and storage medium | |
CN109977997A (en) | Image object detection and dividing method based on convolutional neural networks fast robust | |
CN111339902B (en) | Liquid crystal display indication recognition method and device for digital display instrument | |
CN111415364B (en) | Conversion method, system and storage medium for image segmentation sample in computer vision | |
CN110288612B (en) | Nameplate positioning and correcting method and device | |
CN118314054B (en) | Image enhancement method based on forest grass wet map spots | |
CN114037693A (en) | Rock hole-fracture and impurity characteristic evaluation method based on deep learning | |
CN111724354A (en) | Image processing-based method for measuring spike length and small spike number of multiple wheat | |
CN116740528A (en) | Shadow feature-based side-scan sonar image target detection method and system | |
CN117671529A (en) | Unmanned aerial vehicle scanning measurement-based farmland water level observation device and observation method | |
CN115965582A (en) | Ultrahigh-resolution-based engine cylinder body and cylinder cover surface defect detection method | |
CN114419037B (en) | Workpiece defect detection method and device | |
CN116452977A (en) | Unmanned ship platform sea surface ship detection method, system and equipment | |
CN116129320A (en) | Target detection method, system and equipment based on video SAR | |
CN115861220A (en) | Cold-rolled strip steel surface defect detection method and system based on improved SSD algorithm | |
CN115330705A (en) | Skin paint surface defect detection method based on adaptive weighting template NCC | |
CN112528982A (en) | Method, device and system for detecting water gauge line of ship | |
CN117437654B (en) | Semantic recognition-based grid map analysis method, device and medium | |
CN116993803B (en) | Landslide deformation monitoring method and device and electronic equipment | |
CN116797777A (en) | Target detection method and system for underwater in-situ image |
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 |