CN112926584A - Crack detection method and device, computer equipment and storage medium - Google Patents

Crack detection method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112926584A
CN112926584A CN202110508657.9A CN202110508657A CN112926584A CN 112926584 A CN112926584 A CN 112926584A CN 202110508657 A CN202110508657 A CN 202110508657A CN 112926584 A CN112926584 A CN 112926584A
Authority
CN
China
Prior art keywords
crack
loss function
crack detection
image
initial
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110508657.9A
Other languages
Chinese (zh)
Other versions
CN112926584B (en
Inventor
李明鹏
高鉴
刘意
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Jiaying Intelligent Technology Co ltd
Original Assignee
Wuhan Jiaying Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Jiaying Intelligent Technology Co ltd filed Critical Wuhan Jiaying Intelligent Technology Co ltd
Priority to CN202110508657.9A priority Critical patent/CN112926584B/en
Publication of CN112926584A publication Critical patent/CN112926584A/en
Application granted granted Critical
Publication of CN112926584B publication Critical patent/CN112926584B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection

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

Crack detection method and device, computer equipment and storage medium
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;
loss function
Figure 361833DEST_PATH_IMAGE001
Comprises the following steps:
Figure 600791DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure 97632DEST_PATH_IMAGE003
a weight coefficient that is the classification loss function;
Figure 607110DEST_PATH_IMAGE004
a weight coefficient that is the objective loss function;
Figure 531204DEST_PATH_IMAGE005
weight coefficients for the regression loss function;
Figure 24502DEST_PATH_IMAGE006
a weight coefficient that is the offset angle loss function;
Figure 856192DEST_PATH_IMAGE007
is the classification loss function;
Figure 361123DEST_PATH_IMAGE008
is the target loss function;
Figure 580752DEST_PATH_IMAGE009
is the regression loss function;
Figure 905554DEST_PATH_IMAGE010
is the offset angle loss function.
In the present inventionIn one possible implementation, the initial YOLOV5 crack detection model obtains a plurality of prediction boxes after training; the classification loss function
Figure 370295DEST_PATH_IMAGE011
Comprises the following steps:
Figure 260891DEST_PATH_IMAGE012
wherein the content of the first and second substances,
Figure 776055DEST_PATH_IMAGE013
predicted position information for the prediction box;
Figure 588153DEST_PATH_IMAGE014
the real position information of the marking frame is obtained;
Figure 588077DEST_PATH_IMAGE015
the number of the prediction boxes.
In one possible implementation of the invention, the objective loss function
Figure 67599DEST_PATH_IMAGE016
Comprises the following steps:
Figure 301135DEST_PATH_IMAGE017
wherein the content of the first and second substances,
Figure 725163DEST_PATH_IMAGE018
comprises the following steps:
Figure 905608DEST_PATH_IMAGE019
wherein the content of the first and second substances,
Figure 301955DEST_PATH_IMAGE020
as a Sigmoid function, can be
Figure 34287DEST_PATH_IMAGE021
The 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 function
Figure 148874DEST_PATH_IMAGE022
Comprises the following steps:
Figure 133010DEST_PATH_IMAGE023
wherein the content of the first and second substances,
Figure 541120DEST_PATH_IMAGE024
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;
Figure 54141DEST_PATH_IMAGE025
the existing category total number;
Figure 452761DEST_PATH_IMAGE026
is a mark function;
Figure 771747DEST_PATH_IMAGE027
the central abscissa of the prediction box is a value obtained after Sigmoid transformation;
Figure 80369DEST_PATH_IMAGE028
the central longitudinal coordinate of the prediction frame is a value obtained after Sigmoid transformation;
Figure 357767DEST_PATH_IMAGE029
the length of the long axis of the prediction box is subjected to Sigmoid transformation;
Figure 7797DEST_PATH_IMAGE030
the short axis length of the prediction frame is a value obtained after Sigmoid transformation;
Figure 68157DEST_PATH_IMAGE031
the central abscissa of the labeling frame is a value obtained after Sigmoid transformation;
Figure 621498DEST_PATH_IMAGE032
the central longitudinal coordinate of the labeling frame is a value obtained after Sigmoid transformation;
Figure 7480DEST_PATH_IMAGE033
the length of the short axis of the labeling frame is a value obtained after Sigmoid transformation;
Figure 380693DEST_PATH_IMAGE034
and the length of the long axis of the labeling frame is the value after Sigmoid transformation.
In a possible implementation of the invention, the offset angle loss function
Figure 979164DEST_PATH_IMAGE035
Comprises the following steps:
Figure 387012DEST_PATH_IMAGE036
wherein the content of the first and second substances,
Figure 475054DEST_PATH_IMAGE037
is a deflection angle coefficient;
Figure 210928DEST_PATH_IMAGE038
is the deflection angle of the prediction box;
Figure 504769DEST_PATH_IMAGE039
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.
Further, a loss function
Figure 970385DEST_PATH_IMAGE040
Comprises the following steps:
Figure 432591DEST_PATH_IMAGE041
wherein the content of the first and second substances,
Figure 452499DEST_PATH_IMAGE042
a weight coefficient that is the classification loss function;
Figure 48566DEST_PATH_IMAGE043
a weight coefficient that is the objective loss function;
Figure 40792DEST_PATH_IMAGE044
weight coefficients for the regression loss function;
Figure 798533DEST_PATH_IMAGE045
a weight coefficient that is the offset angle loss function;
Figure 509000DEST_PATH_IMAGE046
is the classification loss function;
Figure 141713DEST_PATH_IMAGE047
is the target loss function;
Figure 988446DEST_PATH_IMAGE048
is the regression loss function;
Figure 917088DEST_PATH_IMAGE049
is the offset angle loss function.
Further, the initial YOLOV5 crack detection model obtains multiple prediction boxes after training; the classification loss function
Figure 849272DEST_PATH_IMAGE050
Comprises the following steps:
Figure 459245DEST_PATH_IMAGE051
wherein the content of the first and second substances,
Figure 285119DEST_PATH_IMAGE052
predicted position information for the prediction box;
Figure 260028DEST_PATH_IMAGE053
the real position information of the marking frame is obtained;
Figure 804142DEST_PATH_IMAGE054
the number of the prediction boxes.
Further, an objective loss function
Figure 952226DEST_PATH_IMAGE055
Comprises the following steps:
Figure 602913DEST_PATH_IMAGE056
wherein the content of the first and second substances,
Figure 279882DEST_PATH_IMAGE057
comprises the following steps:
Figure 514554DEST_PATH_IMAGE058
wherein the content of the first and second substances,
Figure 794225DEST_PATH_IMAGE057
as a Sigmoid function, can be
Figure 470057DEST_PATH_IMAGE059
The 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 is
Figure 849086DEST_PATH_IMAGE060
Comprises the following steps:
Figure 102213DEST_PATH_IMAGE061
Figure 176390DEST_PATH_IMAGE062
wherein the content of the first and second substances,
Figure 972307DEST_PATH_IMAGE063
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;
Figure 584554DEST_PATH_IMAGE064
the existing category total number;
Figure 951076DEST_PATH_IMAGE065
is a mark function;
Figure 306971DEST_PATH_IMAGE066
the central abscissa of the prediction box is a value obtained after Sigmoid transformation;
Figure 285291DEST_PATH_IMAGE067
the central longitudinal coordinate of the prediction frame is a value obtained after Sigmoid transformation;
Figure 832554DEST_PATH_IMAGE068
the length of the long axis of the prediction box is subjected to Sigmoid transformation;
Figure 935639DEST_PATH_IMAGE069
the short axis length of the prediction frame is a value obtained after Sigmoid transformation;
Figure 95225DEST_PATH_IMAGE070
the central abscissa of the labeling frame is a value obtained after Sigmoid transformation;
Figure 662472DEST_PATH_IMAGE071
the central longitudinal coordinate of the labeling frame is a value obtained after Sigmoid transformation;
Figure 757467DEST_PATH_IMAGE072
the length of the short axis of the labeling frame is a value obtained after Sigmoid transformation;
Figure 206903DEST_PATH_IMAGE073
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.
Further, the offset angle loss function
Figure 842284DEST_PATH_IMAGE074
Comprises the following steps:
Figure 467300DEST_PATH_IMAGE075
wherein the content of the first and second substances,
Figure 857830DEST_PATH_IMAGE076
is a deflection angle coefficient;
Figure 669929DEST_PATH_IMAGE077
is the deflection angle of the prediction box;
Figure 797416DEST_PATH_IMAGE078
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 improve the convergence speed of the loss function, in 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 (9)

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 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;
loss function
Figure 540264DEST_PATH_IMAGE001
Comprises the following steps:
Figure 50880DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure 565038DEST_PATH_IMAGE003
a weight coefficient that is the classification loss function;
Figure 553723DEST_PATH_IMAGE004
a weight coefficient that is the objective loss function;
Figure 836936DEST_PATH_IMAGE005
weight coefficients for the regression loss function;
Figure 252874DEST_PATH_IMAGE006
a weight coefficient that is the offset angle loss function;
Figure 723170DEST_PATH_IMAGE007
is the classification loss function;
Figure 17010DEST_PATH_IMAGE008
is the target loss function;
Figure 154730DEST_PATH_IMAGE009
is the regression loss function;
Figure 413674DEST_PATH_IMAGE010
is the offset angle loss function.
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 function
Figure 230320DEST_PATH_IMAGE011
Comprises the following steps:
Figure 764069DEST_PATH_IMAGE012
wherein the content of the first and second substances,
Figure 880930DEST_PATH_IMAGE013
predicted position information for the prediction box;
Figure 779616DEST_PATH_IMAGE014
the real position information of the marking frame is obtained;
Figure 113252DEST_PATH_IMAGE015
the number of the prediction boxes.
3. Crack detection method as claimed in claim 2, characterized in that the target loss function
Figure 122796DEST_PATH_IMAGE016
Comprises the following steps:
Figure 359742DEST_PATH_IMAGE017
wherein the content of the first and second substances,
Figure 163750DEST_PATH_IMAGE018
comprises the following steps:
Figure 486147DEST_PATH_IMAGE019
wherein the content of the first and second substances,
Figure 33803DEST_PATH_IMAGE018
as a Sigmoid function, can be
Figure 125256DEST_PATH_IMAGE020
The interval mapped to (0, 1).
4. The crack detection method of claim 3, wherein the prediction box and the labeling box are both elliptical in shape, and the regression loss function
Figure 100165DEST_PATH_IMAGE021
Comprises the following steps:
Figure 145744DEST_PATH_IMAGE022
Figure 293828DEST_PATH_IMAGE023
wherein the content of the first and second substances,
Figure 115154DEST_PATH_IMAGE024
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;
Figure 385598DEST_PATH_IMAGE025
the existing category total number;
Figure 306467DEST_PATH_IMAGE027
is a mark function;
Figure 44616DEST_PATH_IMAGE028
the central abscissa of the prediction box is a value obtained after Sigmoid transformation;
Figure 626907DEST_PATH_IMAGE029
the central longitudinal coordinate of the prediction frame is a value obtained after Sigmoid transformation;
Figure 880034DEST_PATH_IMAGE030
the length of the long axis of the prediction box is subjected to Sigmoid transformation;
Figure 573183DEST_PATH_IMAGE031
the short axis length of the prediction frame is a value obtained after Sigmoid transformation;
Figure 900259DEST_PATH_IMAGE032
the central abscissa of the labeling frame is a value obtained after Sigmoid transformation;
Figure 276621DEST_PATH_IMAGE033
the central longitudinal coordinate of the labeling frame is a value obtained after Sigmoid transformation;
Figure 157989DEST_PATH_IMAGE034
the length of the short axis of the labeling frame is a value obtained after Sigmoid transformation;
Figure 513884DEST_PATH_IMAGE035
and the length of the long axis of the labeling frame is the value after Sigmoid transformation.
5. According to claimThe crack detection method of 4, wherein the offset angle loss function
Figure 164308DEST_PATH_IMAGE036
Comprises the following steps:
Figure 619560DEST_PATH_IMAGE037
wherein the content of the first and second substances,
Figure 112858DEST_PATH_IMAGE038
is a deflection angle coefficient;
Figure 882231DEST_PATH_IMAGE039
is the deflection angle of the prediction box;
Figure 777375DEST_PATH_IMAGE040
and the deflection angle of the marking frame.
6. The crack detection method of claim 5, 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;
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.
7. 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 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.
8. 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-6.
9. 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-6.
CN202110508657.9A 2021-05-11 2021-05-11 Crack detection method and device, computer equipment and storage medium Active CN112926584B (en)

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 true CN112926584A (en) 2021-06-08
CN112926584B 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)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113487570A (en) * 2021-07-06 2021-10-08 东北大学 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
CN113780480A (en) * 2021-11-11 2021-12-10 深圳佑驾创新科技有限公司 Method for constructing multi-target detection and category identification model based on YOLOv5
CN116189132A (en) * 2023-04-23 2023-05-30 深圳佑驾创新科技有限公司 Training method for target detection model of road information, target detection method and device

Citations (7)

* Cited by examiner, † Cited by third party
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

Patent Citations (7)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
Title
吕灿: "基于 SS-YOLO 算法的管廊巡检机器人视觉检测技术研究与实现", 《中国优秀硕士学位论文全文数据库 工程科技II辑》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113487570A (en) * 2021-07-06 2021-10-08 东北大学 High-temperature continuous casting billet surface defect detection method based on improved yolov5x network model
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
CN113780480A (en) * 2021-11-11 2021-12-10 深圳佑驾创新科技有限公司 Method for constructing multi-target detection and category identification model based on YOLOv5
CN116189132A (en) * 2023-04-23 2023-05-30 深圳佑驾创新科技有限公司 Training method for target detection model of road information, target detection method and device
CN116189132B (en) * 2023-04-23 2023-09-29 深圳佑驾创新科技股份有限公司 Training method for target detection model of road information, target detection method and device

Also Published As

Publication number Publication date
CN112926584B (en) 2021-08-06

Similar Documents

Publication Publication Date Title
CN112926584B (en) Crack detection method and device, computer equipment and storage medium
WO2020073951A1 (en) Method and apparatus for training image recognition model, network device, and storage medium
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
CN111126389A (en) Text detection method and device, electronic equipment and storage medium
CN107885544B (en) Application program control method, device, medium and electronic equipment
CN112132017B (en) Image processing method and device and electronic equipment
CN109583367A (en) Image text row detection method and device, storage medium and electronic equipment
CN112052759A (en) Living body detection method and device
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
CN115237618A (en) Request processing method and device, computer equipment and readable storage medium
CN113128526B (en) Image recognition method and device, electronic equipment and computer-readable storage medium
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
CN113065379A (en) Image detection method and device fusing image quality and electronic equipment
CN114359602A (en) Method and device for detecting product defects, storage medium and electronic equipment
CN114663511A (en) Image generation method, device, equipment and storage medium
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
CN111862015A (en) Image quality grade determining method and device and electronic equipment
CN116309538B (en) Drawing examination evaluation method, device, computer equipment and storage medium
CN112070593B (en) Data processing method, device, equipment and storage medium
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