Method for identifying and detecting drilling inclination angle of drill site based on YOLOv8-obb model
Through the identification and detection method based on the YOLOv8-obb model, the existing drilling field drilling and drilling inclination detection problems are solved, and higher detection accuracy and speed are achieved, and good anti-interference ability and real-time performance are provided.
Patent Information
- Application Number
- CN202411503426.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-14
AI Technical Summary
The existing drilling and drilling inclination detection methods have low accuracy and slow speed, making it difficult to meet the safety and economic needs of coal mining.
The identification and detection method based on the YOLOv8-obb model is adopted to improve the detection accuracy and speed of drilling inclination angle of drilling inclination by data collection, picture data annotation, data enhancement, model training and output inclination value.
It improves the detection accuracy and speed of drilling inclination angle in the drilling field, has anti-interference ability and good real-time performance. Through image rotation and wavelet transformation denoising processing, the problems of insufficient data volume and low picture quality are solved.
Smart Images

Figure CN119445222A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of drilling inclination angles, and in particular to a method for identifying and detecting drilling inclination angles in a drilling field based on a YOLOv8-obb model. Background Art
[0002] The identification of drilling inclination in underground drilling sites is of great significance in coal mine drilling operations. Accurate identification of drilling inclination is crucial to ensure the safety, fun and economy of coal mining. The inclination is one of the key parameters of the drilling trajectory. Accurate identification of the drilling rig inclination can ensure that the drilling accurately reaches the target coal seam or geological target according to the design requirements. This is crucial for coal mine production. By accurately controlling the drilling inclination, the drilling path can be optimized, the invalid footage can be reduced, and the drilling efficiency can be improved, thereby improving the overall production efficiency of the coal mine. The wrong inclination may cause the drilling to deviate from the predetermined trajectory and may penetrate other coal seams or tunnels, causing safety accidents. Accurate identification of inclination helps to avoid such risks. At the same time, it can also reduce resource waste, reduce production costs, and improve the economic benefits of coal mines. To this end, we need to provide a method for identifying and detecting drilling inclination in the drilling site based on the YOLOv8-obb model.
[0003] At present, there are mainly the following methods for identifying and detecting the drilling inclination angle in the drilling field:
[0004] 1. Gyroscope measurement method: The gyroscope determines the method and inclination of the drill pipe by measuring the reference vector of the earth's rotation. However, this method has high equipment costs, requires regular calibration, and is easily affected by high temperature or high pressure environments.
[0005] 2. Accelerometer measurement method: The accelerometer can measure the acceleration in three axes and calculate the inclination of the drill pipe. However, this method is greatly affected by vibration and may cause measurement errors. Long-term use may cause zero-point drift problems.
[0006] 3. Magnetometer measurement method: The magnetometer measures the direction of the earth's magnetic field and then calculates the azimuth and inclination of the drill pipe. However, this method is greatly affected by the magnetic field of surrounding metal objects. Therefore, calibration and compensation are required in practical applications. Summary of the invention
[0007] The technical problem to be solved by the present invention is: in order to solve the technical problems of low accuracy and slow speed of drilling inclination angle detection in the existing drilling field, the present invention provides a method for identifying and detecting drilling inclination angle in the drilling field based on the YOLOv8-obb model, by improving the identification and detection method of drilling inclination angle in the drilling field, the detection accuracy and detection speed of drilling inclination angle in the drilling field can be improved.
[0008] The technical solution adopted by the present invention to solve the technical problem is: a method for identifying and detecting the drilling inclination angle of a drilling site based on a YOLOv8-obb model, comprising the following steps:
[0009] S1. Data collection: Collect drilling inclination angle images of the drilling rig through a camera to form an image dataset of the drilling inclination angle of the drilling rig;
[0010] S2, image data labeling: obtain the image data set in step S1, and use rolabeImg to label the drilling rig, drill rod type, and target frame in the image data;
[0011] S3, data enhancement: obtaining the image dataset annotated in step S2, and performing data enhancement processing on the annotated image dataset by using image rotation and wavelet transform image denoising;
[0012] S4. Build a YOLOv8-obb model and train the YOLOv8-obb model using the image data set after data enhancement to obtain the optimal YOLOv8-obb model.
[0013] S5. Obtain the optimal YOLOv8-obb model in step S4, input the drilling rig drilling inclination angle picture into the optimal YOLOv8-obb model, and output the drill rod inclination angle corresponding to the drilling rig drilling inclination angle picture.
[0014] Therefore, the angle of the drill rod is identified and detected by constructing the YOLOv8-obb model. Compared with the existing detection methods of gyroscope measurement, accelerometer measurement and magnetometer measurement, this method can improve the detection accuracy and speed of the drilling inclination angle in the drilling field. At the same time, it also has a certain anti-interference ability and good real-time performance. The problem of insufficient data volume due to angle change can be solved by rotating the image. The image is denoised by wavelet transform, which can improve the image quality and thus improve the detection accuracy of the drilling inclination angle in the drilling field.
[0015] Furthermore, the picture rotation comprises the following steps:
[0016] S3-1, read the image and obtain the image size: obtain the height h and width w of the image, and calculate the coordinates of the midline point of the image (w / 2, h / 2);
[0017] S3-2, set the rotation angle list: from 0°-360°, set the number of rotated pictures to n, then the rotation interval d=306 / n, and the rotation angle of each rotation interval is a random number between the interval (0, d);
[0018] S3-3, rotating the image for each angle in the defined angle range: first, calculating the rotation matrix based on the coordinates of the center point of the image (w / 2, h / 2) and the current rotation angle r, then calculating the size of the new image according to the rotation matrix, then adjusting the rotation matrix, and finally, rotating the image using the rotation matrix;
[0019] S3-4, image cropping: taking the center point of the image as the center, crop the width and height of the image according to the size of the original image;
[0020] S3-5, save the rotated image. Thus, by rotating the image, the YOLOv8-obb model can increase its ability to recognize and detect objects at different angles, so as to solve the problem of insufficient original image data. Since the drilling angle range on site is any angle between 0°-306°, the data cycle of the image data set to collect the entire angle is relatively long. By rotating the image and generating 0°-360° images according to certain rules, the collection time of the image data set can be shortened. The purpose of the rotation angle of each rotation interval being a random number between the interval (0, d) is to ensure the randomness and diversity of the rotation angle. The purpose of calculating the size of the new image according to the rotation matrix is to ensure that the image will not be cropped due to rotation. The purpose of adjusting the rotation matrix is to ensure that the center of the rotated image is aligned with the center of the canvas.
[0021] Furthermore, in step S3-2, the calculation formula of the rotation angle r is:
[0022] r = (n-1)*d + rand(0, 1);
[0023] In step S3-3, the image rotation formula is as follows:
[0024] i′=icosθ-jsinθ, j′=isinθ+jcosθ;
[0025] Where: (i, j) is the coordinate of the pixel point in the original image f(i, j), (i′, j′) is the coordinate of the image g(i′, j′) after the corresponding pixel point (i, j) is rotated.
[0026] Furthermore, the wavelet transform image denoising comprises the following steps:
[0027] S3-a, generation of noisy images: generating noisy images by adding random noise to the original noise-free images;
[0028] S3-b, wavelet decomposition: performing multi-level wavelet decomposition on the noisy image in step S3-a, decomposing the image signal into different frequencies and scales;
[0029] S3-c, threshold processing: set the threshold, remove the wavelet coefficients of the high-frequency part, and retain the large coefficients of the low-frequency part;
[0030] S3-d, wavelet reconstruction: Use the processed wavelet coefficients for wavelet reconstruction to obtain the denoised image. Therefore, the principle of wavelet transform image denoising is based on the different characteristics of the image and noise after wavelet transform. After the noisy signal is decomposed by wavelet at each scale, the energy of the image is mainly concentrated in the low-resolution sub-band, while the energy of the noise signal is mainly distributed in each high-frequency sub-band; the absolute value of the wavelet coefficient of the original image information is large, while the absolute value of the wavelet coefficient of the noise information is small. Therefore, by setting a suitable threshold, the noise can be effectively removed while retaining the detailed information of the image.
[0031] Furthermore, in step S3, the data enhancement processing method also includes:
[0032] Random scaling, random cropping, color transformation, affine transformation, heat map enhancement, Mixup, CutMix mixed sample technology, and Advanced Data Augmentation;
[0033] Among them: Random scaling means: adjusting the image size can simulate the change of the size of the object in the field of view;
[0034] Random cropping means randomly cropping some areas from the image to train the YOLOv8-obb model's ability to handle incomplete information;
[0035] Color transformation refers to changing the brightness, contrast, and saturation of the image to enhance the adaptability of the YOLOv8-obb model to lighting changes;
[0036] Affine transformation means: increasing the diversity of objects in the image through translation and flipping operations;
[0037] Heatmap enhancement means: when training the YOLOv8-obb model, the heatmap of the target object is used as input to enhance the YOLOv8-obb model's recognition and detection of the target contour and texture;
[0038] Mixup and CutMix mixed sample technology means: increasing the generalization ability of the YOLOv8-obb model by easing two or more pictures;
[0039] Using Advanced Data Augmentation means randomly blocking part of the image, ignoring the blocked part when training the YOLOv8-obb model, and focusing on the key features.
[0040] Further, in step S4, the YOLOv8-obb model includes:
[0041] Backbone, Neck and Head;
[0042] Among them: Backbone uses a series of convolutional layers and deconvolutional layers to extract features. At the same time, it uses residual connections and bottleneck structures to reduce the size of the network and improve performance. This part uses the C2f module as the basic building block;
[0043] Neck uses multi-scale feature fusion technology to fuse feature maps from different stages of Backbone to enhance feature representation capabilities. Neck includes: an SPPF module, a PAA module, and two PAN modules;
[0044] The Head is responsible for the final target detection and classification tasks. The Head includes: a detection head, a classification head, and an angle recognition head. The detection head contains: a series of convolutional layers and deconvolutional layers to generate detection results. The classification head uses global average pooling to classify each feature map and identify the detection target angle. Therefore, the C2f module of the YOLOv8-obb model has fewer parameters and better feature extraction capabilities than the C3 module of the YOLOv5 model.
[0045] Further, in step S4, the training of the YOLOv8-obb model includes the following steps:
[0046] S4-1, forward propagate data points through the network to obtain output;
[0047] S4-2, using the loss function to calculate the total error;
[0048] S4-3, use the back propagation algorithm to calculate the gradient of the loss function relative to each weight and bias;
[0049] S4-4, use gradient descent to update the weights and biases of each layer;
[0050] S4-5. Repeat steps S4-1 to S4-4 multiple times to minimize the total error.
[0051] Furthermore, in step S4, the calculation formula of the classification loss function L is:
[0052]
[0053] The calculation formula of the loss function CIOU is:
[0054]
[0055] The calculation formula for the IOU between the predicted box and the real box is:
[0056]
[0057] The calculation formula of the weight function α is:
[0058]
[0059] The calculation formula of aspect ratio v is:
[0060]
[0061] The calculation formula of the loss function DFL is:
[0062]
[0063] Where: N is the number of samples, L is i is the i-th sample loss, y i is the true label of the i-th sample, p i is the predicted value of the i-th sample, S i Represents the probability distribution of the difference between the left side of the predicted border and the true value, S i+1 Represents the probability distribution of the difference between the right side of the predicted border and the true value, y 1 Represents the true value of the i-th sample target box, represents the integral value of the label, Indicates the integral value of the neighboring label.
[0064] Further, in step S4, the drilling rig target to drill rod filtering process includes the following steps:
[0065] S4-1, obtaining drilling rig detection information;
[0066] S4-2, filter the drill rods by the overlapping area between the drilling rig and the drill rod;
[0067] S4-3, if the number of drill rods to be tested is greater than 1, the target closest to the drilling rig detection angle is retained;
[0068] S4-4, the angle of the drilling rig is expanded from 0°-180° to 0°-360°. Thus, the drilling angle of the drill rod can be obtained by detecting the angle value of the drill rod. The purpose of filtering the drill rod by the drilling rig is to prevent false detection (because there are many objects with similar characteristics to the drill rod in the drilling field).
[0069] Further, in step S4, the relative position determination of the drilling rig includes the following steps:
[0070] S4-a, obtaining angle information β of the target drill pipe;
[0071] S4-b, obtain the center position of the target drill rod and record it as (x0, y0);
[0072] S4-c, obtain the center position of the target drilling rig and record it as (x1, y1);
[0073] S4-d, if 0°≤β<90°, x0>x1 and y0>y1, then i=i+180°, if
[0074] 90°≤β<180°, x0>x1 and y0<y1, then i=i+180°. Therefore, since the on-site drilling rig angle range is 0°-360°, but the result output by the deep learning network is 0°-180°, for this reason, when marking the detection target, the drilling rig whose relative position with the drill rod does not change is marked, and the drilling rig is also marked as the detection target when training the YOLOv8-obb model, so that the actual angle of the drilling rig can be inferred based on the on-site detection results; since the result range output by the YOLOv8-obb model is the same angle of 0°-180°, it can distinguish between the 0°-180° range and the 180°-360° range based on the relative position with the drilling rig.
[0075] Compared with the prior art, the present invention has the following beneficial effects:
[0076] The angle of the drill rod is identified and detected by constructing the YOLOv8-obb model. Compared with the existing detection methods of gyroscope measurement, accelerometer measurement, and magnetometer measurement, this method can improve the detection accuracy and speed of the drilling inclination angle in the drilling site. At the same time, it also has a certain anti-interference ability and good real-time performance. The problem of insufficient data volume due to angle change can be solved by rotating the image. The image is denoised by wavelet transform to improve the image quality, thereby improving the detection accuracy of the drilling inclination angle in the drilling site. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0078] Figure 1 It is a flow chart of the method for identifying and detecting the drilling inclination angle in a drilling field based on the YOLOv8-obb model of the present invention;
[0079] Figure 2 A flowchart for the image rotation of the present invention;
[0080] Figure 3 A flow chart of wavelet transform image denoising of the present invention;
[0081] Figure 4 It is a schematic diagram of the drilling inclination angle of the drilling field of the present invention;
[0082] Figure 5It is a structural diagram of the YOLOv8-obb model of the present invention;
[0083] Figure 6 It is a detailed network structure diagram of the YOLOv8-obb model of the present invention;
[0084] Figure 7 A schematic diagram of the image rotation of the present invention;
[0085] Figure 8 It is a flow chart of the wavelet transform of the present invention;
[0086] Fig. 9 A schematic diagram of the deep learning network structure of the present invention;
[0087] Fig.10 It is a schematic diagram of the angle range of the present invention. DETAILED DESCRIPTION
[0088] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.
[0089] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0090] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0091] like Figures 1 to 10As shown in the figure, it is the best embodiment of the present invention. The method for identifying and detecting the drilling inclination angle in a drilling field based on the YOLOv8-obb model in this embodiment includes the following steps:
[0092] S1. Data collection: Collect drilling inclination angle images of the drilling rig through a camera to form an image dataset of the drilling inclination angle of the drilling rig;
[0093] S2, image data labeling: obtain the image data set in step S1, and use rolabeImg to label the drilling rig, drill rod type, and target frame in the image data;
[0094] S3, data enhancement: obtaining the image dataset annotated in step S2, and performing data enhancement processing on the annotated image dataset by using image rotation and wavelet transform image denoising;
[0095] S4. Build a YOLOv8-obb model and train the YOLOv8-obb model using the image data set after data enhancement to obtain the optimal YOLOv8-obb model.
[0096] S5, obtain the optimal YOLOv8-obb model in step S4, input the drilling rig inclination angle picture into the optimal YOLOv8-obb model, and output the drill rod inclination angle corresponding to the drilling rig inclination angle picture. Thus, by constructing the YOLOv8-obb model to identify and detect the angle of the drill rod, compared with the existing gyroscope measurement method, accelerometer measurement method, and magnetometer measurement method, this method can improve the detection accuracy and detection speed of the drilling inclination angle of the drilling site, and at the same time, it also has a certain anti-interference ability and good real-time performance; the problem of insufficient data volume due to angle change can be solved by rotating the picture; the picture is denoised by wavelet transform, which can improve the picture quality, and then can improve the detection accuracy of the drilling inclination angle of the drilling site.
[0097] Specifically, data enhancement processing can improve the generalization ability and robustness of the YOLOv8-obb model.
[0098] For example, the code for the rolabelImg standard information is:
[0099] <object>
[0100] <type>robndbox< / type>
[0101] <name>Drill rod< / name>
[0102] <pose>Unspecified< / pose>
[0103] <truncated>0< / truncated>
[0104] <difficult>0< / difficult>
[0105] <robndbox>
[0106] <cx>663.3993< / cx>
[0107] <cy>262.3066< / cy>
[0108] <w>143.1592< / w>
[0109] <h>13.9799< / h>
[0110] <angle>0.53<angle>
[0111] < / robndbox>
[0112] <object>;
[0113] The target frame with angle information uses a center point of a target frame, the width, height and angle of the rectangular frame, where the angle information range is 0°-180°.
[0114] In this embodiment, the image rotation includes the following steps:
[0115] S3-1, read the image and obtain the image size: obtain the height h and width w of the image, and calculate the coordinates of the midline point of the image (w / 2, h / 2);
[0116] S3-2, set the rotation angle list: from 0°-360°, set the number of rotated pictures to n, then the rotation interval d=306 / n, and the rotation angle of each rotation interval is a random number between the interval (0, d);
[0117] S3-3, rotating the image for each angle in the defined angle range: first, calculating the rotation matrix based on the coordinates of the center point of the image (w / 2, h / 2) and the current rotation angle r, then calculating the size of the new image according to the rotation matrix, then adjusting the rotation matrix, and finally, rotating the image using the rotation matrix;
[0118] S3-4, image cropping: taking the center point of the image as the center, crop the width and height of the image according to the size of the original image;
[0119] S3-5, save the rotated image;
[0120] In step S3-2, the calculation formula of the rotation angle r is:
[0121] r = (n-1)*d + rand(0, 1);
[0122] In step S3-3, the image rotation formula is as follows:
[0123] i′=icosθ-jsinθ, j′=isinθ+jcosθ;
[0124] Where: (i, j) is the coordinate of the pixel in the original image f(i, j), (i′, j′) is the coordinate of the image g(i′, j′) after the corresponding pixel (i, j) is rotated;
[0125] Wavelet transform image denoising includes the following steps:
[0126] S3-a, generation of noisy images: generating noisy images by adding random noise to the original noise-free images;
[0127] S3-b, wavelet decomposition: performing multi-level wavelet decomposition on the noisy image in step S3-a, decomposing the image signal into different frequencies and scales;
[0128] S3-c, threshold processing: set the threshold, remove the wavelet coefficients of the high-frequency part, and retain the large coefficients of the low-frequency part;
[0129] S3-d, wavelet reconstruction: using the processed wavelet coefficients to perform wavelet reconstruction to obtain a denoised image;
[0130] In step S3, the data enhancement processing methods also include: random scaling, random cropping, color transformation, affine transformation, heat map enhancement, Mixup, CutMix mixed sample technology, and AdvancedData Augmentation; where: random scaling means: adjusting the size of the image to simulate the change in the size of the object in the field of view; random cropping means: randomly cropping some areas from the image to train the YOLOv8-obb model's ability to handle incomplete information; color transformation means: changing the brightness, contrast and saturation of the image to enhance the adaptability of the YOLOv8-obb model to lighting changes; affine transformation means: increasing the diversity of objects in the image through translation and flipping operations; heat map enhancement means: using the heat map of the target object as input when training the YOLOv8-obb model to enhance the YOLOv8-obb model's recognition and detection of the target contour and texture; using Mixup and CutMix mixed sample technology means: increasing the generalization ability of the YOLOv8-obb model by easing two or more images; using Advanced Data Augmentation means: randomly occluding part of the image, ignoring the occluded part when training the YOLOv8-obb model, and focusing on key features. Therefore, by rotating the picture, the YOLOv8-obb model's ability to recognize and detect objects at different angles can be increased to solve the problem of insufficient original picture data. Since the drilling angle range on site is any angle between 0°-306°, the data cycle of the picture data set to collect the entire angle is relatively long. By rotating the picture and generating 0°-360° pictures according to certain rules, the collection time of the picture data set can be shortened. The purpose of the rotation angle of each rotation interval being a random number between the interval (0, d) is to ensure the randomness and diversity of the rotation angle; the purpose of calculating the size of the new image according to the rotation matrix is to ensure the randomness and diversity of the rotation angle. The purpose of adjusting the rotation matrix is to ensure that the center of the rotated image is aligned with the center of the canvas. The principle of wavelet transform image denoising is based on the different characteristics of the image and noise after wavelet transform. After the noisy signal is decomposed by wavelet at each scale, the energy of the image is mainly concentrated in the low-resolution sub-band, while the energy of the noise signal is mainly distributed in each high-frequency sub-band. The absolute value of the wavelet coefficient of the original image information is large, while the absolute value of the wavelet coefficient of the noise information is small. Therefore, by setting a suitable threshold, the noise can be effectively removed while retaining the detailed information of the image.
[0131] For example: in step S3-3, the rotation matrix is adjusted by translation.
[0132] In this embodiment, in step S4, the YOLOv8-obb model includes: Backbone, Neck and Head; wherein: Backbone uses a series of convolutional layers and deconvolutional layers to extract features, and at the same time, uses residual connections and bottleneck structures to reduce the size of the network and improve performance. This part uses the C2f module as the basic building block; Neck uses multi-scale feature fusion technology to fuse feature maps from different stages of Backbone to enhance feature representation capabilities. Neck includes: an SPPF module, a PAA module and two PAN modules; Head is responsible for the final target detection and classification tasks. Head includes: a detection head, a classification head and an angle recognition head. The detection head includes: a series of convolutional layers and deconvolutional layers for generating detection results. The classification head uses global average pooling to classify each feature map and identify the detection target angle.
[0133] The training of the YOLOv8-obb model consists of the following steps:
[0134] S4-1, forward propagate data points through the network to obtain output;
[0135] S4-2, using the loss function to calculate the total error;
[0136] S4-3, use the back propagation algorithm to calculate the gradient of the loss function relative to each weight and bias;
[0137] S4-4, use gradient descent to update the weights and biases of each layer;
[0138] S4-5, repeating steps S4-1 to S4-4 multiple times to minimize the total error;
[0139] The calculation formula of the classification loss function L is:
[0140]
[0141] The calculation formula of the loss function CIOU is:
[0142]
[0143] The calculation formula for the IOU between the predicted box and the real box is:
[0144]
[0145] The calculation formula of the weight function α is:
[0146]
[0147] The calculation formula of aspect ratio v is:
[0148]
[0149] The calculation formula of the loss function DFL is:
[0150]
[0151] Where: N is the number of samples, L is i is the i-th sample loss, y i is the true label of the i-th sample, p i is the predicted value of the i-th sample, S i Represents the probability distribution of the difference between the left side of the predicted border and the true value, S i+1 Represents the probability distribution of the difference between the right side of the predicted border and the true value, y 1 Represents the true value of the i-th sample target box, represents the integral value of the label, Indicates the integral value of the adjacent label;
[0152] The drilling rig target to drill pipe filtering process includes the following steps:
[0153] S4-A, obtaining drilling rig detection information;
[0154] S4-B, filter drill rods by the overlapping area between the drilling rig and the drill rod;
[0155] S4-C, if the number of drill rods to be tested is greater than 1, the target closest to the drilling rig detection angle is retained;
[0156] S4-D, expand the drilling rig angle from 0°-180° to 0°-360°;
[0157] The relative position determination of the drilling rig includes the following steps:
[0158] S4-a, obtaining angle information β of the target drill pipe;
[0159] S4-b, obtain the center position of the target drill rod and record it as (x0, y0);
[0160] S4-c, obtain the center position of the target drilling rig and record it as (x1, y1);
[0161] S4-d, if 0°≤β<90°, x0>x1 and t0>t1, then i=i+180°, if
[0162] 90°≤β<180°, x0>x1 and y0<y1, then i=i+180°. Therefore, the C2f module of the YOLOv8-obb model has fewer parameters and better feature extraction capabilities than the C3 module of the YOLOv5 model. The drilling angle of the drill rod can be obtained by detecting the angle value of the drill rod. The purpose of filtering the drill rod by the drill rig is to prevent false detection (because there are many objects with similar features to the drill rod in the drilling field). Since the angle range of the on-site drill rig is 0°-360°, but the result output by the deep learning network is 0°-180°, for this reason, when marking the detection target, the drill rig whose relative position with the drill rod does not change is marked, and the drill rig is also marked as a detection target when training the YOLOv8-obb model, so that the actual angle of the drill rig can be inferred based on the on-site detection results. Since the result range of the YOLOv8-obb model output is the same angle of 0°-180°, it can distinguish between the 0°-180° range and the 180°-360° range according to the relative position with the drill rig.
[0163] Specifically, training data refers to the image dataset used for YOLOv8-obb model training, including input samples and corresponding labels. The quality and quantity of training data directly affect the performance and generalization ability of the YOLOv8-obb model. The loss function is used to measure the difference between the prediction results of the YOLOv8-obb model on the training data and the true labels. The loss function is designed to minimize the prediction error of the YOLOv8-obb model. Common loss functions include mean squared error and cross entropy. Learning algorithm refers to the algorithm used to update the parameters of the YOLOv8-obb model and minimize the loss function. In deep learning, the common learning algorithm is gradient descent. Descent) and its variants, by calculating the gradient of the loss function to the YOLOv8-obb model parameters, and updating the parameters in the opposite direction of the gradient to gradually reduce the value of the loss function; Error refers to the difference between the predicted results of the YOLOv8-obb model on the training data and the true label, usually measured by the loss function; Optinmizer refers to: in the gradient descent algorithm, the optimizer is responsible for updating the YOLOv8-obb model parameters according to the gradient of the loss function. Common optimizers include: Stochastic Gradient Descent (SGD), Adam, RMSProp, etc., which have different optimization performance and convergence speed.
[0164] Specifically, the total error is propagated backward layer by layer through the connections in the network, and the contribution (gradient) of each weight and bias in each layer to the total error is calculated. Then, the gradient descent algorithm is used to optimize the weights and biases, and finally minimize the total error of the neural network.
[0165] Specifically, the YOLOv8-obb model finally outputs the type of detected target, the target rectangular box and the angle information, where: the type is discrete and is calculated using the classification loss function; the target box and angle information are continuous and the loss function is calculated using CLOU+DFLloss.
[0166] Specifically, the classification loss function uses BCE (binary cross entropy) as the classification loss. Each category is judged whether it belongs to this category and the confidence is output.
[0167] In summary, the angle of the drill rod is identified and detected by constructing the YOLOv8-obb model. Compared with the existing detection methods of gyroscope measurement, accelerometer measurement and magnetometer measurement, this method can improve the detection accuracy and speed of the drilling inclination angle in the drilling field. At the same time, it also has a certain anti-interference ability and good real-time performance. The problem of insufficient data volume due to angle change can be solved by rotating the image. The image is denoised by wavelet transform, which can improve the image quality and thus improve the detection accuracy of the drilling inclination angle in the drilling field.
[0168] The above description is based on the ideal embodiment of the present invention. Through the above description, relevant personnel can make various changes and modifications without departing from the technical concept of the present invention. The technical scope of the present invention is not limited to the content in the specification, and its technical scope must be determined according to the scope of the claims.
Claims
1. A method for identifying and detecting the drilling inclination angle in a drilling field based on the YOLOv8-obb model, characterized in that: The following steps are involved: S1. Data collection: Collect drilling inclination angle images of the drilling rig through a camera to form an image dataset of the drilling inclination angle of the drilling rig; S2, image data labeling: obtain the image data set in step S1, and use rolabeImg to label the drilling rig, drill rod type, and target frame in the image data; S3, data enhancement: obtaining the image dataset annotated in step S2, and performing data enhancement processing on the annotated image dataset by using image rotation and wavelet transform image denoising; S4, constructing a YOLOv8-obb model, and training the YOLOv8-obb model with the image data set after data enhancement to obtain the optimal YOLOv8-obb model; S5. Obtain the optimal YOLOv8-obb model in step S4, input the drilling rig drilling inclination angle picture into the optimal YOLOv8-obb model, and output the drill rod inclination angle corresponding to the drilling rig drilling inclination angle picture.
2. The method for identifying and detecting the drilling inclination angle in a drilling field based on the YOLOv8-obb model according to claim 1 is characterized in that: The picture rotation comprises the following steps: S3-1, read the image and obtain the image size: obtain the height h and width w of the image, and calculate the coordinates of the midline point of the image (w / 2, h / 2); S3-2, set the rotation angle list: from 0° to 360°, set the number of rotated pictures to n, then the rotation interval d = 306 / n, and the rotation angle of each rotation interval is a random number between the interval (0, d); S3-3, rotating the image for each angle in the defined angle range: first, calculating the rotation matrix based on the coordinates of the center point of the image (w / 2, h / 2) and the current rotation angle r, then calculating the size of the new image according to the rotation matrix, then adjusting the rotation matrix, and finally, rotating the image using the rotation matrix; S3-4, Image cropping: Taking the center point of the image as the center, crop the width and height of the image according to the size of the original image; S3-5. Save the rotated image.
3. The method for identifying and detecting the drilling inclination angle in a drilling field based on the YOLOv8-obb model according to claim 2 is characterized in that: In step S3-2, the calculation formula of the rotation angle r is: r = (n-1)*d + rand(0, 1); In step S3-3, the image rotation formula is as follows: i′=i cosθ-j sinθ, j′=isinθ+jcosθ; Where: (i, j) is the coordinate of the pixel point in the original image f(i, j), (i′, j′) is the coordinate of the image g(i′, j′) after the corresponding pixel point (i, j) is rotated.
4. The method for identifying and detecting the drilling inclination angle of a drilling site based on the YOLOv8-obb model according to claim 1, characterized in that: The wavelet transform image denoising comprises the following steps: S3-a, generation of noisy images: generating noisy images by adding random noise to the original noise-free images; S3-b, wavelet decomposition: performing multi-level wavelet decomposition on the noisy image in step S3-a, decomposing the image signal into different frequencies and scales; S3-c, threshold processing: set the threshold, remove the wavelet coefficients of the high-frequency part, and retain the large coefficients of the low-frequency part; S3-d, wavelet reconstruction: Use the processed wavelet coefficients to perform wavelet reconstruction to obtain a denoised image.
5. The method for identifying and detecting the drilling inclination angle of a drilling site based on the YOLOv8-obb model according to claim 1, characterized in that: In step S3, the data enhancement processing method further includes: Random scaling, random cropping, color transformation, affine transformation, heat map enhancement, Mixup, CutMix mixed sample technology, and Advanced Data Augmentation; Among them: Random scaling means: adjusting the image size can simulate the change of the size of the object in the field of view; Random cropping means randomly cropping some areas from the image to train the YOLOv8-obb model's ability to handle incomplete information; Color transformation refers to changing the brightness, contrast, and saturation of the image to enhance the adaptability of the YOLOv8-obb model to lighting changes; Affine transformation means: increasing the diversity of objects in the image through translation and flipping operations; Thermal map enhancement means: when training the YOLOv8-obb model, the thermal map of the target object is used as input to enhance the YOLOv8-obb model's recognition and detection of the target contour and texture; Mixup and CutMix mixed sample technology means: increasing the generalization ability of the YOLOv8-obb model by easing two or more pictures; Using Advanced Data Augmentation means randomly blocking part of the image, ignoring the blocked part when training the YOLOv8-obb model, and focusing on the key features.
6. The method for identifying and detecting the drilling inclination angle in a drilling field based on the YOLOv8-obb model according to claim 1 is characterized in that: In step S4, the YOLOv8-obb model includes: Backbone, Neck and Head; Among them: Backbone uses a series of convolutional layers and deconvolutional layers to extract features. At the same time, it uses residual connections and bottleneck structures to reduce the size of the network and improve performance. This part uses the C2f module as the basic building block; Neck uses multi-scale feature fusion technology to fuse feature maps from different stages of Backbone to enhance feature representation capabilities. Neck includes: an SPPF module, a PAA module, and two PAN modules; The Head is responsible for the final target detection and classification tasks. The Head includes: a detection head, a classification head and an angle recognition head. The detection head contains: a series of convolutional layers and deconvolution layers to generate detection results. The classification head uses global average pooling to classify each feature map and identify the detection target angle.
7. The method for identifying and detecting the drilling inclination angle in a drilling field based on the YOLOv8-obb model according to claim 1 is characterized in that: In step S4, the training of the YOLOv8-obb model includes the following steps: S4-1, forward propagating data points through the network to obtain output; S4-2, using the loss function to calculate the total error; S4-3, use the back propagation algorithm to calculate the gradient of the loss function relative to each weight and bias; S4-4, use gradient descent to update the weights and biases of each layer; S4-5. Repeat steps S4-1 to S4-4 multiple times to minimize the total error.
8. The method for identifying and detecting the drilling inclination angle in a drilling field based on the YOLOv8-obb model according to claim 1, characterized in that: In step S4, the calculation formula of the classification loss function L is: The calculation formula of the loss function CI0U is: The calculation formula of the intersection-over-union ratio (I0U) between the predicted box and the real box is: The calculation formula of the weight function α is: The calculation formula of aspect ratio v is: The calculation formula of the loss function DFL is: Where: N is the number of samples, L is i is the i-th sample loss, y i is the true label of the i-th sample, p i is the predicted value of the i-th sample, S i Represents the probability distribution of the difference between the left side of the predicted border and the true value, S i+1 Represents the probability distribution of the difference between the right side of the predicted border and the true value, y 1 Represents the true value of the i-th sample target box, represents the integral value of the label, Indicates the integral value of the neighboring label.
9. The method for identifying and detecting the drilling inclination angle in a drilling field based on the YOLOv8-obb model according to claim 1, characterized in that: In step S4, the drilling rig target to drill rod filtering process includes the following steps: S4-A, obtaining drilling rig detection information; S4-B, filter drill rods by the overlapping area between the drilling rig and the drill rod; S4-C, if the number of drill rods to be tested is greater than 1, the target closest to the drilling rig detection angle is retained; S4-D, expand the drilling rig angle from 0°-180° to 0°-360°.
10. The method for identifying and detecting the drilling inclination angle in a drilling field based on the YOLOv8-obb model according to claim 1, characterized in that: In step S4, the relative position determination of the drilling rig includes the following steps: S4-a, obtaining angle information β of the target drill pipe; S4-b, obtain the center position of the target drill rod and record it as (x0, y0); S4-c, obtain the center position of the target drilling rig and record it as (x1, y1); S4-d. If 0°≤β<90°, x0>x1 and y0>y1, then i=i+180°; if 90°≤β<180°, x0>x1 and y0<y1, then i=i+180°.