A visual positioning method for underwater robots for circular pipe orifice docking tasks
Through the semantic segmentation model of a monocular industrial camera and a convolutional neural network, combined with least squares fitting, the underwater robot can accurately locate the circular pipe mouth, solving the problem of low positioning accuracy in weak texture environments. It is suitable for autonomous docking tasks in closed underwater environments.
Patent Information
- Application Number
- CN202411992678.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2044-12-31
AI Technical Summary
Existing underwater positioning methods have low accuracy in underwater environments with weak textures, electromagnetic shielding, and poor water quality, making it difficult to achieve precise docking of autonomous underwater robots with circular pipe openings.
A monocular industrial camera combined with a semantic segmentation model based on a convolutional neural network is used to identify and locate the circular pipe opening through image enhancement and least squares fitting. The monocular spatial elliptical cone pose theory is used to calculate the relative pose of the robot to achieve autonomous docking.
The accuracy and precision of circular nozzle recognition in underwater environments are improved, the algorithm process is simplified, the cost is reduced, and it is suitable for underwater robot positioning with known and unknown target nozzle radius.
Smart Images

Figure CN119850733B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of underwater robots, and in particular relates to a visual positioning method of an underwater robot for circular pipe orifice docking tasks. Background Art
[0002] With the rapid development of computer and electronics-related software and hardware, the performance of robots has been greatly improved. Various types of robots are becoming increasingly important in industrial production environments. Underwater robots, which rely on propellers, have played a significant role in replacing human operators in underwater environments. Underwater robots are divided into autonomous and non-autonomous types based on whether they require human intervention. Non-autonomous underwater robots generally require direct or indirect visual control by an operator, using a remote control device for manual control. Autonomous underwater robots, on the other hand, use sensors such as cameras or lidar to perceive the environment. Planning algorithms assess environmental information and generate control instructions to achieve the next goal. The entire process is completed autonomously by the robot.
[0003] Autonomous underwater robots must be able to sense their position in the environment to achieve autonomous movement. Therefore, underwater positioning is a primary task in achieving autonomy. Commonly used underwater positioning methods for underwater exploration and operations include acoustic positioning systems, inertial navigation systems, and Doppler sonar velocimeters.
[0004] Acoustic positioning systems rely on the propagation of mechanical waves, such as sound waves, underwater for positioning. They are primarily categorized as beacon-based and beacon-free. Beacon-based methods include long baseline (LBL), short baseline (SBL), and ultra-short baseline (USBL). These methods require the installation of acoustic beacons at known locations on the seabed or on ships. The underwater robot transmits acoustic signals to these beacons, which then return signals to the robot. The robot's precise position can be calculated based on the signal propagation time and the known beacon locations. Beacon-free positioning relies on sonar-based positioning, where sound waves reflect off objects and form echoes. While underwater acoustic positioning can achieve positioning distances of up to thousands of meters, its accuracy is generally limited to the decimeter level. Beacon-based acoustic positioning requires pre-installation of beacons on the robot and the detection environment, making installation difficult. Due to the scattering properties of sound waves, sonar-based positioning also has decimeter-level accuracy for detecting large objects, such as pool walls. Furthermore, multiple reflections of sound waves in sealed pools can lead to positioning errors.
[0005] Inertial Navigation System (INS): This system uses accelerometers and gyroscopes to measure the robot's motion. Due to the inevitable bias, noise, and other non-ideal characteristics of accelerometers and gyroscopes, these errors accumulate during the integration process, causing position and attitude estimates to gradually deviate from their true values, significantly reducing accuracy during long-term operation. Furthermore, in some metallic environments, electromagnetic shielding prevents the gyroscope from initializing using the Earth's magnetic field, rendering the positioning system ineffective.
[0006] Doppler Velocity Log (DVL) uses the Doppler effect to measure the velocity of an underwater vehicle relative to the seabed. This provides highly accurate velocity information and, when used in conjunction with an INS, can effectively reduce IMU drift. However, DVLs are highly dependent on the water's environmental characteristics, and Doppler frequency shifts caused by the vibration of small carriers can introduce errors. Furthermore, each DVL unit can cost tens of thousands of yuan, making installation expensive.
[0007] Optical positioning, such as Visual Simultaneous Localization and Mapping (VSALM), uses a camera to capture images and utilizes computer vision technology for feature extraction and matching, enabling simultaneous mapping and positioning. Because underwater environments typically have weak textures, such as pools, pipes, or open ocean, finding visual feature points is difficult. Furthermore, suspended matter and uneven lighting in the water severely degrade underwater image quality. Therefore, this method is only suitable for underwater environments with good visibility and abundant feature points. LiDAR (Light Detection and Ranging): Due to water's absorption of electromagnetic waves and the blocking and scattering of lasers by impurities in the water, its range and accuracy are significantly reduced. Summary of the Invention
[0008] To address the above technical problems, the present invention proposes a visual positioning method for underwater robots in underwater environments with circular pipe openings. The method can detect and utilize the contour features of the circular pipe opening and apply the spatial geometric principles of spatial elliptical cones for relative positioning, overcoming the inapplicability of the above methods for long-term operation in underwater environments with poor water quality, weak texture, and electromagnetic shielding. The purpose of the present invention is to propose a visual positioning method for underwater robots docking or entering cylindrical pipes in closed, weak-textured, and poorly illuminated underwater environments. The method uses a monocular industrial camera to capture real-time images of the robot's forward environment at its current position and posture. The image is input into a semantic segmentation model based on a convolutional neural network to complete the recognition of the target circular pipe opening. A standard ellipse that coincides with the circular pipe opening contour is then fitted using a direct least squares method. The relative position and posture of the robot and the geometric center of the target circular pipe opening in the monocular camera coordinate system are calculated based on the monocular spatial elliptical cone pose theory. The corresponding software system controls the underwater robot's advance toward the target pipe opening based on the real-time pose information, thereby enabling the underwater robot to autonomously complete the docking task with the circular pipe opening.
[0009] The purpose of the present invention can be achieved by the following technical solution: a visual positioning method for an underwater robot for a circular pipe orifice docking task, comprising the following steps:
[0010] S1. Acquire an original image of the circular pipe opening in front of the underwater robot;
[0011] S2. enhancing the acquired underwater original image to obtain an enhanced image;
[0012] S3. Analyze the enhanced image using a real-time semantic segmentation model based on a convolutional neural network for the circular nozzle contour to obtain a segmentation mask image of the circular nozzle;
[0013] S4, using the least square method to perform ellipse fitting on the mask image to obtain the nozzle ellipse parameters;
[0014] S5. The nozzle ellipse parameters are calculated using a monocular space ellipse cone pose measurement model to obtain the relative pose of the underwater robot and the target nozzle in the monocular camera coordinate system.
[0015] Compared with the prior art, the present invention has the following advantages:
[0016] 1. The algorithm flow of the present invention uses a multi-scale Retinex method with color restoration for preprocessing to obtain an enhanced image. The Retinex method helps to solve the problems of uneven local brightness and low overall contrast of the image caused by uneven underwater lighting. At the same time, the multi-scale color restoration function helps to solve the color cast and color aberration problems of underwater images caused by problems such as impurities in the water, making the visual features of the target circular pipe opening to be identified more obvious, effectively improving the recognition accuracy and segmentation precision of subsequent algorithms.
[0017] 2. The present invention uses a semantic segmentation model based on deep learning. The deep network can fully learn the high-level semantic information of the image during training. Compared with traditional machine vision recognition methods, the model can greatly reduce the misrecognition rate of the target after learning is completed and has extremely strong robustness.
[0018] 3. The algorithm flow of this invention utilizes a real-time semantic segmentation model using a neural network specifically optimized for nozzle contour segmentation. This model utilizes a lightweight backbone network optimized with depthwise separable convolutions. Based on the hierarchy of feature extraction from the backbone network, three paths—edge, contour, and semantic—are derived and fed into the decoder for multi-level feature fusion and upsampling, helping to obtain an accurate target circular nozzle segmentation mask image. Furthermore, this semantic segmentation model has been lightweight and optimized, balancing accuracy, speed, and model size.
[0019] 4. The algorithm flow of the present invention uses a direct ellipse fitting method based on the least squares method to obtain ellipse parameters for the circular nozzle mask binary image obtained by the semantic segmentation model. It is accurate and efficient, helps to save fitting time and improve the real-time performance of the algorithm.
[0020] 5. The method of the present invention is simple to implement. It only requires a monocular camera for image acquisition and an embedded board for processing and calculation to be deployed on an underwater robot. It can be effectively implemented in both cases where the target circular nozzle radius is known or unknown. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 is a flow chart of the present invention;
[0022] Figure 2 This is the structure diagram of the semantic segmentation model;
[0023] Figure 3 Schematic diagram of the three-branch fusion upsampling module;
[0024] Figure 4 It is the standard coordinate system diagram of elliptical cone;
[0025] Figure 5 A two-dimensional diagram of the conic surface π and the section. DETAILED DESCRIPTION
[0026] In order to make the objectives, technical solutions, and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other. To achieve the above-mentioned objectives, the present invention adopts the following technical solutions.
[0027] The present invention provides a visual positioning method for underwater robots for circular pipe orifice docking tasks, such as Figure 1 As shown, the following steps are included:
[0028] S1. Obtaining original images of the circular pipe opening in front of the underwater robot, including: using a high-resolution monocular industrial camera located in a transparent sealed cabin at the front of the underwater robot to continuously capture the circular pipe opening in front of the underwater robot in real time through secondary developed SDK software to obtain original images of the target with clear texture. These images will serve as the basic data input for the visual positioning method for the circular pipe opening docking task.
[0029] S2. Enhance the original image to obtain an enhanced image, including: applying image enhancement technology to the obtained image of the circular nozzle in front of the underwater robot, determining the image enhancement technology as a multi-scale Retinex algorithm with color restoration (hereinafter referred to as the MSRCR algorithm) based on the current lighting and water quality environment, and setting reasonable parameters.
[0030] The specific steps for applying the multi-scale Retinex algorithm with color restoration are as follows:
[0031] The MSRCR algorithm considers the color restoration result based on the multi-scale Retinex algorithm (hereinafter referred to as the MSR algorithm), while the MSR algorithm is obtained by weighted superposition of the multi-scale Retinex algorithm (hereinafter referred to as the SSR algorithm). The single-scale Retinex algorithm (SSR) is a color perception model that approximates the retina-cerebral cortex. It assumes that the single-channel original image obtained by the human eye or image sensor is ,in is the horizontal and vertical coordinates of any pixel point in the two-dimensional image coordinate system, and the reflected image of the object is , the brightness image of the incident light is , then the relationship between the three is , the image enhancement result is the reflection image representing the real image of the object to be sought ,in Represents the convolution of the Gaussian function and the acquired original image. The two-dimensional Gaussian function is ,in is the amplitude of the two-dimensional Gaussian function, so that the function satisfies the Gaussian distribution ; is the scale parameter of the Gaussian function, which has a great influence on the image enhancement effect. When it is smaller, it can maintain better image details but the color is worse. Larger values can maintain better color balance but reduce image edge details.
[0032] The MSRCR algorithm first needs to calculate the colorimetric transformation factor ,in is the original image pixel value, N=3 in RGB color space, Represents the three color channels RGB. Then do log processing to get ,in is the gain constant, is the nonlinear transformation adjustment parameter.
[0033] The calculation process of MSRCR is to expand the single-scale SSR algorithm into k channels and add the colorimetric transformation factor The color restoration function is implemented by the SSR single-scale algorithm, so the following operation is k-channelization.
[0034] Then determine the k-channel two-dimensional Gaussian function k scale parameters (where subscript k can be any integer from 1 to k) The size here is a two-dimensional Gaussian function for each of the k channels, the same as in the SSR algorithm ,for k-scaling; is the scale parameter of the k-scale two-dimensional Gaussian function. Determine whether the Gaussian distribution is satisfied. A two-dimensional Gaussian function for each of the k scales medium amplitude The value of .
[0035] Then according to the formula beg The value of k is the number of scales in the multi-scale model, which is usually 3, representing large, medium, and small scales. is the weighted value for each scale.
[0036] Then Transformation from logarithmic domain to real number domain , then perform pixel linear stretching and output the result.
[0037] S3. Analyze the enhanced image using a real-time semantic segmentation model for circular nozzle contour recognition to extract a segmentation mask image of the circular nozzle area, including:
[0038] Data preparation: We collected images of underwater circular nozzles from various viewing angles and lighting conditions. We then used annotation tools to annotate the contours of the circular nozzles. This dataset consisted of the original images and the corresponding annotations of the circular nozzle areas. The dataset was divided into training and validation sets in an eight-to-two ratio.
[0039] Model construction: Figure 2 As shown, a three-branch real-time semantic segmentation network (TBNet) for circular nozzle segmentation is constructed. Based on a lightweight backbone network, a lightweight deep backbone network (MobileNet V2) using depthwise separable convolution or a densely connected STDC network can be used as the backbone network for feature extraction. Three branches, namely edge, contour, and semantic, are introduced in the shallow, middle, and deep layers of the backbone network, respectively. The edge branch comprises the first and second edge convolution modules. Guided by the edge segmentation head and edge loss function during training, it focuses on segmenting object edges in labeled images. The contour branch comprises the first and second contour convolution modules, responsible for learning the spatial contour information of the target output from the middle layer of the backbone network during training. The semantic branch includes a pyramid pooling module that captures the global context of the image, helping the network understand large-scale structures and relationships within the image and enhancing model performance.
[0040] Multi-level feature extraction: The semantic branch, generated by the deep layers of the backbone network, outputs long-range contextual information. The contour branch, generated by the middle layers of the backbone network, outputs local spatial information. The edge branch, generated by the shallow layers of the backbone network, outputs edge features and is guided only by the edge segmentation head and edge loss function during training.
[0041] Edge branch: First, edge labels are obtained from the label image through the Laplacian operator, and the true value of the edge label is further generated. The edge branch of the semantic segmentation model used in the present invention has a first edge convolution module responsible for edge feature extraction, a second edge convolution module, and an edge segmentation head inserted at the end of the edge branch after the second edge convolution module to generate an edge feature map. The true value of the edge label is then used as a guide for the edge feature map to guide the edge branch and the edge segmentation head to learn the image edge features of the true value of the edge label.
[0042] Edge label generation: Artificial convolution kernels for edge extraction include Sobel, Laplacian, and Canny. Considering that the label images for image segmentation are noise-free, a simple convolution kernel can be used to complete the edge extraction task. This method uses the Laplacian operator to generate detail feature maps with different step sizes, such as 1, 2, and 4, to obtain multi-scale detail information. Dilated convolution is then used to enhance weaker boundary features. The multi-scale detail feature map is then upsampled to its original size and fused with a trainable 1 × 1 convolution for dynamic reweighting. Finally, a threshold less than 1 is used to convert the predicted details of the 1 × 1 convolution into the final binary true edge label value with edge information.
[0043] The Laplace operator is: , the dilated convolution kernel is .
[0044] Hybrid loss function: Since the number of pixels in the edge part is much smaller than the number of spatial and semantic pixels, edge prediction is a class imbalance problem. Using only the cross entropy loss function will result in too rough prediction results. To solve this problem, the present invention uses binary cross entropy and Dice loss function to jointly optimize the detailed learning of the boundary head. The edge loss function is defined as: ,in , They represent the single channel output of the edge segmentation head and the true value of the edge label during edge branch training. The BCE loss function is defined as , where N is the number of samples, is the true label of the i-th sample, Is the probability that the model predicts that the i-th sample is a positive class. Dice loss is a region-related loss that can be used when the samples are extremely unbalanced. Its expression is obtained by the dice coefficient and the smoothing coefficient: , where H, W, Represents the height, width and smoothing coefficient of the image respectively.
[0045] The overall loss function of the model is a mixed loss function, which is obtained by adding the edge loss function and the semantic loss function, where the semantic loss function is Specifically, the hybrid loss function consists of three parts: .in, , Represent the final output of the network segmentation head and the original label respectively. The OhemCE loss function is an improved version of the cross entropy loss function for unbalanced data distribution and difficult sample training, and is defined as ( =0), ( ≠0), where The model predicts the probability of the target class. Focal loss is improved by cross entropy loss: , ,in represents the cross entropy loss function; Represents the probability that the model predicts the positive category; is the balance coefficient, which is used to adjust the balance between positive and negative categories; is the weight coefficient.
[0046] Three-branch fusion upsampling module GBAU (Global Boundary Attention Upsampling), such as Figure 3 As shown, edge guidance is employed. Specifically, the edge, contour, and semantic branches have different sizes when entering the fusion module. This is because the model requires shallow, wide contour detail information and deep, compressed semantic information to generate segmentation masks, as well as boundary information, which provides more spatial detail but is less semantically relevant. The context branch, compressed to 1 / 16 or 1 / 32 of its length and width, is compressed through global pooling and a 1×1 convolution with a regularization layer and nonlinear activation to obtain a global context weight vector with the same number of channels as the contour branch output. This is then multiplied with the contour branch to obtain weighted spatial detail features. The edge branch, after fully learning edge information through edge convolution modules 1 and 2 and the edge segmentation head guided by the edge loss function, uses 3×3 convolution and a sigmoid activation function to remap the pixel values of the feature map to the range 0-1. The result is considered edge attention a. Simultaneously, the semantic branch uses 3×3 convolution and global pooling, followed by a 1×1 convolution to adjust the number of channels, resulting in a low-level feature vector containing high-level features. The low-level feature channel vector containing the high-level features is then multiplied by the contour branch output feature map and then multiplied by the edge attention a to obtain the final contour feature. The semantic branch integrates contextual information through the pyramid pooling module, and then uses the deconvolution module to upsample the feature map to maintain the same size as the final contour feature. The result is multiplied by 1-a to obtain the final semantic feature. Finally, the final contour feature and the final semantic feature are added together to obtain the final output of GBAU.
[0047] Model evaluation indicators: In terms of accuracy, the mean intersection over union (mIoU) is used as the evaluation indicator. In terms of speed, the number of frames per second is used as the unit of measurement. In terms of model complexity, the number of parameters (Param) is used to measure the model size, and the number of floating-point operations per second (FLOPS) is used to measure the computational complexity.
[0048] Model training: The TBNet model is trained using the prepared dataset. Data augmentation is introduced during training, and input images are randomly stretched, flipped, Gaussian blurred, and color space transformed to prevent overfitting. Training is considered complete when the validation loss reaches a minimum and the generalization error between the training loss and the validation loss is minimized.
[0049] Target segmentation and extraction: The trained TBNet semantic segmentation model is applied to the enhanced target circular nozzle image to achieve pixel-level classification of the target circular nozzle image, accurately identify the target nozzle and segment the target contour area, and obtain a binary mask image of the target circular nozzle similar to the label image in the dataset.
[0050] S4. Using the least squares method to perform ellipse fitting on the mask image to obtain nozzle ellipse parameters, including:
[0051] In the Cartesian coordinate system, an ellipse can be represented by a quadratic equation:
[0052] , where a, b, c, d, e, and f are the five coefficients of the general equation of the ellipse. It can be expressed as a matrix: .
[0053] Ellipse fitting is to fit the optimal ellipse curve to n noise points on a given curve, that is, fitting ,in , , ,because The existence of , the equation has a degree of freedom scale uncertainty, and additional scale constraints need to be added. Since the curve to be fitted is an ellipse, the discriminant The non-convex constraint becomes .
[0054] The above optimization problem becomes ,in , and then converted into ,in , discriminant becomes , where C is the upper left corner The original optimization problem becomes , and the six parameters of the ellipse can be obtained by using the Lagrange multiplier method.
[0055] S5. Using the monocular space elliptical cone pose measurement model to calculate the nozzle ellipse parameters, the relative pose of the underwater robot and the target nozzle in the monocular camera coordinate system is obtained, including:
[0056] Step 1: Solve the conic surface in the camera coordinate system Mathematical expression of . First assume that the world coordinate system , camera coordinate system , image coordinate system , pixel coordinate system , elliptic cone coordinate system The conversion formula between the pixel coordinate system and the world coordinate system is as follows:
[0057] ,
[0058] in,( ) is the three-dimensional coordinate in the world coordinate system, is the depth distance in the camera coordinate system, ( ) is the two-dimensional coordinate in the image coordinate system, is the focal length of the camera, the actual physical size of the pixel rectangle is represented by dx and dy, and the coordinates of the projection point of the camera optical center on the pixel coordinate system are represented by ( )express. is the three-dimensional rotation matrix, is a three-dimensional translation matrix. The coordinate system conversion formula between the pixel coordinate system and the world coordinate system can be simply written as:
[0059] ,
[0060] in, is the depth of the object in the field of view; is the position coordinate in the pixel coordinate system; It is called the camera intrinsic parameter matrix; is the camera extrinsic matrix; The physical three-dimensional coordinates of any point in the world coordinate system are combined into a coordinate vector .
[0061] Assume that the general equation of the nozzle outline ellipse on the imaging surface in the pixel coordinate system is:
[0062] ,
[0063] The elliptic coefficient matrix on the left side of the equation is replaced by Represented. The conic surface in the camera coordinate system can be derived The equation is expressed as:
[0064] ,
[0065] Among them, M is the intrinsic parameter matrix of the camera, , , The next point in the world coordinate system Convert to the three-dimensional coordinates of the camera coordinate system.
[0066] make:
[0067] ,
[0068] is a real symmetric matrix. The above formula can be further simplified to:
[0069] ,
[0070] Step 2: Conic surface Convert to the standard coordinate system. For the convenience of calculation, the conic surface Convert from camera coordinate system to Figure 4 The standard coordinate system of the camera is still the origin of the coordinate system. This is a pure rotation transformation. Let the transformation matrix be , is an orthogonal matrix.
[0071] Will Substituting into the equation we get:
[0072] ,
[0073] in, Next point in the camera coordinate system Convert to Figure 4 Coordinates in the elliptical cone coordinate system.
[0074] According to matrix theory, You can Diagonalization, that is Conic surface in standard coordinate system The expression is:
[0075] ,
[0076] 、 、 is a matrix A set of eigenvalues of the conic surface before and after the known coordinate system rotation transformation The expression of , further find the transformation matrix ;
[0077] by The standard equation of a conic surface with the axis as the central axis is:
[0078] ,
[0079] From the above formula we can infer:
[0080] ,
[0081] in, is an arbitrary constant.
[0082] Step 3: Find the conic surface in the standard coordinate system radius The circular cross section. From the above formula, it can be deduced that the conic surface with a circular cross section The expression of the cutting plane is:
[0083] ,
[0084] in, is an arbitrary constant. Represents the radius of the circular cross section, it can be seen Controlled by The size of. It is easy to know, When:
[0085] ,
[0086] consider and In the case of The coordinate system forms similar triangles, such as Figure 5 By obtaining 、 The midpoint of the similar triangles can be combined with the proportional relationship to deduce 、 The midpoint of , that is, the three-dimensional center coordinates of the target circle in the standard coordinate system are:
[0087] ,
[0088] It is easy to get the target circular plane in the standard coordinate system The normal vector is:
[0089] ,
[0090] Step 4: Convert the circle center coordinates and normal vector back to the camera coordinate system to obtain the circle pose expression in the camera coordinate system:
[0091] ,
[0092] At this point, the contour of the target circular nozzle can be identified through machine vision and an ellipse can be fitted to calculate the relative position and posture of the origin and the center of the circular nozzle in the underwater robot camera coordinate system.
Claims
1. A visual positioning method for underwater robots for circular pipe orifice docking tasks, characterized by: The following steps are involved: S1. Acquire an original image of the circular pipe opening in front of the underwater robot; S2. enhancing the acquired underwater original image to obtain an enhanced image; S3. Analyze the enhanced image using a real-time semantic segmentation model based on a convolutional neural network for the circular nozzle contour to obtain a segmentation mask image of the circular nozzle; S4, using the least square method to perform ellipse fitting on the mask image to obtain the nozzle ellipse parameters; S5. Calculate the nozzle ellipse parameters using a monocular space ellipse cone pose measurement model to obtain the relative pose of the underwater robot and the target nozzle in the monocular camera coordinate system; In S2, the acquired underwater original image is enhanced using the multi-scale Retinex algorithm with color restoration. The multi-scale Retinex algorithm with color restoration is based on the multi-scale Retinex algorithm and takes color restoration into consideration. The multi-scale Retinex algorithm is obtained by weighted superposition of the multi-scaled single-scale Retinex algorithm. S3 specifically involves building a three-branch real-time semantic segmentation model for circular nozzle segmentation. Based on a lightweight backbone network, a lightweight deep backbone network, MobileNet V2, or a densely connected STDC network, is used as the backbone network for feature extraction. Edge, contour, and semantic branches are derived from the shallow, middle, and deep layers of the backbone network, respectively. The edge branch has the first edge convolution module and the second edge convolution module, which are guided by the edge segmentation head and the edge loss function during training, and focus on segmenting the object edges of the label image; the contour branch has the first contour convolution module and the second contour convolution module, which are used to learn the target space contour information output by the middle layer of the backbone network during training; the semantic branch output by the deep layer of the backbone network is used to output long-distance context information; the contour branch derived from the middle layer of the backbone network is used to output local spatial information; the edge branch created by the shallow layer of the backbone network is used to output edge features, and is only guided by the edge segmentation head and the edge loss function during training.
2. The underwater robot visual positioning method for circular pipe orifice docking according to claim 1 is characterized in that: The single-scale Retinex algorithm is specifically as follows: The obtained single-channel original image is ,in is the horizontal and vertical coordinates of any pixel point in the two-dimensional image coordinate system, and the reflected image of the object is , the brightness image of the incident light is , then the relationship between the three is , the image enhancement result is the reflection image of the real image of the object to be sought: , in, Represents the convolution of the Gaussian function and the acquired original image. The two-dimensional Gaussian function is ,in is the amplitude of the two-dimensional Gaussian function, so that the function satisfies the Gaussian distribution ; is the scale parameter of the Gaussian function; The multi-scale Retinex algorithm with color restoration first calculates the colorimetric transformation factor ,in is the original image pixel value, N=3 in RGB color space, Represents the three color channels of RGB, and then performs log processing to obtain ,in is the gain constant, is the nonlinear transformation adjustment parameter; The calculation process of the multi-scale Retinex algorithm with color restoration is to expand the single-scale Retinex algorithm into k channels and add the colorimetric transformation factor Color restoration function; the k-channelization based on the single-scale Retinex algorithm is specifically as follows: Determine the k-channel two-dimensional Gaussian function k scale parameters of The size here is the two-dimensional Gaussian function of each channel of k channels, and the calculation method is the same as ,for k-scaling; is the scale parameter of the k-scale two-dimensional Gaussian function, which satisfies the Gaussian distribution. A two-dimensional Gaussian function for each of the k scales medium amplitude The value of According to the formula beg The value of , where k is the number of multi-scale scales, 3 represents large, medium and small scales, is the weighted value for each scale; Then Transformation from logarithmic domain to real number domain , then perform pixel linear stretching and output the result.
3. The underwater robot visual positioning method for circular pipe orifice docking according to claim 2 is characterized in that: In S3, the edge branch first obtains the edge label from the label image through the Laplacian operator, and further generates the true value of the edge label. The edge branch consists of the first edge convolution module and the second edge convolution module responsible for edge feature extraction. At the end of the edge branch after the second edge convolution module, an edge segmentation head is inserted to generate an edge feature map. The true value of the edge label is then used as a guide for the edge feature map to guide the edge branch and the edge segmentation head to learn the image edge features of the true value of the edge label. The Laplacian operator is used to generate detail feature maps of different step sizes, and dilated convolution is used to enhance weak boundary features. The multi-scale detail feature map is then upsampled to the original size and fused with a trainable 1 × 1 convolution for dynamic reweighting. Finally, a threshold less than 1 is used to convert the predicted details of the 1 × 1 convolution into the final binary edge label truth with edge information.
4. The underwater robot visual positioning method for circular pipe orifice docking according to claim 3 is characterized in that: In S3, the edge, contour, and semantic branches enter the three-branch fusion upsampling module for feature fusion. The output feature sizes of the edge, contour, and semantic branches are different. The semantic branch undergoes global pooling and 1×1 convolution compression with a regularization layer and nonlinear activation to obtain a global context weight vector with the same number of output channels as the contour branch, which is then multiplied with the contour branch to obtain the weighted spatial detail features. The edge branch remaps the pixel values of the feature map to between 0 and 1 through 3×3 convolution and sigmoid activation function, and regards the result as edge attention a. At the same time, the semantic branch uses 3×3 convolution and global pooling and then adjusts the number of channels through 1×1 convolution to obtain a low-level feature channel vector containing high-level features; then the low-level feature channel vector containing high-level features is multiplied by the output feature map of the contour branch and then multiplied by the edge attention a to obtain the final contour feature. After the semantic branch integrates context information through the pyramid pooling module, the feature map size is expanded by upsampling through the deconvolution module to keep it the same size as the final contour feature. The result is multiplied by 1-a to obtain the final semantic feature. Finally, the final contour feature and the final semantic feature are added to obtain the final output result of the three-branch fusion upsampling module.
5. The underwater robot visual positioning method for circular pipe orifice docking according to claim 4 is characterized in that: In step S3, the Laplace operator is: , the dilated convolution kernel is .
6. The underwater robot visual positioning method for circular pipe orifice docking according to claim 5, characterized in that: In step S3, the overall loss function of the model is a hybrid loss function, which is obtained by adding the edge loss function and the semantic loss function, where the semantic loss function is Specifically, the hybrid loss function consists of three parts ;in, , Represent the final output of the network segmentation head and the original label respectively. The OhemCE loss function is the cross entropy loss function, and the formula is defined as ( =0), ( ≠0), where To predict the probability of the target class for the model, Focal loss is improved by cross entropy loss: , ,in represents the cross entropy loss function; Represents the probability that the model predicts the positive category; is the balance coefficient, is the weight coefficient, and the marginal loss function is defined as: ,in , They represent the single-channel output of the edge segmentation head and the true value of the edge label during edge branch training respectively; , where N is the number of samples, is the true label of the i-th sample, is the probability that the model predicts that the i-th sample is a positive class; , where H, W, Represents the height, width and smoothing coefficient of the image respectively.
7. The underwater robot visual positioning method for circular pipe orifice docking according to claim 6, characterized in that: S4 specifically includes: in the Cartesian coordinate system, the ellipse is expressed by a quadratic equation of two variables: , where a, b, c, d, e, and f are the six coefficients of the general elliptic equation. It can be expressed as a matrix: ; Ellipse fitting is to fit the optimal ellipse curve to n noise points on a given curve, that is, fitting ,in , , , adding non-convex constraints becomes ; The optimization problem becomes ,in , and then converted into ,in , discriminant becomes , where C is the upper left corner The optimization problem becomes , using the Lagrange multiplier method to solve the six coefficients of the ellipse.
8. The underwater robot visual positioning method for circular pipe orifice docking according to claim 7, characterized in that: S5 specifically includes: Step 5.1: Solve the conic surface in the camera coordinate system Mathematical expression, assuming the world coordinate system , camera coordinate system , image coordinate system , pixel coordinate system , elliptic cone coordinate system The conversion formula between the pixel coordinate system and the world coordinate system is as follows: , in,( ) is the three-dimensional coordinate in the world coordinate system, is the depth distance in the camera coordinate system, ( ) is the two-dimensional coordinate in the image coordinate system, is the focal length of the camera, the actual physical size of the pixel rectangle is represented by dx and dy, and the coordinates of the projection point of the camera optical center on the pixel coordinate system are represented by ( )express, is the three-dimensional rotation matrix, is a three-dimensional translation matrix, and the coordinate system conversion formula between the pixel coordinate system and the world coordinate system is simply recorded as: , in, is the depth of the object in the field of view; is the position coordinate in the pixel coordinate system; It is called the camera intrinsic parameter matrix; is the camera extrinsic matrix; The physical three-dimensional coordinates of any point in the world coordinate system are combined into a coordinate vector ; Assume that the equation of the nozzle outline ellipse on the imaging surface in the pixel coordinate system is: , The elliptic coefficient matrix on the left side of the equation is replaced by Indicates that the conic surface in the camera coordinate system is derived The equation is expressed as: , Among them, M is the intrinsic parameter matrix of the camera, , , The next point in the world coordinate system Convert to the three-dimensional coordinates in the camera coordinate system; let: , is a real symmetric matrix, the above formula can be further simplified to: , Step 5.2: Conic Surface Convert to the standard coordinate system and convert the conic surface Convert from the camera coordinate system to the standard coordinate system. The coordinate origin is the camera optical center. Set the transformation matrix as , is an orthogonal matrix; Will Substituting into the equation we get: , in, Next point in the camera coordinate system Convert coordinates to the elliptical cone coordinate system; Will Diagonalization, that is ; Conic surface in standard coordinate system The expression is: , 、 、 is a matrix A set of eigenvalues of the conic surface before and after the known coordinate system rotation transformation The expression of , further find the transformation matrix ; by The standard equation of a conic surface with the axis as the central axis is: , From the above formula we can infer: , in, is an arbitrary constant; Step 5.3: Find the conic surface in the standard coordinate system radius Circular cross section; According to the above formula, the conical surface with a circular cross section The expression of the cutting plane is: , in, is an arbitrary constant; Indicates the radius of the circular cross section When: , consider and In the case of The coordinate system forms similar triangles, and by finding 、 The midpoint of the similar triangles is combined with the proportional relationship, and the 、 The midpoint of , that is, the three-dimensional center coordinates of the target circle in the standard coordinate system are: , Get the target circular plane in the standard coordinate system The normal vector is: , Step 5.4: Convert the circle center coordinates and normal vector back to the camera coordinate system to obtain the circle pose expression in the camera coordinate system: , At this point, the contour of the target circular nozzle is identified by machine vision and an ellipse is fitted to calculate the relative position and posture of the origin and the center of the circular nozzle in the underwater robot camera coordinate system.
Citation Information
Patent Citations
Visual recognition and positioning method for robot intelligent capture application
CN108171748A
Coding and decoding end edge information enhancement and attention guidance image segmentation method and system
CN114677349A