CN112926584B - Crack detection method and device, computer equipment and storage medium - Google Patents
Crack detection method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN112926584B CN112926584B CN202110508657.9A CN202110508657A CN112926584B CN 112926584 B CN112926584 B CN 112926584B CN 202110508657 A CN202110508657 A CN 202110508657A CN 112926584 B CN112926584 B CN 112926584B
- Authority
- CN
- China
- Prior art keywords
- crack
- loss function
- crack detection
- image
- detection model
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/25—Determination of region of interest [ROI] or a volume of interest [VOI]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Data Mining & Analysis (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Computational Biology (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Multimedia (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The invention provides a crack detection method, a crack detection device, computer equipment and a storage medium, wherein the method comprises the steps of constructing an initial Yolov5 crack detection model; acquiring a crack training set, wherein the crack training set comprises a crack image and a crack label, and the crack label comprises a labeling frame, real position information of the labeling frame and real category information of the labeling frame; inputting the crack image into the initial Yolov5 crack detection model for training to obtain a trained target crack detection model; acquiring a crack image to be detected, inputting the crack image to be detected into the target crack detection model for detection, and outputting crack detection information; wherein the loss function of the initial fracture detection model is a weighted sum of a classification loss function, a target loss function, a regression loss function, and an offset angle loss function. The invention improves the anti-interference capability of the crack detection method, thereby improving the accuracy of the crack detection method.
Description
Technical Field
The invention relates to the technical field of crack detection, in particular to a crack detection method, a crack detection device, computer equipment and a storage medium.
Background
With the rapid development of national economy and the acceleration of urbanization process, various large concrete structure buildings are rapidly increased like bamboo shoots in spring after rain, and on the other hand, various large concrete structures in cities have actual use requirements of large use load capacity and high safety requirements. Regular concrete structure defect detection can provide effective maintenance data for related maintenance departments, so that the safety of the building during the use period is guaranteed, and the maintenance efficiency of the building is improved.
However, most of the crack detection work of domestic concrete buildings is based on a manual operation method, which inevitably brings about extremely heavy and dangerous manual labor and inevitably introduces errors of subjective judgment. Later, a crack detection method based on a traditional computer vision method appears, but because the area of a crack image in a training image is small, the characteristics are not obvious, and the influence of background textures on a general method is large, the existing crack detection method based on the traditional computer vision method has the technical problems of weak noise resistance and low detection accuracy.
Disclosure of Invention
The invention provides a crack detection method, a crack detection device, computer equipment and a storage medium, and aims to solve the technical problems of weak noise resistance and low detection accuracy in the prior art.
In one aspect, the present invention provides a crack detection method, including: constructing an initial Yolov5 crack detection model;
acquiring a crack training set, wherein the crack training set comprises a crack image and a crack label, and the crack label comprises a labeling frame, real position information of the labeling frame and real category information of the labeling frame;
inputting the crack image into the initial Yolov5 crack detection model for training to obtain a trained target crack detection model;
acquiring a crack image to be detected, inputting the crack image to be detected into the target crack detection model for detection, and outputting crack detection information;
wherein the loss function of the initial crack detection model is a weighted sum of a classification loss function, a target loss function, a regression loss function and an offset angle loss function;
wherein the content of the first and second substances,a weight coefficient that is the classification loss function;a weight coefficient that is the objective loss function;weight coefficients for the regression loss function;a weight coefficient that is the offset angle loss function;is the classification loss function;is the target loss function;is the regression loss function;is the offset angle loss function.
In a possible implementation manner of the present invention, the initial yoloov 5 crack detection model obtains a plurality of prediction boxes after training; the classification loss functionComprises the following steps:
wherein the content of the first and second substances,predicted position information for the prediction box;the real position information of the marking frame is obtained;the number of the prediction boxes.
In one possible implementation of the invention, the objective loss functionComprises the following steps:
wherein the content of the first and second substances,as a Sigmoid function, can beThe interval mapped to (0, 1).
In a possible implementation manner of the present invention, the shapes of the prediction box and the labeling box are both ellipses, and the regression loss functionComprises the following steps:
wherein,The number of the categories in the crack image to be detected is the number of the categories in the crack image to be detected;the existing category total number;is a mark function;the central abscissa of the prediction box is a value obtained after Sigmoid transformation;the central longitudinal coordinate of the prediction frame is a value obtained after Sigmoid transformation;the length of the long axis of the prediction box is subjected to Sigmoid transformation;the short axis length of the prediction frame is a value obtained after Sigmoid transformation;the central abscissa of the labeling frame is a value obtained after Sigmoid transformation;the central longitudinal coordinate of the labeling frame is a value obtained after Sigmoid transformation;the length of the short axis of the labeling frame is a value obtained after Sigmoid transformation;is the markAnd (4) the long axis length of the note box is the value after Sigmoid transformation.
In a possible implementation of the invention, the offset angle loss functionComprises the following steps:
wherein the content of the first and second substances,is a deflection angle coefficient;is the deflection angle of the prediction box;and the deflection angle of the marking frame.
In one possible implementation of the present invention, the initial yoloov 5 fracture detection model includes initial training weights; inputting the crack image into the initial YOLOV5 crack detection model for training, and obtaining a trained target crack detection model comprises:
inputting the crack image into the initial Yolov5 crack detection model, and performing data enhancement processing and adaptive scaling processing on the crack image to obtain a pre-processed crack image;
carrying out slicing and convolution operations on the preprocessed crack image to obtain a characteristic picture;
generating the prediction frame, the detection category and the category confidence according to the characteristic picture;
and calculating the loss value according to the prediction frame, the labeling frame and the loss function, and if the loss value is greater than a preset loss value, adjusting the initial training weight until the loss value is less than or equal to the preset loss value to obtain the target crack detection model.
In another aspect, the present invention provides a crack detection device, including:
the initial model building unit is used for building an initial Yolov5 crack detection model;
the crack training set comprises a crack image and a crack label, wherein the crack label comprises a labeling frame, real position information of the labeling frame and real category information of the labeling frame;
the model training unit is used for inputting the crack images into the initial Yoloov 5 crack detection model for training to obtain a trained target crack detection model;
the detection unit is used for acquiring an image of the crack to be detected, inputting the image of the crack to be detected into the target crack detection model for detection, and outputting crack detection information;
wherein the loss function of the initial fracture detection model is a weighted sum of a classification loss function, a target loss function, a regression loss function, and an offset angle loss function.
In another aspect, the present invention also provides a computer device, including:
one or more processors;
a memory; and
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the crack detection method of any of the above.
In another aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, the computer program being loaded by a processor to perform the steps of any of the above-mentioned crack detection methods.
According to the method, the loss function of the initial crack detection model is set as the weighted sum of the classification loss function, the target loss function, the regression loss function and the offset angle loss function, so that the anti-interference capability of the crack detection method is improved, and the accuracy of the crack detection method is further improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic view of a crack detection system according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of an embodiment of a crack detection method provided by an embodiment of the invention;
fig. 3 is a schematic flowchart of an embodiment of S203 according to the present invention;
FIG. 4 is a schematic structural diagram of an embodiment of a crack detection device provided in the embodiments of the present invention;
fig. 5 is a flowchart illustrating an embodiment of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The invention provides a crack detection method, a crack detection device, computer equipment and storage equipment, which are respectively described in detail below.
Fig. 1 is a schematic view of a crack detection system according to an embodiment of the present invention, where the crack detection system may include a server 100, and a crack detection device is integrated in the server 100.
The server 100 in the embodiment of the present invention is mainly used for:
constructing an initial Yolov5 crack detection model;
acquiring a crack training set, wherein the crack training set comprises a crack image and a crack label, and the crack label comprises a labeling frame, real position information of the labeling frame and real category information of the labeling frame;
inputting the crack image into the initial Yolov5 crack detection model for training to obtain a trained target crack detection model;
acquiring a crack image to be detected, inputting the crack image to be detected into the target crack detection model for detection, and outputting crack detection information;
wherein the loss function of the initial fracture detection model is a weighted sum of a classification loss function, a target loss function, a regression loss function, and an offset angle loss function.
In this embodiment of the present invention, the server 100 may be an independent server, or may be a server network or a server cluster composed of servers, for example, the server 100 described in this embodiment of the present invention includes, but is not limited to, a computer, a network host, a single network server, a plurality of network server sets, or a cloud server composed of a plurality of servers. Among them, the Cloud server is constituted by a large number of computers or web servers based on Cloud Computing (Cloud Computing).
It is to be understood that the terminal 200 used in the embodiments of the present invention may be a device that includes both receiving and transmitting hardware, i.e., a device having receiving and transmitting hardware capable of performing two-way communication over a two-way communication link. Such a device may include: a cellular or other communication device having a single line display or a multi-line display or a cellular or other communication device without a multi-line display. The specific terminal 200 may be a desktop, a laptop, a web server, a Personal Digital Assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device, an embedded device, and the like, and the type of the terminal 200 is not limited in this embodiment.
Those skilled in the art will understand that the application environment shown in fig. 1 is only one application scenario of the present invention, and does not constitute a limitation on the application scenario of the present invention, and that other application environments may further include more or fewer terminals than those shown in fig. 1, for example, only 2 terminals are shown in fig. 1, and it is understood that the crack detection system may further include one or more other terminals, which is not limited herein.
In addition, as shown in fig. 1, the crack detection system may further include a memory 200 for storing data, such as an effective cyclic shift number, a base array, and the like.
It should be noted that the scene schematic diagram of the crack detection system shown in fig. 1 is only an example, and the crack detection system and the scene described in the embodiment of the present invention are for more clearly illustrating the technical solution of the embodiment of the present invention, and do not form a limitation on the technical solution provided in the embodiment of the present invention.
First, an embodiment of the present invention provides a crack detection method, where the crack detection method includes: constructing an initial Yolov5 crack detection model; acquiring a crack training set, wherein the crack training set comprises a crack image and a crack label, and the crack label comprises a labeling frame, real position information of the labeling frame and real category information of the labeling frame; inputting the crack image into the initial Yolov5 crack detection model for training to obtain a trained target crack detection model; acquiring a crack image to be detected, inputting the crack image to be detected into the target crack detection model for detection, and outputting crack detection information; wherein the loss function of the initial fracture detection model is a weighted sum of a classification loss function, a target loss function, a regression loss function, and an offset angle loss function.
As shown in fig. 2, a schematic flow chart of an embodiment of a crack detection method provided in an embodiment of the present invention is shown, where the method includes:
s201, constructing an initial YOLOV5 crack detection model;
wherein, the accuracy of crack detection can be improved by establishing an initial YOLOV5 crack detection model based on YOLOV5, because: the YOLOV5 is suitable for large-resolution images such as remote sensing images or unmanned aerial vehicle images, does not need to consider real-time detection of small targets, and is very suitable for the detection content of concrete building surface defects (cracks) and the sampling mode; moreover, the Yolov5 adopts a mode of inputting the segmented small graph into the target detection network, so that the lower limit of the minimum target pixel is greatly reduced, and the technical effect of increasing the crack detection accuracy is realized.
S202, acquiring a crack training set, wherein the crack training set comprises a crack image and a crack label, and the crack label comprises a labeling frame, the real position information of the labeling frame and the real category information of the labeling frame;
the format of the crack label is XML or JSON format; the labeling box is a frame that covers each class of objects in the fracture image.
S203, inputting the crack image into an initial Yolov5 crack detection model for training to obtain a trained target crack detection model;
s204, acquiring an image of the crack to be detected, inputting the image of the crack to be detected into a target crack detection model for detection, and outputting crack detection information;
the loss function of the initial crack detection model is a weighted sum of a classification loss function, a target loss function, a regression loss function and an offset angle loss function.
According to the crack detection method provided by the embodiment of the invention, the loss function of the initial crack detection model is set as the weighted sum of the classification loss function, the target loss function, the regression loss function and the offset angle loss function, so that the anti-interference capability of the crack detection method is improved, and the accuracy of the crack detection method is further improved.
wherein the content of the first and second substances,a weight coefficient that is the classification loss function;a weight coefficient that is the objective loss function;weight coefficients for the regression loss function;a weight coefficient that is the offset angle loss function;is the classification loss function;is the target loss function;is the regression loss function;is the offset angle loss function.
Further, the initial YOLOV5 crack detection model obtains multiple prediction boxes after training; the classification loss functionComprises the following steps:
wherein the content of the first and second substances,predicted position information for the prediction box;the real position information of the marking frame is obtained;the number of the prediction boxes.
wherein the content of the first and second substances,is Sigmoid function, can beThe interval mapped to (0, 1).
Further, in some embodiments of the invention, the prediction box and the labeling box are both elliptical in shape, and the regression loss function isComprises the following steps:
wherein the content of the first and second substances,the number of the categories in the crack image to be detected is the number of the categories in the crack image to be detected;the existing category total number;is a mark function;the central abscissa of the prediction box is a value obtained after Sigmoid transformation;the central longitudinal coordinate of the prediction frame is a value obtained after Sigmoid transformation;the length of the long axis of the prediction box is subjected to Sigmoid transformation;the short axis length of the prediction frame is a value obtained after Sigmoid transformation;the central abscissa of the labeling frame is a value obtained after Sigmoid transformation;the central longitudinal coordinate of the labeling frame is a value obtained after Sigmoid transformation;the length of the short axis of the labeling frame is a value obtained after Sigmoid transformation;and the length of the long axis of the labeling frame is the value after Sigmoid transformation.
The shapes of the prediction frame and the marking frame are elliptical, so that the prediction frame and the marking frame are closer to the line form of the crack, and the accuracy of crack detection is improved.
wherein the content of the first and second substances,is a deflection angle coefficient;is the deflection angle of the prediction box;and the deflection angle of the marking frame.
Since the crack behavior attribute has a large influence on crack detection, a loss function is provided for the offset angle alone to improve the recognition accuracy. Specifically, the method comprises the following steps: when the predicted value is close to the actual value by using the cosine function, the loss function loss approaches to 0 and is multiplied by the coefficientkThe influence of the deflection angle is adjusted because the prediction result is directly influenced by whether the trend of the crack is correct or not, and even if the major axis, the minor axis and the central point of the prediction result are similar to the crack image, if the deflection angle deviation is large, the deviation is actually large, so that the coefficient is setkThe influence of the deflection angle is adjusted to improve the accuracy of crack detection. Since the derivative of the loss function must be positive and gradually decreases as the predicted value approaches the actual value, a form of cosine function is adopted as the offset angle loss function.
Further, the initial YOLOV5 fracture inspection model includes initial training weights, as shown in fig. 3, S203 includes:
s301, inputting the crack image into an initial YOLOV5 crack detection model, and performing data enhancement processing, adaptive prediction frame calculation and adaptive scaling processing on the crack image to obtain a preprocessed crack image;
specifically, the method comprises the following steps: the data enhancement processing on the crack image comprises the following steps: and carrying out treatment such as random recombination, random overturning, random zooming, random arrangement, random rotation, random adjustment on the brightness of the crack image and the like. The training samples in the crack training set can be increased by performing data enhancement processing on the crack images, and the crack training set is ensured to cover enough practical application environments as much as possible, so that the universality of the crack detection method is improved.
The self-adaptive scaling processing of the crack image comprises the following steps: when the sizes of the input crack images are different, the picture size is changed so that all the input crack images become a fixed size, and the gray part filled in when the image size is transformed is an adaptive proportional size. Through the arrangement, the reasoning speed of the target crack detection model can be accelerated.
S302, carrying out slicing and convolution operations on the preprocessed crack image to obtain a characteristic picture;
when the pre-processed fracture image is 608 × 3, slicing the pre-processed fracture image specifically includes: and slicing the preprocessed crack image to change the image into a feature picture of 304 × 304 × 12, and performing convolution operation of 32 convolution kernels to finally obtain the feature picture of 304 × 304 × 12. And then adding a CSP module structure, wherein the CSP module structure comprises a plurality of residual error components and a convolution layer, the CSP module structure solves the problem of large calculation amount in the estimation from the perspective of network structure design, and the learning capability of the initial YOLOV5 crack detection model is enhanced, so that the accuracy is kept while the weight is reduced, and the calculation bottleneck and the memory cost are reduced.
It should be understood that: since some targets are just segmented during the slicing process, in some embodiments of the present invention, an overlapping region is set between two feature pictures, so that the detection result of the detection method is more accurate.
Further, the subsequent Feature extraction network structure includes a Feature Pyramid Network (FPN) and a pan (path Aggregation network) network. The FPN is composed of two parts from top to bottom and from bottom to top. The top-down network is used for transmitting strong semantic features, and the bottom-up network is used for transmitting strong positioning features. And extracting the features through the network.
S303, generating a prediction frame, a detection category and a category confidence according to the feature picture;
specifically, convolution feature vectors in the feature picture are extracted, and the convolution feature vectors are used for generating a prediction frame, a detection category and a category confidence coefficient through a SoftMax activation layer.
S304, calculating a loss value according to the prediction frame, the labeling frame and the loss function, and if the loss value is larger than a preset loss value, adjusting the initial training weight until the loss value is smaller than or equal to the preset loss value to obtain a target crack detection model.
Further, in order to increase the convergence rate of the loss functionIn some embodiments of the present invention, the learning rate may also be adjusted during the training of the initial YOLOV5 crack detection model, where the initial learning rate is e-04Where e is a constant and e is equal to about 2.72.
On the other hand, in order to better implement the crack detection method in the embodiment of the present invention, on the basis of the crack detection method, correspondingly, as shown in fig. 4, an embodiment of the present invention further provides a crack detection apparatus, where the crack detection apparatus 400 includes:
an initial model building unit 410, configured to build an initial YOLOV5 fracture detection model;
a training set obtaining unit 420, configured to obtain a fracture training set, where the fracture training set includes a fracture image and a fracture label, and the fracture label includes a labeling frame, real position information of the labeling frame, and real category information of the labeling frame;
the model training unit 430 is configured to input the crack image into the initial YOLOV5 crack detection model for training, so as to obtain a trained target crack detection model;
the detection unit 440 is used for acquiring an image of the crack to be detected, inputting the image of the crack to be detected into the target crack detection model for detection, and outputting crack detection information;
the loss function of the initial crack detection model is a weighted sum of a classification loss function, a target loss function, a regression loss function and an offset angle loss function.
According to the embodiment of the invention, the loss function of the initial crack detection model is set as the weighted sum of the classification loss function, the target loss function, the regression loss function and the offset angle loss function, so that the anti-interference capability of the crack detection method is improved, and the accuracy of the crack detection method is further improved
Further, the model training unit 430 is specifically configured to: inputting the crack image into the initial Yoloov 5 crack detection model, and performing data enhancement processing and adaptive scaling processing on the crack image to obtain a preprocessed crack image; carrying out slicing and convolution operations on the preprocessed crack image to obtain a characteristic picture; generating a prediction frame, a detection category and a category confidence coefficient according to the characteristic picture; and calculating the loss value according to the prediction frame, the labeling frame and the loss function, and if the loss value is greater than the preset loss value, adjusting the initial training weight until the loss value is less than or equal to the preset loss value to obtain a target crack detection model.
The embodiment of the present invention further provides a computer device, which integrates any one of the crack detection apparatuses provided in the embodiment of the present invention, and the computer device includes:
one or more processors;
a memory; and
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor for performing the steps of the crack detection method described in any of the above embodiments of the crack detection method.
Fig. 5 is a schematic diagram showing a structure of a computer device according to an embodiment of the present invention, specifically:
the computer device may include components such as a processor 501 of one or more processing cores, memory 502 of one or more computer-readable storage media, a power supply 503, and an input unit 504. Those skilled in the art will appreciate that the computer device configuration illustrated in FIG. 5 does not constitute a limitation of computer devices, and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components. Wherein:
the processor 501 is a control center of the computer device, connects various parts of the entire computer device by using various interfaces and lines, and performs various functions of the computer device and processes data by running or executing software programs and/or modules stored in the memory 502 and calling data stored in the memory 502, thereby monitoring the computer device as a whole. Optionally, processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor, which mainly handles operating systems, operating user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 501.
The memory 502 may be used to store software programs and modules, and the processor 501 executes various functional applications and data processing by operating the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the computer device, and the like. Further, the memory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.
The computer device further comprises a power supply 503 for supplying power to the various components, and preferably, the power supply 503 may be logically connected to the processor 501 through a power management system, so that functions of managing charging, discharging, power consumption, and the like are realized through the power management system. The power supply 503 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The computer device may also include an input unit 504, where the input unit 504 may be used to receive entered numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to operating user settings and function controls.
Although not shown, the computer device may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 501 in the computer device loads the executable file corresponding to the process of one or more application programs into the memory 502 according to the following instructions, and the processor 501 runs the application programs stored in the memory 502, so as to implement various functions as follows:
acquiring a crack training set, wherein the crack training set comprises a crack image and a crack label, and the crack label comprises a labeling frame, real position information of the labeling frame and real category information of the labeling frame;
inputting the crack image into the initial Yolov5 crack detection model for training to obtain a trained target crack detection model;
acquiring a crack image to be detected, inputting the crack image to be detected into the target crack detection model for detection, and outputting crack detection information;
wherein the loss function of the initial fracture detection model is a weighted sum of a classification loss function, a target loss function, a regression loss function, and an offset angle loss function.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present invention provides a computer-readable storage medium, which may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like. Stored thereon, is a computer program that is loaded by a processor to perform the steps of any of the crack detection methods provided by the embodiments of the invention. For example, the computer program may be loaded by a processor to perform the steps of:
acquiring a crack training set, wherein the crack training set comprises a crack image and a crack label, and the crack label comprises a labeling frame, real position information of the labeling frame and real category information of the labeling frame;
inputting the crack image into the initial Yolov5 crack detection model for training to obtain a trained target crack detection model;
acquiring a crack image to be detected, inputting the crack image to be detected into the target crack detection model for detection, and outputting crack detection information;
wherein the loss function of the initial fracture detection model is a weighted sum of a classification loss function, a target loss function, a regression loss function, and an offset angle loss function.
In a specific implementation, each unit or structure may be implemented as an independent entity, or may be combined arbitrarily to be implemented as one or several entities, and the specific implementation of each unit or structure may refer to the foregoing method embodiment, which is not described herein again.
The crack detection method, the crack detection device, the computer device and the storage medium provided by the invention are described in detail, and the principle and the implementation mode of the invention are explained by applying specific examples, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (8)
1. A crack detection method, comprising:
constructing an initial Yolov5 crack detection model;
acquiring a crack training set, wherein the crack training set comprises a crack image and a crack label, and the crack label comprises a labeling frame, real position information of the labeling frame and real category information of the labeling frame;
inputting the crack image into the initial Yolov5 crack detection model for training to obtain a trained target crack detection model;
acquiring a crack image to be detected, inputting the crack image to be detected into the target crack detection model for detection, and outputting crack detection information;
wherein the loss function of the initial YOLOV5 fracture detection model is a weighted sum of a classification loss function, a target loss function, a regression loss function, and an offset angle loss function;
wherein the content of the first and second substances,a weight coefficient that is the classification loss function;a weight coefficient that is the objective loss function;weight coefficients for the regression loss function;a weight coefficient that is the offset angle loss function;is the classification loss function;is the target loss function;is the regression loss function;is the offset angle loss function;
the shapes of the prediction frame and the marking frame are both elliptical, and the regression loss functionComprises the following steps:
wherein the content of the first and second substances,the number of the categories in the crack image to be detected is the number of the categories in the crack image to be detected;the existing category total number;is a mark function;the central abscissa of the prediction box is a value obtained after Sigmoid transformation;the central longitudinal coordinate of the prediction frame is a value obtained after Sigmoid transformation;the length of the long axis of the prediction box is subjected to Sigmoid transformation;is a stand forThe short axis length of the prediction frame is subjected to Sigmoid transformation;the central abscissa of the labeling frame is a value obtained after Sigmoid transformation;the central longitudinal coordinate of the labeling frame is a value obtained after Sigmoid transformation;the length of the short axis of the labeling frame is a value obtained after Sigmoid transformation;and the length of the long axis of the labeling frame is the value after Sigmoid transformation.
2. The crack detection method of claim 1, wherein the initial YOLOV5 crack detection model obtains a plurality of prediction boxes after training; the classification loss functionComprises the following steps:
3. Crack detection method as claimed in claim 2, characterized in that the target loss functionComprises the following steps:
4. Crack detection method as claimed in claim 3, characterized in that the offset angle loss functionComprises the following steps:
5. The crack detection method of claim 4, wherein the initial YOLOV5 crack detection model comprises initial training weights; inputting the crack image into the initial YOLOV5 crack detection model for training, and obtaining a trained target crack detection model comprises:
inputting the crack image into the initial Yolov5 crack detection model, and performing data enhancement processing and adaptive scaling processing on the crack image to obtain a pre-processed crack image;
carrying out slicing and convolution operations on the preprocessed crack image to obtain a characteristic picture;
generating the prediction frame, the detection category and the category confidence according to the characteristic picture;
calculating a loss value according to the prediction frame, the labeling frame and the loss function, and if the loss value is greater than a preset loss value, adjusting the initial training weight until the loss value is less than or equal to the preset loss value to obtain the target crack detection model.
6. A crack detection device, comprising:
the initial model building unit is used for building an initial Yolov5 crack detection model;
the crack training set comprises a crack image and a crack label, wherein the crack label comprises a labeling frame, real position information of the labeling frame and real category information of the labeling frame;
the model training unit is used for inputting the crack images into the initial Yoloov 5 crack detection model for training to obtain a trained target crack detection model;
the detection unit is used for acquiring an image of the crack to be detected, inputting the image of the crack to be detected into the target crack detection model for detection, and outputting crack detection information;
wherein the loss function of the initial YOLOV5 fracture detection model is a weighted sum of a classification loss function, a target loss function, a regression loss function, and an offset angle loss function;
wherein the content of the first and second substances,a weight coefficient that is the classification loss function;a weight coefficient that is the objective loss function;weight coefficients for the regression loss function;a weight coefficient that is the offset angle loss function;is the classification loss function;is the target loss function;is the regression loss function;is the offset angle loss function;
the shapes of the prediction frame and the marking frame are both elliptical, and the regression loss functionComprises the following steps:
wherein the content of the first and second substances,the number of the categories in the crack image to be detected is the number of the categories in the crack image to be detected;the existing category total number;is a mark function;the central abscissa of the prediction box is a value obtained after Sigmoid transformation;the central longitudinal coordinate of the prediction frame is a value obtained after Sigmoid transformation;the length of the long axis of the prediction box is subjected to Sigmoid transformation;the short axis length of the prediction frame is a value obtained after Sigmoid transformation;the central abscissa of the labeling frame is a value obtained after Sigmoid transformation;the central longitudinal coordinate of the labeling frame is a value obtained after Sigmoid transformation;the length of the short axis of the labeling frame is a value obtained after Sigmoid transformation;and the length of the long axis of the labeling frame is the value after Sigmoid transformation.
7. A computer device, characterized in that the computer device comprises:
one or more processors;
a memory; and
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the crack detection method of any of claims 1-5.
8. A computer-readable storage medium, having a computer program stored thereon, where the computer program is loaded by a processor to perform the steps of the crack detection method as claimed in any of the claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110508657.9A CN112926584B (en) | 2021-05-11 | 2021-05-11 | Crack detection method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110508657.9A CN112926584B (en) | 2021-05-11 | 2021-05-11 | Crack detection method and device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112926584A CN112926584A (en) | 2021-06-08 |
CN112926584B true CN112926584B (en) | 2021-08-06 |
Family
ID=76174766
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110508657.9A Active CN112926584B (en) | 2021-05-11 | 2021-05-11 | Crack detection method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112926584B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113487570B (en) * | 2021-07-06 | 2024-01-30 | 东北大学 | High-temperature continuous casting billet surface defect detection method based on improved yolov5x network model |
CN113724219A (en) * | 2021-08-27 | 2021-11-30 | 重庆大学 | Building surface disease detection method and system based on convolutional neural network |
CN113780480B (en) * | 2021-11-11 | 2022-02-22 | 深圳佑驾创新科技有限公司 | Method for constructing multi-target detection and category identification model based on YOLOv5 |
CN116189132B (en) * | 2023-04-23 | 2023-09-29 | 深圳佑驾创新科技股份有限公司 | Training method for target detection model of road information, target detection method and device |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3407292A1 (en) * | 2017-05-24 | 2018-11-28 | General Electric Company | Neural network point cloud generation system |
CN110175658A (en) * | 2019-06-26 | 2019-08-27 | 浙江大学 | A kind of distress in concrete recognition methods based on YOLOv3 deep learning |
CN112001411A (en) * | 2020-07-10 | 2020-11-27 | 河海大学 | Dam crack detection algorithm based on FPN structure |
CN112149620A (en) * | 2020-10-14 | 2020-12-29 | 南昌慧亦臣科技有限公司 | Method for constructing natural scene character region detection model based on no anchor point |
CN112560852A (en) * | 2020-12-15 | 2021-03-26 | 三峡大学 | Single-stage target detection method with rotation adaptive capacity based on YOLOv3 network |
CN112560671A (en) * | 2020-12-15 | 2021-03-26 | 哈尔滨工程大学 | Ship detection method based on rotary convolution neural network |
CN112733944A (en) * | 2021-01-13 | 2021-04-30 | 中国传媒大学 | Target detection method, device and medium based on attention of images and categories |
-
2021
- 2021-05-11 CN CN202110508657.9A patent/CN112926584B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3407292A1 (en) * | 2017-05-24 | 2018-11-28 | General Electric Company | Neural network point cloud generation system |
CN110175658A (en) * | 2019-06-26 | 2019-08-27 | 浙江大学 | A kind of distress in concrete recognition methods based on YOLOv3 deep learning |
CN112001411A (en) * | 2020-07-10 | 2020-11-27 | 河海大学 | Dam crack detection algorithm based on FPN structure |
CN112149620A (en) * | 2020-10-14 | 2020-12-29 | 南昌慧亦臣科技有限公司 | Method for constructing natural scene character region detection model based on no anchor point |
CN112560852A (en) * | 2020-12-15 | 2021-03-26 | 三峡大学 | Single-stage target detection method with rotation adaptive capacity based on YOLOv3 network |
CN112560671A (en) * | 2020-12-15 | 2021-03-26 | 哈尔滨工程大学 | Ship detection method based on rotary convolution neural network |
CN112733944A (en) * | 2021-01-13 | 2021-04-30 | 中国传媒大学 | Target detection method, device and medium based on attention of images and categories |
Non-Patent Citations (1)
Title |
---|
基于 SS-YOLO 算法的管廊巡检机器人视觉检测技术研究与实现;吕灿;《中国优秀硕士学位论文全文数据库 工程科技II辑》;20210215;第5章,第3.2节 * |
Also Published As
Publication number | Publication date |
---|---|
CN112926584A (en) | 2021-06-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112926584B (en) | Crack detection method and device, computer equipment and storage medium | |
CN111639744B (en) | Training method and device for student model and electronic equipment | |
KR20190129947A (en) | Methods and apparatus for determining facial image quality, electronic devices and computer storage media | |
CN111126140A (en) | Text recognition method and device, electronic equipment and storage medium | |
CN113284142B (en) | Image detection method, image detection device, computer-readable storage medium and computer equipment | |
CN112132017B (en) | Image processing method and device and electronic equipment | |
CN111126389A (en) | Text detection method and device, electronic equipment and storage medium | |
US20220415038A1 (en) | Image detection method and apparatus, computer device, and computer-readable storage medium | |
WO2023160162A1 (en) | Method and apparatus for predicting collision simulation result, device and storage medium | |
CN109583367A (en) | Image text row detection method and device, storage medium and electronic equipment | |
CN112206541A (en) | Game plug-in identification method and device, storage medium and computer equipment | |
CN113838134B (en) | Image key point detection method, device, terminal and storage medium | |
CN113128526B (en) | Image recognition method and device, electronic equipment and computer-readable storage medium | |
CN111177811A (en) | Automatic fire point location layout method applied to cloud platform | |
CN115471439A (en) | Method and device for identifying defects of display panel, electronic equipment and storage medium | |
CN111476144B (en) | Pedestrian attribute identification model determining method and device and computer readable storage medium | |
CN113469025A (en) | Target detection method and device applied to vehicle-road cooperation, road side equipment and vehicle | |
CN114663511A (en) | Image generation method, device, equipment and storage medium | |
CN113537398A (en) | Color value evaluation model training method and component, and color value evaluation method and component | |
CN114549392A (en) | Method, device and equipment for detecting chromatic aberration of solar cell and computer medium | |
CN111027413A (en) | Remote multi-station object detection method, system and storage medium | |
CN116309538B (en) | Drawing examination evaluation method, device, computer equipment and storage medium | |
CN112070593B (en) | Data processing method, device, equipment and storage medium | |
CN116740369A (en) | Goods identification method and device | |
CN113139490B (en) | Image feature matching method and device, computer equipment and storage medium |
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 |