A bolt detection model construction and bolt loosening detection method
By constructing a bolt detection model and combining image segmentation and denoising processing, the problem of low bolt looseness detection accuracy in the existing technology is solved, and higher detection accuracy and efficiency are achieved.
Patent Information
- Application Number
- CN202111617512.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-12-27
AI Technical Summary
The accuracy of bolt loosening detection methods in the existing technology is not high and there is a lack of effective denoising methods to extract pure bolt targets, resulting in low detection accuracy.
The bolt detection model is constructed by obtaining the annotated image set for training, using the neural network to predict the a priori frame and performing error reverse training, combined with image segmentation and denoising processing, and calculating the ratio of nuts and studs to determine the loose state.
It improves the accuracy of bolt detection and looseness detection, and enhances the detection efficiency under complex images.
Smart Images

Figure CN114581365B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence and computer vision technology, and in particular to a bolt detection model construction and a bolt loosening detection method. Background Art
[0002] With the rapid development of smart grid construction, the number of large-capacity, long-distance high-voltage transmission lines is increasing. Regular inspection of transmission lines is a necessary and arduous daily task. As a new inspection technology, drone inspection has the advantages of rapidity, high work efficiency, no geographical influence, high inspection quality and high safety. On this basis, the defect recognition subject based on inspection images has also received widespread attention and attention. At present, the bolt loosening detection methods based on drone inspection images mainly include (1) using traditional image processing methods to directly analyze defects on the original inspection images. This type of method requires a relatively pure image background and a high contrast between the target component and the background. It is difficult and has low accuracy. (2) Based on deep learning technology, the existing CNN series, FCN and other neural networks are used for detection. This detection method has low accuracy for detecting small targets in drone inspection images and lacks effective denoising methods to extract pure bolt targets. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a bolt detection model construction and a bolt loosening detection method to solve the technical problems in the prior art that the bolt loosening detection method has low accuracy and lacks an effective denoising method to extract pure bolt targets.
[0004] The technical solution proposed by the present invention is as follows:
[0005] A first aspect of an embodiment of the present invention provides a method for constructing a bolt detection model, which includes: obtaining an image set containing target bolts for annotation and determining corresponding label information, wherein the label information includes the center point coordinates of a bounding box where the target bolt is located, and the width and height of the bounding box; inputting the images contained in the image set into a preset neural network for normalization processing and outputting a corresponding feature map; predicting a priori boxes in each grid of the feature map and processing the priori boxes according to a preset confidence threshold to obtain a target prediction box and a prediction value, wherein the prediction value includes the center point coordinates of the target prediction box, and the width and height of the target prediction box; and reversely inputting the error between the label information and the prediction value into the preset neural network for training until a bolt detection model that meets the conditions is obtained.
[0006] Optionally, the reverse inputting of the error between the label information and the predicted value into the preset neural network for training until a bolt detection model that meets the conditions is obtained comprises: inputting a verification set of the image set into the preset neural network and verifying the performance of the preset neural network based on the precision and recall rate of the target bolt; when the precision and the recall rate do not meet the preset requirements, expanding the training set of the image set and repeating the training until a bolt detection model that meets the conditions is obtained.
[0007] A second aspect of an embodiment of the present invention provides a bolt loosening detection method, which includes: acquiring an image of a bolt to be detected; inputting the image of the bolt to be detected into a bolt detection model obtained by the bolt detection model construction method described in the first aspect of the embodiment of the present invention and any one of the first aspects, and obtaining the specific position of the bolt to be detected; segmenting the image containing the bolt to be detected according to the specific position and processing the segmented image to obtain a corresponding binary image; denoising the binary image and calculating the local maximum and minimum values of the horizontal cumulative histogram of the denoised binary image; calculating the ratio of the nut to the exposed part of the stud of the bolt to be detected according to the maximum and minimum values and comparing the ratio with a preset loosening threshold; determining the bolt loosening detection result according to the comparison result.
[0008] Optionally, the calculating the ratio of the nut to the exposed part of the stud of the bolt to be detected based on the maximum value and the minimum value and comparing the ratio with a preset loosening threshold value includes: parsing the image of the bolt to be detected to obtain the shooting time, longitude, latitude and altitude information of the bolt to be detected; determining the model of the bolt to be detected based on the longitude information and the latitude information; and determining the loosening threshold of the bolt to be detected based on the model of the bolt to be detected.
[0009] Optionally, after determining the bolt loosening detection result according to the comparison result, the method further includes: determining the location information of the bolt to be detected according to the longitude information and the latitude information; and transmitting the bolt loosening detection result and the location information to the background.
[0010] A third aspect of an embodiment of the present invention provides a bolt detection model construction device, which includes: a first acquisition module, used to acquire an image set containing target bolts for annotation and determine corresponding label information, wherein the label information includes the center point coordinates of a bounding box where the target bolt is located, and the width and height of the bounding box; a first processing module, used to input the images contained in the image set into a preset neural network for normalization processing and output a corresponding feature map; a second processing module, used to predict a priori box in each grid of the feature map and process the priori box according to a preset confidence threshold to obtain a target prediction box and a prediction value, wherein the prediction value includes the center point coordinates of the target prediction box, and the width and height of the target prediction box; a training module, used to reversely input the error between the label information and the prediction value into the preset neural network for training until a bolt detection model that meets the conditions is obtained.
[0011] A fourth aspect of an embodiment of the present invention provides a bolt loosening detection device, which includes: a second acquisition module, used to acquire an image of a bolt to be detected; a first determination module, used to input the image of the bolt to be detected into a bolt detection model obtained by the bolt detection model construction method described in the first aspect of the embodiment of the present invention and any one of the first aspects, and obtain the specific position of the bolt to be detected; a segmentation module, used to segment the image containing the bolt to be detected according to the specific position and process the segmented image to obtain a corresponding binary image; a third processing module, used to denoise the binary image and calculate the local maximum and minimum values of the horizontal cumulative histogram of the denoised binary image; a comparison module, used to calculate the ratio of the nut to the exposed part of the stud of the bolt to be detected according to the maximum value and the minimum value and compare the ratio with a preset loosening threshold; a second determination module, used to determine the bolt loosening detection result according to the comparison result.
[0012] Optionally, the device also includes: a parsing module, used to parse the image of the bolt to be detected to obtain the shooting time, longitude, latitude and altitude information of the bolt to be detected; a third determination module, used to determine the model of the bolt to be detected according to the longitude information and the latitude information; a fourth determination module, used to determine the loosening threshold of the bolt to be detected according to the model of the bolt to be detected.
[0013] A fifth aspect of an embodiment of the present invention provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the bolt detection model construction method as described in the first aspect of the embodiment of the present invention and any one of the first aspects, or the bolt loosening detection method as described in the second aspect of the embodiment of the present invention and any one of the second aspects.
[0014] A sixth aspect of an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to execute the bolt detection model construction method as described in the first aspect of the embodiment of the present invention and any one of the first aspects, or the bolt loosening detection method as described in the second aspect of the embodiment of the present invention and any one of the second aspects.
[0015] The technical solution provided by the present invention has the following effects:
[0016] The bolt detection model construction method provided by the embodiment of the present invention obtains an image set containing target bolts for annotation and determines the corresponding label information, wherein the label information includes the center point coordinates of the bounding box where the target bolt is located, and the width and height of the bounding box; the images contained in the image set are input into a preset neural network for normalization processing and the corresponding feature map is output; a priori frame is predicted in each grid of the feature map and the priori frame is processed according to a preset confidence threshold to obtain a target prediction frame and a prediction value, wherein the prediction value includes the center point coordinates of the target prediction frame, and the width and height of the target prediction frame; the error between the label information and the prediction value is reversely input into the preset neural network for training until a bolt detection model that meets the conditions is obtained. This method solves the problem that the detection accuracy is low due to the high image requirements when directly performing defect analysis on the original inspection image. Therefore, by implementing the present invention, the accuracy of bolt detection is improved.
[0017] The bolt loosening detection method provided by the embodiment of the present invention obtains an image of the bolt to be detected; inputs the image of the bolt to be detected into the bolt detection model obtained by the bolt detection model construction method described in the first aspect of the embodiment of the present invention and any one of the first aspects, and obtains the specific position of the bolt to be detected; according to the specific position, the image containing the bolt to be detected is segmented and the segmented image is processed to obtain the corresponding binary image; the binary image is denoised and the local maximum and minimum values of the horizontal cumulative histogram of the denoised binary image are calculated; the ratio of the nut of the bolt to be detected to the exposed part of the stud is calculated according to the maximum and minimum values and the ratio is compared with the preset loose threshold; the bolt loosening detection result is determined according to the comparison result. The method uses the bolt detection model to determine the specific position of the bolt to be detected, and the accuracy is high; the image is threshold segmented and denoised, and the image is clearer, which is more convenient to complete the bolt loosening detection. Therefore, by implementing the present invention, the accuracy and efficiency of bolt loosening detection under complex inspection images are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 is a flow chart of a method for constructing a bolt detection model according to an embodiment of the present invention;
[0020] Figure 2 is a structural diagram of a bolt detection model provided according to an embodiment of the present invention;
[0021] Figure 3 is a flow chart of a bolt loosening detection method according to an embodiment of the present invention;
[0022] Figure 4 is a schematic diagram of an image of a bolt to be detected after being detected by a bolt detection model provided according to an embodiment of the present invention;
[0023] Figure 5A is a schematic diagram of a bolt image to be detected after threshold segmentation according to an embodiment of the present invention;
[0024] Figure 5B is a schematic diagram of a bolt image to be detected after threshold segmentation according to an embodiment of the present invention;
[0025] Fig. 6A is a binary image after noise is removed from the image of the bolt to be detected provided by an embodiment of the present invention;
[0026] Figure 6B is a binary image after noise is removed from the image of the bolt to be detected provided by an embodiment of the present invention;
[0027] Fig. 7A is a schematic diagram of a horizontal cumulative histogram of a bolt image to be detected provided according to an embodiment of the present invention;
[0028] Figure 7B is a schematic diagram of a horizontal cumulative histogram of a bolt image to be detected provided according to an embodiment of the present invention;
[0029] Figure 8 is a structural block diagram of a bolt detection model building device according to an embodiment of the present invention;
[0030] Fig. 9 is a structural block diagram of a bolt loosening detection device according to an embodiment of the present invention;
[0031] Fig.10is a schematic diagram of the structure of a computer-readable storage medium provided according to an embodiment of the present invention;
[0032] Fig.11 is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0034] The embodiment of the present invention provides a method for constructing a bolt detection model. Figure 1 As shown, the method comprises the following steps:
[0035] Step S101: Obtain an image set containing target bolts for annotation and determine the corresponding label information, wherein the label information includes the coordinates of the center point of the bounding box where the target bolts are located, and the width and height of the bounding box. Specifically, first (drone) collects images containing bolts in real scenes, and uses a data enhancement algorithm to expand the collected images containing bolts to obtain an image set containing target bolts, and divides the image set into a training set, a validation set, and a test set. Among them, the data enhancement algorithms include Mosaic, cropping, translation, horizontal flipping, rotation, changing brightness and saturation, and adding noise. The generalization ability of the model can be improved by expanding the image set.
[0036] Specifically, a random sampling method is adopted to select 70% of the image set as the training set, 20% as the validation set, and 10% as the test set. The training set is used to create and train the bolt detection model, the validation set is used to determine the network structure or the parameters that control the complexity of the model, and the test set is used to test the performance of the optimal bolt detection model finally selected.
[0037] After obtaining the image set, the labelme image annotation tool is used to manually annotate the images and create a corresponding label file. The annotation information included in the label file, namely the label information, includes: the center point coordinates of the bounding box where the target bolt is located, the width and height of the bounding box, and the category information classi, where i=0 represents the background and i=1 represents the bolt.
[0038] Step S102: Input the images contained in the image set into a preset neural network for normalization and output the corresponding feature map. Specifically, after obtaining the image set containing the target bolt, the images contained in the image set are input into the preset neural network YOLOv4, and the input images are normalized to a size of 608×608. After feature extraction and enhancement, feature maps of three scales of 19×19, 38×38, and 64×64 are output.
[0039] Step S103: predicting a priori boxes in each grid of the feature map and processing the priori boxes according to a preset confidence threshold to obtain a target prediction box and a prediction value, wherein the prediction value includes the coordinates of the center point of the target prediction box, and the width and height of the target prediction box. Specifically, after outputting three scale feature maps, three priori boxes are predicted in each grid of each scale feature map, wherein each bounding box includes five prediction values: the coordinates of the center point of the bounding box, the width and height of the bounding box, the probability that the bounding box contains the target object, and the accuracy of the bounding box position.
[0040] Since there are a large number of output bounding boxes, the confidence level is defined and the confidence threshold is set. Then, non-maximum suppression filtering is used to obtain the target prediction box. The prediction values corresponding to the target prediction box include the coordinates of the center point of the target prediction box, the width and height of the target prediction box.
[0041] The confidence consists of the probability that the bounding box contains the target object and the accuracy of the bounding box position (i.e., IoU), which is defined as:
[0042] confidence=P(object)×IoU
[0043] Where P(object)∈(0,1) represents the probability that the bounding box contains the bolt; IoU represents the accuracy of the bounding box position, which is determined by the ratio of the area of the overlapping part of the predicted bounding box and the annotated bounding box to the area of the union of the two.
[0044] Step S104: The error between the label information and the predicted value is reversely input into the preset neural network for training until a bolt detection model that meets the conditions is obtained. Specifically, after obtaining the target prediction frame and the predicted value, the error between the obtained label information and the predicted value is reversely input into the preset neural network YOLO v4, and trained using the CIoU loss function, adjusting the configuration parameters of the YOLO v4 neural network and determining the optimal neural network to obtain a bolt detection model that meets the conditions, such as Figure 2 shown.
[0045] Among them, the CIoU loss function is defined as follows:
[0046]
[0047] Where b gt represents the center coordinate point of the real bounding box, i.e., the bounding box where the target bolt is located in the input image; b represents the center coordinate point of the target prediction box; ρ represents the Euclidean distance; c represents the diagonal distance between the minimum circumscribed rectangle of the real bounding box and the target prediction box; ∝v represents the aspect ratio influencing factor, which is used to control the width and height of the target prediction box to be as close to the width and height of the real box as quickly as possible. α and ν are defined as follows:
[0048]
[0049]
[0050] In the formula, w gt and h gt They represent the width and height of the real bounding box respectively; w and h represent the width and height of the target prediction box respectively.
[0051] The bolt detection model construction method provided by the embodiment of the present invention solves the problem of low detection accuracy due to high image requirements when directly performing defect analysis on the original inspection image. Therefore, by implementing the present invention, the accuracy of bolt detection is improved.
[0052] As an optional implementation of the embodiment of the present invention, the reverse input of the error between the label information and the predicted value into the preset neural network for training until a bolt detection model that meets the conditions is obtained, including: inputting the verification set of the image set into the preset neural network and verifying the performance of the preset neural network according to the precision and recall of the target bolt; when the precision and recall do not meet the preset requirements, expanding the training set of the image set and repeating the training until a bolt detection model that meets the conditions is obtained. Specifically, after training with the corresponding training set in the image set, input the verification set image and call the trained model, and then verify the performance of the trained YOLO v4 network according to the precision and recall of the target bolt. When the precision and recall are low, that is, they do not meet the accuracy requirements, add training images to the training set and repeat the training until a bolt detection model that meets the conditions is obtained.
[0053] The embodiment of the present invention also provides a method for detecting bolt loosening. Figure 3 As shown, the method comprises the following steps:
[0054] Step S201: Acquire an image of the bolt to be detected. Specifically, before detection, first acquire an image of the bolt to be detected.
[0055] Step S202: Input the image of the bolt to be detected into the bolt detection model obtained by the bolt detection model construction method as described in the embodiment of the present invention and obtain the specific position of the bolt to be detected. Specifically, the specific position (x, y, w, h) of the bolt to be detected can be obtained by inputting the acquired image of the bolt to be detected into the trained bolt detection model. Among them, (x, y) represents the coordinates of the center point of the bounding box where the bolt to be detected is located; w and h represent the width and height of the bounding box where the bolt to be detected is located, respectively.
[0056] In one embodiment, if Figure 4 As shown, it is a schematic diagram showing an image of a bolt to be inspected after being inspected by a bolt inspection model.
[0057] Step S203: Segment the image containing the bolt to be detected according to the specific position and process the segmented image to obtain a corresponding binary image. Specifically, after obtaining the specific position (x, y, w, h) of the bolt to be detected, first segment (crop) the corresponding bolt to be detected in the boundary box according to these position points, and then process the segmented image using grayscale transformation and threshold segmentation (otsu segmentation) in turn to obtain a corresponding binary image, such as Figure 5A and 5B As shown in the figure, after processing, the pixel value of the bolt to be detected is not 255, and the background pixel is 0.
[0058] Step S204: De-noise the binary image and calculate the local maximum and minimum values of the horizontal cumulative histogram of the denoised binary image. In order to eliminate the adhesion noise of the bolt edge, first use the convolution kernel to scan the points with a pixel value of 255, and then use the column convolution kernel and the scanned binary image to perform the following operations:
[0059] If the pixel value is less than 255, the point is considered to be noise and its pixel value is set to 0:
[0060]
[0061] Specifically, for a point with a pixel value of 255, first check whether the pixel values of the 8 points in its neighborhood are 255. If they are 255, mark it as a connected region. Then, calculate the area of all connected regions, and remove the small area as noise. Finally, fill the void in the bolt through the image dilation algorithm.
[0062] Specifically, a cross-shaped convolution kernel is used to scan each pixel in the denoised binary image, and the convolution kernel is used to perform an “AND” operation with the scanned binary image. If both are 0, the center point pixel is 0, otherwise the center point pixel is 255.
[0063] In one embodiment, the binary image after noise removal is as follows: Fig. 6A and 6B shown.
[0064] Then the horizontal cumulative histogram of the binary image is calculated, and the local maximum and minimum values of the histogram are calculated. Specifically, the horizontal cumulative histogram is obtained by row scanning the binary image and accumulating the number of pixels with a value of 255 on the same horizontal line. Then the horizontal cumulative pixel growth rate of adjacent rows is calculated, and the three rows with the largest absolute value of the growth rate are taken as the local maximum and minimum values.
[0065] In one embodiment, if Fig. 7A and 7B As shown, Fig. 7A The maximum and minimum values are 83 and 38 respectively; Figure 7B The maximum and minimum values are 82 and 33 respectively.
[0066] Step S205: Calculate the ratio of the nut of the target bolt to the exposed stud according to the maximum value and the minimum value, and compare the ratio with a preset loose threshold. Specifically, calculate the ratio of the nut of the target bolt to the exposed stud according to the calculated maximum value and the minimum value, and compare the ratio with a preset threshold.
[0067] Step S206: Determine the bolt looseness detection result according to the comparison result. Specifically, when the calculated ratio value is less than a preset threshold, it indicates that the bolt to be detected is loose; otherwise, it is not loose.
[0068] In one embodiment, if Fig. 7A and 7B As shown, the preset loose threshold is 0.3; Fig. 7A The corresponding ratio value of the bolt to be tested is Then the bolt to be tested is normal; Figure 7B The corresponding ratio value of the bolt to be tested is The bolt to be detected is loose.
[0069] The bolt loosening detection method provided by the embodiment of the present invention uses a bolt detection model to determine the specific position of the bolt to be detected, with a high accuracy rate; threshold segmentation and denoising are performed on the image, so that the image is clearer and it is easier to complete the bolt loosening detection. Therefore, by implementing the present invention, the accuracy and efficiency of bolt loosening detection under complex inspection images are improved.
[0070] As an optional implementation of the embodiment of the present invention, step S205 includes: parsing the image of the bolt to be detected to obtain the shooting time, longitude, latitude and altitude information of the bolt to be detected; determining the model of the bolt to be detected according to the longitude information and the latitude information; determining the loosening threshold of the bolt to be detected according to the model of the bolt to be detected. Specifically, firstly, the image of the bolt to be detected is parsed to obtain the shooting time, longitude, latitude and altitude information of the image, and then the bolt model used in the tower is obtained from the design document according to the longitude and latitude information, and then when the bolt is in a tightened state, the ratio of the nut to the exposed part of the stud is measured and the obtained ratio value is used as the loosening threshold of the bolt.
[0071] As an optional implementation of the embodiment of the present invention, after determining the bolt loosening detection result according to the comparison result, the method further includes: determining the location information of the bolt to be detected according to the longitude information and the latitude information; transmitting the bolt loosening detection result and the location information to the background. Specifically, the location information of the bolt to be detected can be determined according to the longitude and longitude information. Therefore, after determining the bolt loosening detection result, the location information of the bolt to be detected and the detection result are transmitted to the background for maintenance personnel to review.
[0072] The embodiment of the present invention also provides a bolt detection model construction device, such as Figure 8 As shown, the device comprises:
[0073] The first acquisition module 101 is used to acquire an image set containing a target bolt for annotation and determine corresponding label information, wherein the label information includes the coordinates of the center point of a bounding box where the target bolt is located, and the width and height of the bounding box; for details, see the relevant description of step S101 in the above method embodiment.
[0074] The first processing module 102 is used to input the images contained in the image set into a preset neural network for normalization processing and output corresponding feature maps; for details, please refer to the relevant description of step S102 in the above method embodiment.
[0075] The second processing module 103 is used to predict a priori boxes in each grid of the feature map and process the prior boxes according to a preset confidence threshold to obtain a target prediction box and a prediction value, wherein the prediction value includes the coordinates of the center point of the target prediction box, and the width and height of the target prediction box; for details, see the relevant description of step S103 in the above method embodiment.
[0076] The training module 104 is used to reversely input the error between the label information and the predicted value into the preset neural network for training until a bolt detection model that meets the conditions is obtained; for details, please refer to the relevant description of step S104 in the above method embodiment.
[0077] The bolt detection model building device provided by the embodiment of the present invention solves the problem of low detection accuracy due to high image requirements when directly performing defect analysis on the original inspection image. Therefore, by implementing the present invention, the accuracy of bolt detection is improved.
[0078] As an optional implementation of the embodiment of the present invention, the device also includes: a verification module, which is used to input the verification set of the image set into the preset neural network and verify the performance of the preset neural network according to the precision and recall rate of the target bolt; an expansion module, which is used to expand the training set of the image set and repeat the training until a bolt detection model that meets the conditions is obtained when the precision and the recall rate do not meet the preset requirements.
[0079] For a detailed description of the functions of the bolt detection model building device provided in the embodiment of the present invention, please refer to the description of the bolt detection model building method in the above embodiment.
[0080] The embodiment of the present invention also provides a bolt loosening detection device, such as Fig. 9 As shown, the device comprises:
[0081] The second acquisition module 201 is used to acquire the image of the bolt to be detected; for details, please refer to the relevant description of step S201 in the above method embodiment.
[0082] The first determination module 202 is used to input the image of the bolt to be detected into the bolt detection model obtained by the bolt detection model construction method described in the embodiment of the present invention and obtain the specific position of the bolt to be detected; for details, please refer to the relevant description of step S202 in the above method embodiment.
[0083] The segmentation module 203 is used to segment the image containing the bolts to be detected according to the specific positions and process the segmented image to obtain a corresponding binary image; for details, please refer to the relevant description of step S203 in the above method embodiment.
[0084] The third processing module 204 is used to perform denoising on the binary image and calculate the local maximum and minimum values of the horizontal cumulative histogram of the denoised binary image; for details, please refer to the relevant description of step S204 in the above method embodiment.
[0085] The comparison module 205 is used to calculate the ratio of the nut to the exposed stud of the bolt to be detected according to the maximum value and the minimum value and compare the ratio with a preset looseness threshold; for details, please refer to the relevant description of step S205 in the above method embodiment.
[0086] The second determination module 206 is used to determine the bolt loosening detection result according to the comparison result; for details, please refer to the relevant description of step S206 in the above method embodiment.
[0087] The bolt loosening detection device provided by the embodiment of the present invention uses a bolt detection model to determine the specific position of the bolt to be detected, with a high accuracy rate; threshold segmentation and denoising are performed on the image, so that the image is clearer and it is easier to complete the bolt loosening detection. Therefore, by implementing the present invention, the accuracy and efficiency of bolt loosening detection under complex inspection images are improved.
[0088] As an optional implementation of the embodiment of the present invention, the device also includes: a parsing module, used to parse the image of the bolt to be detected to obtain the shooting time, longitude, latitude and altitude information of the bolt to be detected; a third determination module, used to determine the model of the bolt to be detected according to the longitude information and the latitude information; a fourth determination module, used to determine the loosening threshold of the bolt to be detected according to the model of the bolt to be detected.
[0089] As an optional implementation of the embodiment of the present invention, the device also includes: a fifth determination module, used to determine the location information of the bolt to be detected based on the longitude information and the latitude information; a transmission module, used to transmit the bolt loosening detection result and the location information to the background.
[0090] For a detailed description of the functions of the bolt loosening detection device provided in the embodiment of the present invention, please refer to the description of the bolt loosening detection method in the above embodiment.
[0091] The embodiment of the present invention also provides a storage medium, such as Fig.10As shown, a computer program 601 is stored thereon, and when the instruction is executed by the processor, the steps of the bolt detection model construction method or the bolt loosening detection method in the above-mentioned embodiment are implemented. The storage medium also stores audio and video stream data, feature frame data, interaction request signaling, encrypted data, and preset data size, etc. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk (Hard Disk Drive, abbreviated: HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0092] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0093] The embodiment of the present invention further provides an electronic device, such as Fig.11 As shown, the electronic device may include a processor 51 and a memory 52, wherein the processor 51 and the memory 52 may be connected via a bus or other means. Fig.11 The example of connecting through bus is taken in the following.
[0094] The processor 51 may be a central processing unit (CPU). The processor 51 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0095] The memory 52 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as the corresponding program instructions / modules in the embodiments of the present invention. The processor 51 executes various functional applications and data processing of the processor by running the non-transient software programs, instructions and modules stored in the memory 52, that is, to implement the bolt detection model construction method or bolt loosening detection method in the above method embodiment.
[0096] The memory 52 may include a program storage area and a data storage area, wherein the program storage area may store an application required for operating the device and at least one function; the data storage area may store data created by the processor 51, etc. In addition, the memory 52 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 52 may optionally include a memory remotely arranged relative to the processor 51, and these remote memories may be connected to the processor 51 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0097] The one or more modules are stored in the memory 52 and when executed by the processor 51, perform the following steps: Figure 1 -2 The bolt detection model construction method in the embodiment shown in FIG. 2, or Figure 3 - Bolt loosening detection method in the embodiment shown in 7.
[0098] For details of the above electronic equipment, please refer to Figure 1 The corresponding related descriptions and effects in the embodiment shown in FIG. 7 can be understood and will not be repeated here.
[0099] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for detecting bolt loosening, characterized in that: The steps include: Acquire an image of the bolt to be inspected; Input the image of the bolt to be detected into the bolt detection model and obtain the specific position of the bolt to be detected; Segmenting the image containing the bolt to be detected according to the specific position and processing the segmented image to obtain a corresponding binary image; Performing denoising on the binary image and calculating the local maximum and minimum values of the horizontal cumulative histogram of the denoised binary image; Calculating the ratio of the nut to the exposed stud of the bolt to be detected according to the maximum value and the minimum value, and comparing the ratio with a preset looseness threshold; Determine the bolt loosening detection result according to the comparison result; The bolt detection model is constructed by the following steps: Acquire an image set containing a target bolt, annotate it, and determine corresponding label information, wherein the label information includes the coordinates of the center point of a bounding box where the target bolt is located, and the width and height of the bounding box; Inputting the images contained in the image set into a preset neural network for normalization processing and outputting corresponding feature maps; Predicting a priori boxes in each grid of the feature map and processing the priori boxes according to a preset confidence threshold to obtain a target prediction box and a prediction value, wherein the prediction value includes the coordinates of the center point of the target prediction box and the width and height of the target prediction box; Reversely inputting the error between the label information and the predicted value into the preset neural network for training until a bolt detection model that meets the conditions is obtained; The process of denoising the binary image and calculating the local maximum and minimum values of the horizontal cumulative histogram of the denoised binary image comprises: Performing denoising on the binary image; The horizontal cumulative histogram of the denoised binary image is obtained by scanning the denoised binary image line by line and accumulating the number of pixels with a value of 255 on the same horizontal line; The horizontal cumulative pixel growth rates of adjacent rows are calculated, and the three rows with the largest absolute values of the horizontal cumulative pixel growth rates are taken as the local maximum and minimum values.
2. The method according to claim 1, characterized in that The step of reversely inputting the error between the label information and the predicted value into the preset neural network for training until a bolt detection model that meets the conditions is obtained comprises: Inputting a verification set of the image set into the preset neural network and verifying the performance of the preset neural network according to the precision and recall of the target bolt; When the precision and the recall rate do not meet the preset requirements, the training set of the image set is expanded and the training is repeated until a bolt detection model that meets the conditions is obtained.
3. The method according to claim 1, characterized in that The calculating the ratio of the nut of the to-be-detected bolt to the exposed portion of the stud according to the maximum value and the minimum value and comparing the ratio with a preset looseness threshold value includes: Analyze the image of the bolt to be detected to obtain the shooting time, longitude, latitude and altitude information of the bolt to be detected; Determine the model of the bolt to be detected according to the longitude information and the latitude information; The looseness threshold of the bolt to be detected is determined according to the model of the bolt to be detected.
4. The method according to claim 3, characterized in that After determining the bolt loosening detection result according to the comparison result, the method further includes: Determine the location information of the bolt to be detected according to the longitude information and the latitude information; The bolt loosening detection result and the location information are transmitted to the background.
5. A bolt loosening detection device, characterized in that: include: The second acquisition module is used to acquire the image of the bolt to be detected; A first determination module is used to input the image of the bolt to be detected into a bolt detection model and obtain the specific position of the bolt to be detected; A segmentation module, used for segmenting the image containing the bolt to be detected according to the specific position and processing the segmented image to obtain a corresponding binary image; A third processing module is used to perform denoising on the binary image and calculate the local maximum and minimum values of the horizontal cumulative histogram of the denoised binary image; A comparison module, used for calculating the ratio of the nut of the bolt to be detected to the exposed part of the stud according to the maximum value and the minimum value, and comparing the ratio with a preset looseness threshold; A second determination module is used to determine the bolt loosening detection result according to the comparison result; The bolt detection model is constructed by the following modules: A first acquisition module is used to acquire an image set containing a target bolt, annotate it, and determine corresponding label information, wherein the label information includes the coordinates of the center point of a bounding box where the target bolt is located, and the width and height of the bounding box; A first processing module, used for inputting the images contained in the image set into a preset neural network for normalization processing and outputting corresponding feature maps; A second processing module is used to predict a priori boxes in each grid of the feature map and process the priori boxes according to a preset confidence threshold to obtain a target prediction box and a prediction value, wherein the prediction value includes the coordinates of the center point of the target prediction box and the width and height of the target prediction box; A training module, used for reversely inputting the error between the label information and the predicted value into the preset neural network for training until a bolt detection model that meets the conditions is obtained; Wherein, the third processing module is specifically used for: Performing denoising on the binary image; The horizontal cumulative histogram of the denoised binary image is obtained by scanning the denoised binary image line by line and accumulating the number of pixels with a value of 255 on the same horizontal line; The horizontal cumulative pixel growth rates of adjacent rows are calculated, and the three rows with the largest absolute values of the horizontal cumulative pixel growth rates are taken as the local maximum and minimum values.
6. The device according to claim 5, characterized in that The device also includes: An analysis module, used for analyzing the image of the bolt to be detected to obtain the shooting time, longitude, latitude and altitude information of the bolt to be detected; A third determination module is used to determine the model of the bolt to be detected according to the longitude information and the latitude information; The fourth determination module is used to determine the looseness threshold of the bolt to be detected according to the model of the bolt to be detected.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the bolt loosening detection method according to any one of claims 1 to 4.
8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the bolt loosening detection method according to any one of claims 1 to 4 by executing the computer instructions.
Citation Information
Cited By
Bolt inspection method
CN123093649A
