A method for accurately fitting a complex environmental borehole profile
Patent Information
- Application Number
- CN202410652956.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2044-05-24
AI Technical Summary
[0005]本发明所要解决的技术问题是现有技术中在隧道、地下厂房等复杂施工环境下难以通过传统椭圆检测方法精准拟合钻孔口轮廓椭圆等技术问题
[0031]Beneficial Effects: This invention proposes a method for accurately fitting borehole contours in complex environments. First, a deep learning method is used to train a basic detection model to obtain a target detection model. Then, an image of the borehole's detection area is acquired using an image acquisition device, and this image is preprocessed to obtain an initial image. This initial image is then input into the target detection model. A camera image-based rapid borehole target extraction method is used to extract the borehole contour region image from the initial image, enabling rapid detection of borehole targets in the initial image. Furthermore, the deep learning-based target detection model exhibits high anti-interference performance. An edge detector is used to extract an initial borehole region arc segment group from the borehole contour region image. Then, concavity/convexity constraints, saliency constraints, directional constraints, and quadrant constraints are sequentially applied to this initial borehole region arc segment group to filter out the initial boreholes. After removing noisy arc segments from the region arc segment group that do not meet the constraints, a potential borehole contour arc segment group is obtained. Then, the initial ellipse hybrid evaluation method is used to process the potential borehole contour arc segment group and the borehole contour region image to further remove noisy arc segments, resulting in an initial ellipse. Finally, the initial ellipse is used as the initial value for the iteration of the borehole contour ellipse. The borehole contour ellipse is obtained by fitting the potential borehole contour arc segment group and the initial ellipse using the borehole contour iterative fitting method. By using relevant theories based on computer vision to perform detailed and accurate ellipse fitting on the borehole contour region image, it has high ellipse accuracy. Combined with deep learning, it can achieve robust fitting of borehole contours in complex on-site construction environments such as tunnels and underground power plants, which is more reliable, accurate and stable. Moreover, it can be achieved with only image acquisition equipment such as industrial cameras, which is low-cost, quick to operate and easy to deploy.
Smart Images

Figure CN118570237B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image data processing, and specifically relates to a method for accurately fitting borehole contours in complex environments. Background Technology
[0002] In geological work, a wellbore with a small diameter and a certain depth, drilled into the ground using a drilling rig, is generally referred to as a borehole. Borehole surveying plays an extremely important role in borehole quality inspection, borehole orientation, mineral resource assessment, and well construction engineering. The typical construction cycle of a borehole can be summarized as a cycle of "layout-drilling-hole location." Laying out and drilling using large mechanical equipment such as rock drilling rigs can achieve automated, safe, and rapid construction. However, the location of the completed borehole, except in cases of self-drilling and self-installation, generally still relies on manual measurement for hole location. This significantly prolongs the borehole construction cycle and hinders the development of fully automated borehole construction.
[0003] Currently, existing technologies typically employ traditional ellipse detection methods such as voting (clustering), random Hough transform ellipse detection algorithms, and arc-segment-based methods to automatically detect borehole contours for operations like borehole location and layout. These methods are primarily suited for everyday scenarios where the ellipse to be detected in the edge image is clear and complete, with a significant difference from the background contour, resulting in relatively low accuracy. However, under complex construction conditions, the number and location of the objects to be detected in borehole contour images are unknown, and the edge image contains a large number of interfering edges. Furthermore, the uneven surface of the tunnel lining, complex lighting conditions, and image quality all contribute to the problem. The borehole contour that is of primary concern is often incomplete and superimposed on interfering edges, which undoubtedly increases the difficulty of detecting the borehole contour and reduces the accuracy of traditional ellipse detection methods, making them unsuitable for complex construction environments.
[0004] Therefore, how to provide a method for accurately fitting the borehole profile in complex environments, so as to accurately fit the elliptical profile of the borehole in complex construction environments, is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] The technical problem to be solved by the present invention is that it is difficult to accurately fit the borehole opening contour ellipse using traditional ellipse detection methods in complex construction environments such as tunnels and underground power plants.
[0006] To address the aforementioned problems, this invention provides a method for accurately fitting borehole contours in complex environments, comprising: S1 training a basic detection model using deep learning to obtain a target detection model; S2 acquiring a target image of the borehole's detection area using an image acquisition device, and performing image preprocessing on the target image to obtain an initial image to be processed; S3 inputting the initial image to be processed into the target detection model, and extracting the borehole contour region image from the initial image to be processed using a camera image borehole target fast extraction method; S4 extracting the borehole contour region image from the borehole contour region image using an edge detector. S5. Initial borehole region arc segment group; S6. Apply concavity / convexity constraints, saliency constraints, directional constraints, and quadrant constraints to the initial borehole region arc segment group in sequence, and remove arc segments in the initial borehole region arc segment group that do not meet the constraint conditions to obtain a potential borehole contour arc segment group; S7. Process the potential borehole contour arc segment group and the borehole contour region image using the initial ellipse hybrid evaluation method to obtain an initial ellipse; S8. Use the initial ellipse as the initial value for the iteration of the borehole contour ellipse, and use the borehole contour iterative fitting method to fit the potential borehole contour arc segment group and the initial ellipse to obtain the borehole contour ellipse.
[0007] As a further technical solution of the present invention, in S1, the step of training the basic detection model using deep learning to obtain the target detection model includes: S101 acquiring several learning images containing borehole openings from the target engineering area, performing image preprocessing on the several learning images to obtain several preprocessed images, marking the bounding rectangle of the borehole opening contour in each of the preprocessed images, forming a borehole contour image database through the several bounding rectangles, and splitting the borehole contour image database into a training database and a test database proportionally; S102 inputting the training database into the basic detection model, training the model network weights of the basic detection model, and using the test database to calculate the detection accuracy of the basic detection model, and determining whether the detection accuracy reaches a preset value; S103 if yes, then the target detection model is obtained; if no, then repeating S102 until the detection accuracy reaches the preset value, then the target detection model is obtained.
[0008] As a further technical solution of the present invention, in S3, the method of rapidly extracting drilling targets from the initial image to be processed by using camera images to extract drilling contour region images includes: obtaining the length, width, and center coordinates of the target rectangle of the drilling contour in the initial image to be processed through the target detection model; taking the center coordinates of the target rectangle as the center and using the length and width of the target rectangle as a multiple of the target rectangle as the length and width of the drilling contour region; extracting the drilling contour region from the initial image to be processed; and performing adaptive histogram balancing on the drilling contour region to obtain the drilling contour region image.
[0009] As a further technical solution of the present invention, in S4, the step of extracting the initial borehole region arc segment group from the borehole contour region image using an edge detector includes: obtaining several edge points in the borehole contour region image using an edge detector, connecting the several edge points to obtain several edge arc segments, and combining the several edge arc segments to form the initial borehole region arc segment group; the edge detector includes a Canny edge detector or an EdgeDrawing edge detector.
[0010] As a further technical solution of the present invention, in S5, the step of sequentially applying concavity-convexity constraints, saliency constraints, directional constraints, and quadrant constraints to the initial borehole region arc segment group, and filtering out arc segments in the initial borehole region arc segment group that do not meet the constraint conditions, to obtain a potential borehole contour arc segment group includes: S501 calculating the slope of each point in each edge arc segment in the initial borehole region arc segment group according to the point order based on formula (1). And at the point where the sign of the slope changes, each edge arc segment is broken to obtain several new arc segments, and several new arc segments are combined to form a new arc segment group;
[0011]
[0012] In the above formula (1), Let the slope be the slope of the j-th point of the i-th edge arc segment. Let J be the X-axis coordinate of the j-th point of the i-th edge arc segment. Let J be the Y-coordinate of the j-th point on the i-th edge arc segment. Let J be the X-axis coordinate of the (j+1)th point of the i-th edge arc segment. Let be the Y-axis coordinate of the (j+1)th point of the i-th edge arc segment; S502 apply saliency constraints to filter out the new arc segments in the new arc segment group whose length is less than the first preset threshold, and obtain a saliency arc segment group; S503 divide each new arc segment in the saliency arc segment group into a center-facing arc segment and a center-reverse arc segment according to formula (2), filter out the center-reverse arc segments in the saliency arc segment group, and obtain a center-facing arc segment group composed of several center-facing arc segments;
[0013]
[0014] In equation (2), Ω i For the i-th new arc segment, Ω forward To the central arc segment, {Ω forward} represents the arc segment group oriented towards the center, Ω backward For the arc segment facing away from the center, {Ω backward} is a group of arc segments facing away from the center. Let N0 be the j-th point of the i-th new arc segment, and N0 be the second preset threshold. The feature triangle is formed by the starting point of the i-th new arc segment, the ending point of the i-th new arc segment, and the midpoint of the borehole contour area image as the three corner points; S504 distinguishes several of the arc segments facing the center in the arc segment group according to formula (3) to obtain a four-quadrant arc segment group.
[0015]
[0016] In equation (3), {Ω1} is the arc segment group in the first quadrant, {Ω2} is the arc segment group in the second quadrant, {Ω3} is the arc segment group in the third quadrant, {Ω4} is the arc segment group in the fourth quadrant, U is the area of the upper half of the circumscribed rectangle of each arc segment facing the center divided by the arc segment facing the center, and O is the area of the lower half of the circumscribed rectangle of each arc segment facing the center divided by the arc segment facing the center; S505 After filtering out the arc segments facing the center that are not within the coordinate range of their respective quadrants in the arc segment group, the potential borehole profile arc segment group is obtained.
[0017] As a further technical solution of the present invention, in S6, the step of processing the potential borehole contour arc segment group and the borehole contour region image using the initial ellipse hybrid evaluation method to obtain an initial ellipse includes: S601 selecting all edge points in the potential borehole contour arc segment group as valid edge points, and performing ellipse fitting on the valid edge points using the least squares method, and obtaining the fitting ellipse rotation angle θ. arc S602 Select an inclination angle from -90° to 90°, the slope of which is k. Draw several straight lines with a slope of k at equal intervals on the borehole contour region image. The several straight lines form a line group. Extract the pixels on each of the straight lines in the line group to form a corresponding measurement line. The several measurement lines form a measurement line group. S603 Use a threshold segmentation algorithm to distinguish all pixels in one of the measurement lines in the measurement line group into dark-colored pixels and light-colored pixels. Calculate the slope k from the centroid of the dark-colored pixels to the center point of the borehole contour region image. m And calculate the initial ellipse rotation angle θ according to equation (4). temp ;
[0018]
[0019] In equation (4), H is the height of the target rectangle, W is the width of the target rectangle, α is the first auxiliary operator, β is the second auxiliary operator, k' is the correction slope, and n is the aspect ratio of the target rectangle; S604 Repeat step S603 to calculate an initial ellipse rotation angle corresponding to each survey line in the survey line group, and evaluate the intermediate ellipse rotation angle θ corresponding to the survey line group from several initial ellipse rotation angles using an evaluation method. k S605 Repeat steps S602 to S604 to obtain a result consisting of several intermediate ellipses rotated by angles θ. k The intermediate ellipse rotation angle group {θ k The evaluation method is used to determine the rotation angle θ of the fitted ellipse. arc With the rotation angle group {θ of the intermediate ellipse k The final initial ellipse rotation angle θ is determined through evaluation. init S606 determines the semi-major axis length a of the initial ellipse according to equation (5). init and the semi-minor axis length b of the initial ellipse init The center point of the borehole contour region image is used as the center point of the initial ellipse to obtain the initial ellipse;
[0020]
[0021] As a further technical solution of the present invention, in S7, the drilling profile iterative fitting method is used to fit the potential drilling profile arc segment group and the initial ellipse to obtain the drilling profile ellipse, including: S701 calculating the algebraic distance d from each edge point in the potential drilling profile arc segment group to the initial ellipse according to equation (6). j One edge point corresponds to one algebraic distance. Several algebraic distances are sorted by size, and n edge points corresponding to n algebraic distances are selected in descending order. The n edge points are deleted from all edge points in the borehole profile arc segment group to obtain several remaining edge points. The n is m times the number of all edge points in the borehole profile arc segment group.
[0022]
[0023] In equation (6), A, B, C, D, E, and F are the coefficients of any ellipse equation in the general equation of an ellipse; S702 counts the number of remaining edge points and determines whether the number of remaining edge points is lower than a preset threshold; if so, the ellipse of the current iteration is used as the drilling profile ellipse; if not, the least squares method is used to fit the ellipse, and the equivalent intersection-union ratio (EIOU) between the ellipse of the current i-th iteration and the ellipse of the (i-1)-th iteration is calculated according to equation (7). i,i-1 ;
[0024]
[0025] In the above formula (7), Let be the area of the intersection region between the minimum bounding rectangle of the ellipse in the i-th iteration and the minimum bounding rectangle of the ellipse in the (i-1)-th iteration. Let the area be the area of the region where the minimum bounding rectangle of the ellipse in the i-th iteration is merged with the minimum bounding rectangle of the ellipse in the (i-1)-th iteration; determine the EIOU. i,i-1 If the value is greater than the set convergence threshold, then the ellipse of the current iteration is taken as the borehole profile ellipse; otherwise, the S701 to S702 operations are repeated.
[0026] As a further technical solution of the present invention, the basic detection model includes the YOLO model or the FastRCNN model; the image preprocessing includes distortion correction, grayscale conversion and adaptive histogram balancing.
[0027] As a further technical solution of the present invention, the threshold segmentation algorithm includes the K-means clustering algorithm or the Otsu threshold segmentation algorithm; the evaluation method includes mean evaluation, mode evaluation or median evaluation.
[0028] As a further technical solution of the present invention, the minimum bounding rectangle of the ellipse in the w-th iteration is composed of the four corner points {R w} constraints, R w Obtained through equation (8);
[0029] R w ={(xcos(θ)-ysin(θ),xsin(θ)+ycos(θ))|x=±a,y=±b} (8);
[0030] Where w is i or i-1; a is the length of the semi-major axis of the ellipse in the w-th iteration; b is the length of the semi-minor axis of the ellipse in the w-th iteration; and θ is the rotation angle of the ellipse in the w-th iteration.
[0031] Beneficial Effects: This invention proposes a method for accurately fitting borehole contours in complex environments. First, a deep learning method is used to train a basic detection model to obtain a target detection model. Then, an image of the borehole's detection area is acquired using an image acquisition device, and this image is preprocessed to obtain an initial image. This initial image is then input into the target detection model. A camera image-based rapid borehole target extraction method is used to extract the borehole contour region image from the initial image, enabling rapid detection of borehole targets in the initial image. Furthermore, the deep learning-based target detection model exhibits high anti-interference performance. An edge detector is used to extract an initial borehole region arc segment group from the borehole contour region image. Then, concavity / convexity constraints, saliency constraints, directional constraints, and quadrant constraints are sequentially applied to this initial borehole region arc segment group to filter out the initial boreholes. After removing noisy arc segments from the region arc segment group that do not meet the constraints, a potential borehole contour arc segment group is obtained. Then, the initial ellipse hybrid evaluation method is used to process the potential borehole contour arc segment group and the borehole contour region image to further remove noisy arc segments, resulting in an initial ellipse. Finally, the initial ellipse is used as the initial value for the iteration of the borehole contour ellipse. The borehole contour ellipse is obtained by fitting the potential borehole contour arc segment group and the initial ellipse using the borehole contour iterative fitting method. By using relevant theories based on computer vision to perform detailed and accurate ellipse fitting on the borehole contour region image, it has high ellipse accuracy. Combined with deep learning, it can achieve robust fitting of borehole contours in complex on-site construction environments such as tunnels and underground power plants, which is more reliable, accurate and stable. Moreover, it can be achieved with only image acquisition equipment such as industrial cameras, which is low-cost, quick to operate and easy to deploy. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 This is a flowchart of a method for accurately fitting borehole profiles in complex environments, as described in an embodiment of the present invention.
[0034] Figure 2 This is a diagram illustrating the overall technical roadmap of the method for accurately fitting borehole profiles in complex environments, as described in this invention.
[0035] Figure 3 This is the initial image to be processed in this embodiment of the invention;
[0036] Figure 4 This is a schematic diagram of the target rectangle in the camera image drilling target rapid extraction method in an embodiment of the present invention;
[0037] Figure 5 This is an image of the borehole contour area in an embodiment of the present invention;
[0038] Figure 6 This is a schematic diagram of the initial drilling area arc segment group in an embodiment of the present invention;
[0039] Figure 7 This is a schematic diagram of a group of significant arc segments in an embodiment of the present invention;
[0040] Figure 8 This is a schematic diagram of the central arc segment group in an embodiment of the present invention;
[0041] Figure 9 This is a schematic diagram of the potential borehole profile arc segment group in an embodiment of the present invention;
[0042] Figure 10 This is a schematic diagram of the survey line group and the midpoint of the survey line in an embodiment of the present invention;
[0043] Figure 11 This is a schematic diagram of the equivalent crossover-union ratio in an embodiment of the present invention;
[0044] Figure 12 This is a schematic diagram of the fitting result of the borehole profile ellipse obtained in an embodiment of the present invention. Detailed Implementation
[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0046] Example 1
[0047] like Figure 1As shown, this embodiment provides a method for accurate fitting of borehole contours in complex environments, including: S1 training a basic detection model using deep learning to obtain a target detection model; S2 acquiring a target image of the borehole's detection area using an image acquisition device, and performing image preprocessing on the target image to obtain an initial target image; S3 inputting the initial target image into the target detection model, and using a camera image borehole target fast extraction method to extract the borehole contour region image from the initial target image; S4 using an edge detector to extract the initial target image from the borehole contour region image. S5. The initial borehole region arc segment group is sequentially subjected to concavity / convexity constraints, saliency constraints, directional constraints, and quadrant constraints. After filtering out arc segments in the initial borehole region arc segment group that do not meet the constraint conditions, a potential borehole contour arc segment group is obtained. S6. The potential borehole contour arc segment group and the borehole contour region image are processed using the initial ellipse hybrid evaluation method to obtain an initial ellipse. S7. The initial ellipse is used as the initial value for the iteration of the borehole contour ellipse. The borehole contour ellipse is obtained by fitting the potential borehole contour arc segment group and the initial ellipse using the borehole contour iterative fitting method. The image acquisition device includes an industrial camera.
[0048] Specifically, this invention proposes a method for accurately fitting borehole contours in complex environments. First, a deep learning method is used to train a basic detection model to obtain a target detection model. Then, an image of the target area of the borehole is acquired using an image acquisition device, and the image is preprocessed to obtain an initial image. This initial image is then input into the target detection model. A camera image-based rapid borehole target extraction method is used to extract the borehole contour region image from the initial image, enabling rapid detection of the borehole target in the initial image. Furthermore, the deep learning-based target detection model exhibits high anti-interference performance. An edge detector is used to extract an initial borehole region arc segment group from the borehole contour region image. Then, the initial borehole region arc segment group is subjected to concavity / convexity constraints, saliency constraints, directional constraints, and quadrant constraints in sequence to filter out the initial... After removing the arc segments in the initial borehole region arc segment group that do not meet the constraints (i.e., noise arc segments), a potential borehole contour arc segment group is obtained. Then, the initial ellipse hybrid evaluation method is used to process the potential borehole contour arc segment group and the borehole contour region image to further remove noise arc segments, resulting in an initial ellipse. Finally, the initial ellipse is used as the initial value for the iteration of the borehole contour ellipse. The borehole contour ellipse is obtained by fitting the potential borehole contour arc segment group and the initial ellipse using the borehole contour iterative fitting method. By using relevant theories based on computer vision to perform detailed and accurate ellipse fitting on the borehole contour region image, it has high ellipse accuracy. Combined with deep learning, it can achieve robust fitting of borehole contours in complex on-site construction environments such as tunnels and underground power plants, which is more reliable, accurate and stable. Moreover, it can be achieved with only image acquisition equipment such as industrial cameras, which is low-cost, quick to operate and easy to deploy.
[0049] In some possible implementations, in S1, training the basic detection model using deep learning to obtain the target detection model includes: S101 acquiring several learning images containing borehole openings from the target engineering area, performing image preprocessing on the several learning images to obtain several preprocessed images, manually marking the bounding rectangles of the borehole opening contours in each preprocessed image, forming a borehole contour image database using the several bounding rectangles, and proportionally splitting the borehole contour image database into a training database and a test database; S102 inputting the training database into the basic detection model, training the model network weights of the basic detection model, and using the test database to calculate the detection accuracy of the basic detection model, and determining whether the detection accuracy reaches a preset value; S103 if yes, then the target detection model is obtained; if no, then repeating S102 until the detection accuracy reaches the preset value, then the target detection model is obtained.
[0050] This is because by training the basic detection model with a training database and judging the detection accuracy of the basic detection model with a test database, the detection accuracy of the target detection model obtained after the basic detection model is trained can reach a certain value, which can correctly identify the drilling target and roughly mark the location of the drilling, for subsequent accurate fitting based on machine vision.
[0051] In some possible implementations, in S3, the method for rapidly extracting drilling targets from the initial image to be processed using camera images includes: obtaining the length, width, and center coordinates of the target rectangle of the drilling contour in the initial image to be processed through the target detection model; using the center coordinates of the target rectangle as the center and the length and width of the target rectangle as a multiple of the target rectangle as the length and width of the drilling contour region; extracting the drilling contour region from the initial image to be processed; and performing adaptive histogram balancing on the drilling contour region to obtain the drilling contour region image.
[0052] Those skilled in the art will understand that by obtaining the length, width, and center coordinates of the target rectangle of the borehole contour in the initial image to be processed through the target detection model, and using the center coordinates of the target rectangle as the center, the length and width of the target rectangle as a multiple of the target rectangle are used as the length and width of the borehole contour region. The borehole contour region is then extracted from the initial image to be processed, and adaptive histogram balancing is performed on the borehole contour region to lock the borehole target in the initial image to be processed, thereby obtaining a borehole contour region image containing the target borehole, thus narrowing the processing range of the initial image to be processed, which is beneficial for subsequent ellipse fitting.
[0053] In some possible implementations, in S4, the step of extracting an initial borehole region arc segment group from the borehole contour region image using an edge detector includes: obtaining several edge points in the borehole contour region image using an edge detector, connecting the several edge points to obtain several edge arc segments, and combining the several edge arc segments to form the initial borehole region arc segment group; the edge detector includes a Canny edge detector or an Edge Drawing edge detector.
[0054] Those skilled in the art will understand that using an edge detector to obtain several edge points in a borehole contour region image, connecting these edge points to obtain several edge arc segments, and combining these edge arc segments to form the initial borehole region arc segment group can be used to extract potential arc segments belonging to the borehole contour from the borehole contour region image.
[0055] In some possible implementations, in S5, the step of sequentially applying concavity / convexity constraints, saliency constraints, directional constraints, and quadrant constraints to the initial borehole region arc segment group, and then filtering out arc segments in the initial borehole region arc segment group that do not meet the constraint conditions, to obtain the potential borehole profile arc segment group includes: S501 calculating the slope of each point in each edge arc segment in the initial borehole region arc segment group according to the point order based on equation (1). And at the point where the sign of the slope changes, each edge arc segment is broken to obtain several new arc segments, and several new arc segments are combined to form a new arc segment group;
[0056]
[0057] In the above formula (1), Let the slope be the slope of the j-th point of the i-th edge arc segment. Let J be the X-axis coordinate of the j-th point of the i-th edge arc segment. Let J be the Y-coordinate of the j-th point on the i-th edge arc segment. Let J be the X-axis coordinate of the (j+1)th point of the i-th edge arc segment. Let be the Y-axis coordinate of the (j+1)th point of the i-th edge arc segment; S502 apply saliency constraints to filter out the new arc segments in the new arc segment group whose length is less than the first preset threshold, and obtain a saliency arc segment group; S503 divide each new arc segment in the saliency arc segment group into a center-facing arc segment and a center-reverse arc segment according to formula (2), filter out the center-reverse arc segments in the saliency arc segment group, and obtain a center-facing arc segment group composed of several center-facing arc segments;
[0058]
[0059] In equation (2), Ω i For the i-th new arc segment, Ω forward To the central arc segment, {Ω forward} represents the arc segment group oriented towards the center, Ω backward For the arc segment facing away from the center, {Ω backward} is a group of arc segments facing away from the center. Let N0 be the j-th point of the i-th new arc segment, and N0 be the second preset threshold. The feature triangle is formed by the starting point of the i-th new arc segment, the ending point of the i-th new arc segment, and the midpoint of the borehole contour area image as the three corner points; S504 distinguishes several of the arc segments facing the center in the arc segment group according to formula (3) to obtain a four-quadrant arc segment group.
[0060]
[0061] In equation (3), {Ω1} is the arc segment group in the first quadrant, {Ω2} is the arc segment group in the second quadrant, {Ω3} is the arc segment group in the third quadrant, {Ω4} is the arc segment group in the fourth quadrant, U is the area of the upper half of the circumscribed rectangle of each arc segment facing the center divided by the arc segment facing the center, and O is the area of the lower half of the circumscribed rectangle of each arc segment facing the center divided by the arc segment facing the center; S505 After filtering out the arc segments facing the center that are not within the coordinate range of their respective quadrants in the arc segment group, the potential borehole profile arc segment group is obtained.
[0062] This is because the slope calculated by equation (1) can avoid the problem of infinite values in the slope shown in equation (9) during the calculation process; each new arc segment in the significant arc segment group obtained after concavity and convexity constraints and significance constraints is a simple concave or simple convex arc segment with a certain length, so as to avoid the influence of the tortuousness of the new arc segment on the subsequent constraint calculation; by filtering out the arc segments facing away from the center in the significant arc segment group through directional constraints, it is equivalent to adding an orientation filter to the new arc segment, further narrowing the range of potential arc segments; the potential borehole profile arc segment group obtained after the above concavity and convexity constraints, significance constraints, directional constraints and quadrant constraints, filters out most of the invalid noise arc segments, so that the remaining arc segments meet the basic requirements of the synthetic ellipse, which is conducive to the accurate fitting of the ellipse.
[0063]
[0064] In some possible implementations, in S6, processing the potential borehole contour arc segment group and the borehole contour region image using the initial ellipse hybrid evaluation method to obtain an initial ellipse includes: S601 selecting all edge points in the potential borehole contour arc segment group as valid edge points, and performing ellipse fitting on the valid edge points using the least squares method, obtaining the fitted ellipse rotation angle θ. arc S602 Select an inclination angle from -90° to 90°, the slope of which is k. Draw several straight lines with a slope of k at equal intervals on the borehole contour region image. The several straight lines form a line group. Extract the pixels on each of the straight lines in the line group to form a corresponding measurement line. The several measurement lines form a measurement line group. S603 Use a threshold segmentation algorithm to distinguish all pixels in one of the measurement lines in the measurement line group into dark-colored pixels and light-colored pixels. Calculate the slope k from the centroid of the dark-colored pixels to the center point of the borehole contour region image. m And calculate the initial ellipse rotation angle θ according to equation (4). temp ;
[0065]
[0066] In equation (4), absmin() represents the angle with the smallest absolute value among two angles, H is the height of the target rectangle, W is the width of the target rectangle; α is the first auxiliary operator, β is the second auxiliary operator, k' is the correction slope, and n is the aspect ratio of the target rectangle; S604 repeat step S603 to calculate an initial ellipse rotation angle corresponding to each survey line in the survey line group, and evaluate the intermediate ellipse rotation angle θ corresponding to the survey line group from several initial ellipse rotation angles using the evaluation method. k S605 Repeat steps S602 to S604 to obtain a result consisting of several intermediate ellipses rotated by angles θ. k The intermediate ellipse rotation angle group {θ k The evaluation method is used to determine the rotation angle θ of the fitted ellipse. arc With the rotation angle group {θ of the intermediate ellipse k The final initial ellipse rotation angle θ is determined through evaluation. init S606 determines the semi-major axis length a of the initial ellipse according to equation (5). init and the semi-minor axis length b of the initial ellipse init The center point of the borehole contour region image is used as the center point of the initial ellipse to obtain the initial ellipse;
[0067]
[0068] In some possible implementations, in S7, the process of obtaining a borehole profile ellipse by fitting the potential borehole profile arc segment group and the initial ellipse using the borehole profile iterative fitting method includes: S701 calculating the algebraic distance d from each edge point in the potential borehole profile arc segment group to the initial ellipse according to equation (6). j One edge point corresponds to one algebraic distance. Several algebraic distances are sorted by size, and n edge points corresponding to n algebraic distances are selected in descending order. The n edge points are deleted from all edge points in the borehole profile arc segment group to obtain several remaining edge points. The n is m times the number of all edge points in the borehole profile arc segment group.
[0069]
[0070] In equation (6), A, B, C, D, E, and F are the coefficients of any ellipse equation in the general equation of an ellipse; S702 counts the number of remaining edge points and determines whether the number of remaining edge points is lower than a preset threshold; if so, the ellipse of the current iteration is used as the drilling profile ellipse; if not, the least squares method is used to fit the ellipse, and the equivalent intersection-union ratio (EIOU) between the ellipse of the current i-th iteration and the ellipse of the (i-1)-th iteration is calculated according to equation (7). i,i-1 ;
[0071]
[0072] In the above formula (7), Let be the area of the intersection region between the minimum bounding rectangle of the ellipse in the i-th iteration and the minimum bounding rectangle of the ellipse in the (i-1)-th iteration. Let the area be the area of the region where the minimum bounding rectangle of the ellipse in the i-th iteration is merged with the minimum bounding rectangle of the ellipse in the (i-1)-th iteration; determine the EIOU. i,i-1 If the value is greater than the set convergence threshold, then the ellipse of the current iteration is taken as the borehole profile ellipse; otherwise, the S701 to S702 operations are repeated.
[0073] This is because the above-mentioned initial ellipse mixed evaluation method and borehole profile iterative fitting method can further eliminate noisy arc segments in the potential borehole profile arc segment group and accurately fit the borehole profile ellipse.
[0074] In some possible implementations, the underlying detection model includes the YOLO model or the Fast RCNN model; the image preprocessing includes distortion correction, grayscale conversion, and adaptive histogram balancing.
[0075] In some possible implementations, the threshold segmentation algorithm includes the K-means clustering algorithm or the Otsu threshold segmentation algorithm; the evaluation method includes mean evaluation, mode evaluation, or median evaluation.
[0076] In some possible implementations, the minimum bounding rectangle of the ellipse in the w-th iteration is formed by the four corner points {R}. w} constraints, R w Obtained through equation (8);
[0077] R w ={(xcos(θ)-ysin(θ),xsin(θ)+ycos(θ))|x=±a,y=±b} (8);
[0078] Where w is i or i-1; a is the length of the semi-major axis of the ellipse in the w-th iteration; b is the length of the semi-minor axis of the ellipse in the w-th iteration; and θ is the rotation angle of the ellipse in the w-th iteration.
[0079] Example 2
[0080] This second embodiment provides a method for accurately fitting borehole profiles in complex environments, including:
[0081] S1 uses deep learning to train the basic detection model to obtain the target detection model; in S1, the process of using deep learning to train the basic detection model to obtain the target detection model includes:
[0082] S101 uses an on-site imaging device to acquire 290 learning images containing borehole openings from the target engineering area. These 290 images undergo distortion correction, grayscale conversion, and adaptive histogram balancing in sequence to obtain 290 preprocessed images. The width, height, and center pixel coordinates of the bounding rectangle of the borehole opening outline in each preprocessed image are manually marked. For example, the center pixel coordinates of the bounding rectangle of the borehole opening outline in one preprocessed image are (1520.5, 486), the width of the bounding rectangle is 289 pixels, and the height is 276 pixels, i.e., the horizontal pixel range is [1376, 1665], and the vertical pixel range is [348, 624]. A borehole outline image database is formed using these 290 bounding rectangles. This database is then randomly split into 203 images at a 7:3 ratio as the training database, and the remaining 86 images are used as the test database.
[0083] S102 Input the training database into the YOLO V7 model, train the model network weights of the YOLO V7 model, and use the test database to calculate the detection accuracy of the YOLO V7 model, and determine whether the detection accuracy reaches the preset value of 90%.
[0084] If S103 is true, then the target detection model is obtained; if not, then S102 is repeated until the detection accuracy reaches 90%, then the target detection model is obtained.
[0085] S2 acquires the image of the area to be detected in the borehole through an image acquisition device, and performs image preprocessing on the image to be detected in sequence, including distortion correction, grayscale conversion and adaptive histogram balancing, to obtain the initial image to be processed.
[0086] S3 inputs the initial image to be processed into the target detection model, and uses a camera image drilling target fast extraction method to extract the drilling contour region image from the initial image to be processed; S3, the step of using the camera image drilling target fast extraction method to extract the drilling contour region image from the initial image to be processed includes: the initial image to be processed is detected by the YOLO V7 model, and it is considered that the region of the initial image to be processed has a 90% probability of being a drilling hole, and the center coordinates of the target rectangle of the drilling contour in the initial image to be processed are obtained as (1520, 492.5), the width of the target rectangle is 284 pixels, and the height is 299 pixels, that is, the horizontal pixel range is [1378, 1662], and the vertical pixel range is [343, 642]. It can be found that after training YOLO... The V7 model can correctly identify the drilling target and roughly mark the location of the drilling hole for subsequent accurate fitting based on machine vision. Then, using the center coordinates of the target rectangle as the center, and using the length and width of the target rectangle as a multiple of 1.1 as the length and width of the drilling outline region, the drilling outline region is extracted from the initial image to be processed. The center pixel coordinates of the drilling outline region are (1520, 492.5), the width is 312 pixels, and the height is 328 pixels. Adaptive histogram balancing is performed on the drilling outline region to obtain the drilling outline region image.
[0087] S4 uses an edge detector to extract an initial group of borehole region arc segments from the borehole contour region image; in S4, the extraction of the initial group of borehole region arc segments from the borehole contour region image using an edge detector includes: using an EdgeDrawing edge detector to obtain several edge points in the borehole contour region image, connecting the several edge points to obtain several edge arc segments, and combining the several edge arc segments to form the initial group of borehole region arc segments, such as... Figure 3 As shown;
[0088] S5 sequentially applies concavity / convexity constraints, saliency constraints, directional constraints, and quadrant constraints to the initial borehole region arc segment group, and after filtering out arc segments in the initial borehole region arc segment group that do not meet the constraint conditions, obtains a potential borehole contour arc segment group; S5, the step of sequentially applying concavity / convexity constraints, saliency constraints, directional constraints, and quadrant constraints to the initial borehole region arc segment group, and after filtering out arc segments in the initial borehole region arc segment group that do not meet the constraint conditions, to obtain a potential borehole contour arc segment group includes:
[0089] S501 applies concavity and convexity constraints, and calculates the slope of each point in each edge arc segment of the initial borehole region arc segment group according to equation (1) in the order of points. At the point where the sign of the slope changes, each edge arc segment is broken to obtain several new arc segments, and these new arc segments are combined to form a new arc segment group. In this embodiment, under a lenient strategy, the influence of horizontal and vertical arc segments on concavity and convexity is ignored, that is, when the slope is 0, the edge arc segment is assumed to be continuous at that point.
[0090]
[0091] In the above formula (1), Let the slope be the slope of the j-th point of the i-th edge arc segment. Let J be the X-axis coordinate of the j-th point of the i-th edge arc segment. Let J be the Y-coordinate of the j-th point on the i-th edge arc segment. Let J be the X-axis coordinate of the (j+1)th point of the i-th edge arc segment. Let Y be the Y-coordinate of the (j+1)th point of the i-th edge arc segment;
[0092] S502 applies a saliency constraint to filter out new arc segments in the new arc segment group whose length is less than a first preset threshold, resulting in a saliency arc segment group, such as... Figure 4 As shown, in this embodiment, the first preset threshold is the smaller of the length of the borehole contour region image and the width of the borehole contour region image, which is 0.02 times the width of the borehole contour region image.
[0093] S503 classifies each new arc segment in the significant arc segment group into a center-facing arc segment and a center-reverse arc segment according to formula (2), and removes the center-reverse arc segments from the significant arc segment group to obtain a center-facing arc segment group composed of several center-facing arc segments, such as Figure 5 As shown, in this embodiment, the second preset threshold for determining orientation is the same as the first preset threshold in the salience constraint;
[0094]
[0095] In equation (2), Ω i For the i-th new arc segment, Ω forward To the central arc segment, {Ω forward} represents the arc segment group oriented towards the center, Ω backward For the arc segment facing away from the center, {Ω backward} is a group of arc segments facing away from the center. Let N0 be the j-th point of the i-th new arc segment, and N0 be the second preset threshold. The feature triangle is formed by the starting point of the i-th new arc segment, the ending point of the i-th new arc segment, and the midpoint of the borehole contour region image as its three corner points.
[0096] S504 distinguishes several of the center-oriented arc segments in the center-oriented arc segment group according to formula (3) to obtain a four-quadrant arc segment group;
[0097]
[0098] In the formula (3), {Ω1} is the arc segment group in the first quadrant, {Ω2} is the arc segment group in the second quadrant, {Ω3} is the arc segment group in the third quadrant, {Ω4} is the arc segment group in the fourth quadrant, U is the area of the upper half of the circumscribed rectangle of each arc segment towards the center divided by the arc segment towards the center, and O is the area of the lower half of the circumscribed rectangle of each arc segment towards the center divided by the arc segment towards the center.
[0099] After S505 filters out the center-oriented arc segments in the four-quadrant arc segment group that are not within the coordinate range of their respective quadrants, the potential borehole profile arc segment group is obtained. The quadrant coordinate range of the arc segment group in each quadrant of the four-quadrant arc segment group is set to 1.2 times the quadrant coordinate range. Figure 6 The image shows a set of potential borehole profile arc segments after quadrant constraints. It can be observed that after the aforementioned concavity / convexity constraints, salience constraints, directional constraints, and quadrant constraints, the final set of potential borehole profile arc segments is... Figure 3 Compared to the initial drilling area arc segment group shown, most of the invalid noise arc segments have been filtered out, and the remaining arc segments all meet the basic requirements for synthesizing an ellipse.
[0100] S6 uses an initial ellipse blending evaluation method to process the potential borehole contour arc segment group and the borehole contour region image to obtain an initial ellipse; S6, the process of using the initial ellipse blending evaluation method to process the potential borehole contour arc segment group and the borehole contour region image to obtain an initial ellipse includes:
[0101] S601 selects all edge points in the potential borehole profile arc segment group as valid edge points, and performs ellipse fitting on the valid edge points using the least squares method, obtaining the rotation angle θ of the fitted ellipse. arc ;
[0102] S602 selects an inclination angle from -90° to 90°, the slope of the inclination angle is k, and draws several straight lines with a slope of k at equal intervals on the borehole contour area image. The several straight lines form a straight line group, and the pixels on each straight line in the straight line group are extracted to form a corresponding measurement line. The several measurement lines form a measurement line group.
[0103] S603 uses the K-means clustering algorithm to classify all pixels within a single survey line in the survey line group into dark-colored pixels and light-colored pixels, and calculates the slope k from the centroid of the dark-colored pixels to the center point of the borehole contour region image.m And calculate the initial ellipse rotation angle θ according to equation (4). temp ;
[0104]
[0105] In the above formula (4), absmin() means taking the angle with the smallest absolute value among the two angles, H is the height of the target rectangle, W is the width of the target rectangle, α is the first auxiliary operator, β is the second auxiliary operator, k' is the correction slope, and n is the aspect ratio of the target rectangle.
[0106] S604 Repeat step S603 to calculate an initial ellipse rotation angle corresponding to each survey line in the survey line group. Then, using median evaluation (i.e., the median method), evaluate the intermediate ellipse rotation angle θ corresponding to the survey line group from several initial ellipse rotation angles to obtain the intermediate ellipse rotation angle θ. k ;
[0107] S605 Repeat steps S602 to S604. In this embodiment, the tilt angles selected six times in steps S602 to S604 are -60°, -30°, 0°, 30°, 60°, and 90°, respectively, to obtain a total of 6 groups of survey lines with different angles. For each group of survey lines, 5 survey lines are taken at equal intervals on both the upper and lower (left and right) sides of the image along the survey line axis, resulting in six intermediate ellipse rotation angles θ. k The intermediate ellipse rotation angle group {θ k The rotation angle θ of the fitted ellipse is evaluated using the median. arc With the rotation angle group {θ of the intermediate ellipse k The final initial ellipse rotation angle θ is determined through evaluation. init , Figure 7 The diagram shows six survey line groups and their midpoints. It can be seen that, except for a few survey lines where the midpoint shifted due to lighting conditions, the midpoints of the chords were generally correctly assessed for the other survey lines.
[0108] S606 determines the semi-major axis length a of the initial ellipse according to equation (5). init and the semi-minor axis length b of the initial ellipse init The center point of the borehole contour area image is used as the center point of the initial ellipse to obtain the initial ellipse. In this embodiment, the center pixel coordinates of the obtained initial ellipse are (159.0, 151.5), the long sleeve length and short sleeve length are 289.2 and 275.7 pixels respectively, and the final initial ellipse rotation angle is 7.88°.
[0109]
[0110] S7 uses the initial ellipse as the initial value for the iteration of the borehole profile ellipse, and uses the borehole profile iterative fitting method to fit the potential borehole profile arc segment group and the initial ellipse to obtain the borehole profile ellipse; S7, the borehole profile ellipse is obtained by fitting the potential borehole profile arc segment group and the initial ellipse using the borehole profile iterative fitting method, including:
[0111] S701 calculates the algebraic distance d from each edge point in the potential borehole profile arc segment group to the initial ellipse according to equation (6). j One edge point corresponds to one algebraic distance. Several algebraic distances are sorted by size, and n edge points corresponding to n algebraic distances are selected in descending order. The n edge points are deleted from all edge points in the borehole profile arc segment group to obtain several remaining edge points. The n is m times the number of all edge points in the borehole profile arc segment group, where m = 0.4.
[0112]
[0113] In the above equation (6), A, B, C, D, E, and F are the coefficients of any ellipse equation in the general equation of the ellipse, which can be determined based on the long sleeve length, short sleeve length, center pixel coordinates, and initial ellipse rotation angle.
[0114] S702 counts the number of remaining edge points and determines whether the number of remaining edge points is lower than a preset threshold. In this embodiment, the threshold is set to 20 points. If yes, the ellipse of the current iteration is used as the drilling profile ellipse. If no, the least squares method is used to fit the ellipse, and the equivalent intersection-union ratio (EIOU) between the ellipse of the current i-th iteration and the ellipse of the (i-1)-th iteration is calculated according to equation (7). i,i-1 ;
[0115]
[0116] In the above formula (7), Let be the area of the intersection region between the minimum bounding rectangle of the ellipse in the i-th iteration and the minimum bounding rectangle of the ellipse in the (i-1)-th iteration. Let be the area of the region where the minimum bounding rectangle of the ellipse in the i-th iteration is joined with the minimum bounding rectangle of the ellipse in the (i-1)-th iteration; where the minimum bounding rectangle of the ellipse in the w-th iteration is formed by the four corner points {R w} constraints, R w Obtained through equation (8);
[0117] R w ={(xcos(θ)-ysin(θ),xsin(θ)+ycos(θ))|x=±a,y=±b} (8);
[0118] Where w is i or i-1; a is the length of the semi-major axis of the ellipse in the w-th iteration; b is the length of the semi-minor axis of the ellipse in the w-th iteration; and θ is the rotation angle of the ellipse in the w-th iteration.
[0119] Determine EIOU i,i-1 If the value is greater than the set convergence threshold (set to 0.95), then the ellipse of the current iteration is used as the drilling profile ellipse; otherwise, S701 to S702 are repeated. In this embodiment, the pixel coordinates of the drilling center of the final drilling profile ellipse are (1518.5, 484.6), the major axis length and minor axis length are 282.1 and 266.4 respectively, and the rotation angle is 9.89°.
[0120] It can be seen that the method for accurately fitting borehole contours in complex environments provided by the present invention can accurately locate the borehole in complex environments such as tunnels. Moreover, thanks to the combination of deep learning and machine vision methods, the fitting results of the present invention have both strong robustness and high accuracy.
[0121] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the scope of the technology disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention. All should be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
[0122] Although embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and embodiments. They can be applied to various fields suitable for the present invention. For those skilled in the art, other modifications can be easily made. Therefore, without departing from the general concept defined by the claims and their equivalents, the present invention is not limited to the specific details and illustrations shown and described herein.
Claims
1. A method for accurately fitting borehole profiles in complex environments, characterized in that, include: S1 uses deep learning to train the basic detection model to obtain the target detection model; S2 acquires the image of the area to be detected in the borehole through an image acquisition device, and performs image preprocessing on the image to be detected to obtain an initial image to be processed; S3 inputs the initial image to be processed into the target detection model, and uses a camera image drilling target fast extraction method to extract the drilling contour region image from the initial image to be processed; S4 uses an edge detector to extract an initial group of borehole region arc segments from the borehole contour region image; S5 sequentially applies concavity-convexity constraints, saliency constraints, directional constraints, and quadrant constraints to the initial borehole region arc segment group, and after filtering out arc segments in the initial borehole region arc segment group that do not meet the constraint conditions, obtains the potential borehole contour arc segment group. S6 uses an initial ellipse blending evaluation method to process the potential borehole contour arc segment group and the borehole contour region image to obtain an initial ellipse; S6, the process of using the initial ellipse blending evaluation method to process the potential borehole contour arc segment group and the borehole contour region image to obtain an initial ellipse includes: S601 selects all edge points in the potential borehole profile arc segment group as valid edge points, and performs ellipse fitting on the valid edge points using the least squares method, obtaining the rotation angle of the fitted ellipse. ; S602 selects an inclination angle from -90° to 90°, wherein the slope of the inclination angle is... k Several lines with slopes of equal spacing are drawn on the borehole contour area image. k A straight line, several of the straight lines form a straight line group, and the pixel points on each of the straight lines in the straight line group are extracted to form a corresponding measurement line, and several of the measurement lines form a measurement line group. S603 uses a threshold segmentation algorithm to classify all pixels within a single survey line in the survey line group into dark-colored pixels and light-colored pixels, and calculates the slope from the centroid of the dark-colored pixels to the center point of the borehole contour region image. And calculate the initial ellipse rotation angle according to equation (4). ; (4); In the aforementioned formula (4), H The height of the target rectangle. W The width of the target rectangle. α As the first auxiliary operator, β For the second auxiliary operator, k , To correct the slope, n The aspect ratio of the target rectangle; S604 Repeat step S603 to calculate an initial ellipse rotation angle corresponding to each survey line in the survey line group, and evaluate the intermediate ellipse rotation angle corresponding to the survey line group from several initial ellipse rotation angles using an evaluation method. ; S605 Repeat steps S602 to S604 to obtain a number of intermediate ellipse rotation angles. The intermediate ellipse rotation angle group { The rotation angle of the fitted ellipse is evaluated using an evaluation method. With the rotation angle group of the intermediate ellipse { The final initial ellipse rotation angle is determined through evaluation. ; S606 determines the semi-major axis length of the initial ellipse according to equation (5). and the semi-minor axis length of the initial ellipse The center point of the borehole contour area image is used as the center point of the initial ellipse to obtain the initial ellipse; (5); S7 uses the initial ellipse as the initial value for the iteration of the borehole profile ellipse, and uses the borehole profile iterative fitting method to fit the potential borehole profile arc segment group and the initial ellipse to obtain the borehole profile ellipse.
2. The method for accurately fitting borehole profiles in complex environments according to claim 1, characterized in that, In S1, the method of training the basic detection model using deep learning to obtain the target detection model includes: S101 acquires several learning images containing borehole openings from the target engineering area, performs image preprocessing on the several learning images to obtain several preprocessed images, marks the bounding rectangle of the borehole opening contour in each preprocessed image, forms a borehole contour image database through the several bounding rectangles, and splits the borehole contour image database into a training database and a test database according to the proportion. S102 Input the training database into the basic detection model, train the model network weights of the basic detection model, and use the test database to calculate the detection accuracy of the basic detection model, and determine whether the detection accuracy reaches the preset value. If S103 is true, then the target detection model is obtained; if not, then S102 is repeated until the detection accuracy reaches the preset value, and then the target detection model is obtained.
3. The method for accurately fitting borehole profiles in complex environments according to claim 2, characterized in that, In S3, the method for rapid extraction of drilling targets from camera images to extract the drilling contour region image from the initial image to be processed includes: The target detection model obtains the length, width, and center coordinates of the target rectangle of the borehole contour in the initial image to be processed. Using the center coordinates of the target rectangle as the center, the length and width of the target rectangle are taken as multiples of the length and width of the borehole contour region. The borehole contour region is extracted from the initial image to be processed. Adaptive histogram balancing is performed on the borehole contour region to obtain the borehole contour region image.
4. The method for accurately fitting borehole profiles in complex environments according to claim 3, characterized in that, In S4, the step of extracting the initial borehole region arc segment group from the borehole contour region image using an edge detector includes: An edge detector is used to obtain several edge points in the borehole contour region image. The edge points are connected to obtain several edge arc segments. The edge arc segments are combined to form the initial borehole region arc segment group. The edge detector includes a Canny edge detector or an Edge Drawing edge detector.
5. The method for accurately fitting borehole profiles in complex environments according to claim 4, characterized in that, In S5, the step of sequentially applying concavity / convexity constraints, saliency constraints, directional constraints, and quadrant constraints to the initial borehole region arc segment group, and then filtering out arc segments in the initial borehole region arc segment group that do not meet the constraint conditions, to obtain the potential borehole contour arc segment group includes: S501 calculates the slope of each point in each edge arc segment of the initial borehole region arc segment group according to equation (1) in the order of points. And at the point where the sign of the slope changes, each edge arc segment is broken to obtain several new arc segments, and several new arc segments are combined to form a new arc segment group; (1); In the above formula (1), For the first i The first edge arc segment j The class slope of each point, For the first i The first edge arc segment j The X-axis coordinates of each point For the first i The first edge arc segment j The Y-axis coordinates of each point For the first i The first edge arc segment j +1 The X-axis coordinates of each point For the first i The first edge arc segment j+1 The Y-axis coordinates of each point; S502 applies a saliency constraint to filter out new arc segments in the new arc segment group whose length is less than a first preset threshold, and then obtains a saliency arc segment group; S503 divides each new arc segment in the significant arc segment group into a center-facing arc segment and a center-reverse arc segment according to formula (2), and filters out the center-reverse arc segments in the significant arc segment group to obtain a center-facing arc segment group composed of several center-facing arc segments; (2); In the above formula (2), For the first i A new arc segment, For the arc segment pointing towards the center, { } represents the arc segment group facing the center. For the arc segment facing away from the center, { } is a group of arc segments facing away from the center. For the first i The first new arc segment j One point, The second preset threshold, For the first i The starting point of the new arc segment, the first i The endpoint of the new arc segment and the midpoint of the borehole contour area image are a characteristic triangle formed by three corner points. S504 distinguishes several of the center-oriented arc segments in the center-oriented arc segment group according to formula (3) to obtain a four-quadrant arc segment group; (3); In the aforementioned equation (3), { } represents the arc segment group in the first quadrant, { } represents the arc segment group in the second quadrant, { } represents the arc segment group in the third quadrant, { } represents the arc segment group in the fourth quadrant. U Let the area of the upper half of the circumscribed rectangle of each of the aforementioned arc segments facing the center be defined by the arc segment facing the center. O The area of the lower half of the circumscribed rectangle of each of the aforementioned arc segments facing the center is divided by the arc segment facing the center; After S505 filters out the center-oriented arc segments in the four-quadrant arc segment group that are not within the coordinate range of their respective quadrants, the potential borehole profile arc segment group is obtained.
6. The method for accurately fitting borehole profiles in complex environments according to claim 5, characterized in that, In S7, the borehole profile ellipse is obtained by fitting the potential borehole profile arc segment group and the initial ellipse using the borehole profile iterative fitting method, including: S701 calculates the algebraic distance from each edge point in the potential borehole profile arc segment group to the initial ellipse according to equation (6). One edge point corresponds to one algebraic distance. Several algebraic distances are sorted by size, and n edge points corresponding to n algebraic distances are selected in descending order. The n edge points are deleted from all edge points in the borehole profile arc segment group to obtain several remaining edge points. The n is m times the number of all edge points in the borehole profile arc segment group. (6); In the aforementioned formula (6), A, B, C, D, E, F , respectively, are the coefficients of any ellipse equation in the general form of the ellipse equation; S702 counts the number of remaining edge points and determines whether the number of remaining edge points is lower than a preset threshold. If so, the ellipse of the current iteration is used as the drilling profile ellipse. If not, the least squares method is used to fit the ellipse, and the current iteration is calculated according to equation (7). i Iterative Ellipse and the 1st i-1 Equivalent intersection-union ratio between iterative ellipses ; (7); In the aforementioned formula (7), For the first i The minimum bounding rectangle of the iterative ellipse and the first i-1 The area of the intersection region of the minimum bounding rectangles between the iterative ellipses. For the first i The minimum bounding rectangle of the iterative ellipse and the first i-1 The area of the union region of the minimum bounding rectangle between the iterative ellipses; judge If the value is greater than the set convergence threshold, then the ellipse of the current iteration is taken as the borehole profile ellipse; otherwise, the S701~S702 operations are repeated.
7. The method for accurately fitting borehole profiles in complex environments according to claim 6, characterized in that: The basic detection model includes the YOLO model or the Fast R-CNN model; The image preprocessing includes distortion correction, grayscale conversion, and adaptive histogram balancing.
8. The method for accurately fitting borehole profiles in complex environments according to claim 7, characterized in that: The threshold segmentation algorithm includes the K-means clustering algorithm or the Otsu threshold segmentation algorithm; The evaluation methods include mean evaluation, mode evaluation, or median evaluation.
9. The method for accurately fitting borehole profiles in complex environments according to claim 8, characterized in that: No. w The minimum bounding rectangle of the iterative ellipse is formed by the four corner points { }constraint, Obtained through equation (8); = (8); in, w for i or i-1 ;a is the first w The length of the semi-major axis of the iterative ellipse, b, is the length of the first... w The length of the semi-minor axis of the iterative ellipse. For the first w The angle of rotation of the iterative ellipse.