Ship identification and height detection method based on visual image fusion

Through the use of visual image fusion technology and specific modules, the installation, cost and measurement distance problems of ship height measurement solutions are solved, the imaging quality and measurement accuracy at night or under low light conditions are improved, and it is suitable for ship ultra-high warning systems.

CN118865103APending Publication Date: 2024-10-29武汉船舶职业技术学院
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410818770.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

Existing ship height measurement solutions have problems in installation, cost and measurement distance, and the imaging quality is poor at night or under low light conditions, resulting in large height measurement errors.

Method used

A ship recognition and height detection method based on visual image fusion is adopted, combining a monocular camera and an infrared camera, fusing infrared and visible light images through a feature extractor and target detection network, calculating and correcting the ship height, and using the AIS system to achieve distance calculation. And the distortion and pitch angle are corrected through the intelligent thermal imaging dual-spectrum gimbal and specific modules.

Benefits of technology

It achieves simple installation, cost saving and long measurement distance measurement of ship clearance height, improves the imaging quality and measurement accuracy at night or under low light conditions, and is suitable for ship ultra-high warning systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118865103A_ABST
    Figure CN118865103A_ABST
Patent Text Reader

Abstract

The invention provides a ship identification and height detection method based on visual image fusion. The method comprises the following steps: establishing communication with a camera after inputting camera parameters; obtaining a visible light graph containing the whole to-be-measured ship through a monocular camera, and obtaining an infrared image containing the whole to-be-measured ship through an infrared camera; judging whether the camera is online or not; if so, obtaining and fusing the infrared image and the visible light image to obtain an image; if not, communication with the camera is established again; detecting whether a ship exists or not according to the infrared image and the visible light image, if yes, executing the next step, and if not, continuing to acquire and fuse the infrared image and the visible light image until the ship is detected; and calculating the ship height by integrating various parameters. The problems of troublesome installation, high cost and limited measurement distance are solved; the technical problem of large height measurement error caused by poor imaging quality or insufficient image definition and detail information under poor imaging conditions such as night, weak light and the like is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of a vehicle door subassembly line in a general assembly workshop, and in particular to a ship recognition and height detection method based on visual image fusion. Background Art

[0002] Due to the complex and changeable hydrological environment in the bridge area, coupled with the changes in the ship's own load and the influence of precipitation and climate, the driver will make an error in estimating whether the ship can pass through the navigation hole, which will lead to the occurrence of the ship's over-height collision with the bridge accident. After the ship hits the bridge, it will not only cause damage to the ship itself and the bridge, but also threaten the life safety of the crew and other ships, affect the normal navigation order, and cause significant economic losses. Therefore, before the ship passes through the bridge area, accurately measuring the ship's clearance height is of great significance to reduce the occurrence of over-height ship collision accidents.

[0003] The existing ship height measurement scheme requires the use of visible light cameras for measurement, but the installation is cumbersome, the cost is high, and the measurement distance is limited. The image quality of visible light cameras is poor under poor imaging conditions such as night and low light. Monocular cameras are easy to install, low-priced, and have a long observation distance, but the visible light imaging of monocular cameras is easily affected by imaging conditions; while infrared cameras are basically not affected by external interference and influence, and use the thermal radiation of objects to perform imaging, but the image clarity and detail information they capture are insufficient. Summary of the invention

[0004] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a ship identification and height detection method based on visual image fusion to solve the technical problems of cumbersome installation, high cost and limited measuring distance; poor imaging quality or insufficient image clarity and detail information under poor imaging conditions such as at night and in low light, resulting in large height measurement errors.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows:

[0006] The ship recognition and height detection method based on visual image fusion of the present invention comprises the following steps:

[0007] After inputting the camera parameters, communication is established with the camera; the camera includes a monocular camera and an infrared camera, and the monocular camera and the infrared camera are formed in one piece; a visible light image including the entire ship to be measured is obtained by the monocular camera, and an infrared image including the entire ship to be measured is obtained by the infrared camera; the camera parameters include camera focal length and camera inclination;

[0008] Determine whether the camera is online; if online, acquire and fuse the infrared image and the visible light image to obtain an image; if not online, re-establish communication with the camera;

[0009] Detect whether there is a ship based on the infrared image and the visible light image. If yes, proceed to the next step. If no, continue to acquire and fuse the infrared image and the visible light image until a ship is detected;

[0010] The ship height is calculated by integrating various parameters, which refer to the focal length f of the camera;

[0011] The specific method for acquiring and fusing infrared images and visible light images comprises the following steps:

[0012] The infrared image and the visible light image are input into the feature extractor respectively, and the extracted features are fused and spliced;

[0013] Put it into the decoder to reconstruct the image and obtain the fused image;

[0014] After obtaining the fused image, put it into YOLOv8 for ship target detection and training;

[0015] Calculate the target detection loss and fusion loss for the target detection and fusion images respectively and add them to output the image. The total loss is used to guide the fusion network and conduct the next round of training.

[0016] The calculation of ship height by combining various parameters specifically includes the following steps:

[0017] The distance D between the camera and the ship to be measured is calculated according to the distance measurement method;

[0018] After the camera lens distortion correction is performed, two values ​​are obtained, and after the pitch angle correction, the height h of the image of the measured ship on the target surface is obtained;

[0019] Assuming the ship height is H, the calculated ship height is:

[0020]

[0021] Furthermore, the camera adopts an intelligent thermal imaging dual-spectrum gimbal capable of imaging within a range of 5 kilometers.

[0022] Furthermore, the camera focal length is obtained by calibrating the camera.

[0023] Furthermore, the feature extractor for infrared images uses the LKDF module; the feature extractor for visible light images uses the improved DTRM combined with the Vision Outlooke attention mechanism;

[0024] The LKDF module includes 4 3×3 convolutional layers, 4 ReLU layers, 2 1×1 convolutional layers and 1 LSKBlock; in the LKDF module, after 4 convolutional feature extractions, the features of each stage are jump-cascaded to the following layers, so that the features of the front and middle layers in the module are retained to the output of the latter layer, ensuring that the network can obtain information from features of different scales in the infrared image; the 4 ReLU layers nonlinearize the features obtained by the 3×3 convolutional layer; the 2 1×1 convolutional layers compress the features point by point convolution;

[0025] The improved DTRM mainly consists of 1 CDFB module and 2 TRB modules; the CDFB module extracts global information and contains two branches. After receiving the input, the lower branch first uses a 7×7 large kernel convolution to extract the global structure and general features; in the upper branch of CDFB, spatial pyramid pooling is used to replace the global average pooling to obtain features at different spatial scales; the TRB module is a Transformer block; in the subsequent TRB module, Outlook attention is used to obtain detailed information of the image.

[0026] Furthermore, the distance measurement method is to measure the distance D based on the AIS system.

[0027] A spherical model is used to calculate spatial distances, and longitude and latitude lines are simplified into straight lines;

[0028] Let M and S represent the locations of the camera and the ship respectively, Lon 1 represents the longitude of the coordinates of point M, and Lat 1 represents the latitude of the coordinates of point M; Lon2 represents the longitude of the coordinates of point S, and Lat2 represents the latitude of the coordinates of point S;

[0029] Calculate the difference in longitude and latitude between two points:

[0030] ΔLon=Lon2-Lon1 (2);

[0031] ΔLat=Lat2-Lat1 (3);

[0032] The radius of the earth R is 6370996.81m, then the east-west distance DLon in longitude can be expressed as:

[0033]

[0034] The north-south distance DLat in latitude can be expressed as:

[0035] DLat=RΔLat (5);

[0036] Since the longitude and latitude are assumed to be straight lines, ∠MOS is 90°, so the distance LMS between M and S can be obtained as:

[0037]

[0038] Further, the camera lens distortion correction includes the following steps:

[0039] Suppose in the image coordinate system, the coordinates of a point in the corrected image are (x, y), and the coordinates of the point in the corrected image are r represents the distance from the point to the center of the image, then the effect of radial distortion on the pixel can be described as:

[0040]

[0041] Among them, k i represents the coefficient of radial distortion;

[0042] (μ0,υ0) is the representation of the center of the image coordinate system in the pixel coordinate system. Let dx and dy be the number of pixels per unit mm length in each row and column respectively. Therefore, the conversion relationship between pixel coordinates and image coordinates when not corrected can be obtained as follows:

[0043]

[0044] Similarly, after the distortion is corrected, the conversion relationship between pixel coordinates and image coordinates can be obtained as follows:

[0045]

[0046] According to formula (10) and formula (11), we can get:

[0047]

[0048] Substituting formula (12) into formula (7) and formula (8) yields:

[0049]

[0050] Simplifying, we get:

[0051]

[0052] Using m points in n calibration plate images, putting all equations together can get 2mn equations; converting the equation in (14) into matrix form can get:

[0053]

[0054] Formula (15) can be simplified as:

[0055] Dk = d (16);

[0056] The least square method can be used to obtain the distortion coefficient matrix k and the distortion parameters k1 and k2;

[0057]

[0058] Furthermore, the pitch angle correction includes the following steps:

[0059] When the camera tilt angle is β, the actual object H is on the image plane II β The upper image is P β , after correction, in image plane II c The upper image is P c ;

[0060] When the camera tilt angle is β, the object is in the image plane II β and II c The imaging on has the following relationship:

[0061]

[0062] Among them, f is the focal length of the camera, t is the straight line parameter, according to the principle of camera imaging, z c The distance to the imaging plane is the focal length f, then:

[0063] z c =f = (v β sinβ+fcosβ)t (19);

[0064] Then the straight line parameter t can be expressed as:

[0065]

[0066] Then y c It can be expressed as:

[0067]

[0068] Assume that the coordinates of the highest point of the ship in the image are (x,y h ), the point on the boundary between the ship and the water surface is (x,y l ), then when β is not 0, the pixel height h of the ship in the image p for:

[0069] h p =y h -y l (twenty two);

[0070] According to formula (21), we can get y h and l In the image plane Π c The coordinates on are:

[0071]

[0072] According to equations (22), (23) and (24), we can get c The pixel height of the ship for:

[0073]

[0074] Furthermore, the specific method for calculating the height h of the image of the measured ship on the target surface is:

[0075] Assume that the pixel coordinate of the highest point of the ship's imaging in the image sensor is (x sh ,y sh ), the pixel coordinates of the lowest point are (x sl ,y sl ), assuming that the two distortion parameters of the camera obtained by the camera lens distortion correction are k1 and k2, then the y pixel coordinates of the highest and lowest points after the camera lens distortion correction are:

[0076]

[0077] in:

[0078]

[0079] According to the pitch angle correction, when the camera has a tilt angle β, and The coordinates after correcting the inclination are:

[0080]

[0081] According to equations (30) and (31), the pixel coordinate difference of the ship after distortion correction can be obtained as:

[0082] Δy s =y shβ -y slβ (32);

[0083] Substituting it into the simplified form, we get:

[0084]

[0085] Let the physical height of the camera sensor be h s , the resolution of the camera output image in the y direction is p h , then the height of the target surface imaging corresponding to a single pixel point of the camera in the y direction can be obtained as:

[0086]

[0087] According to the pixel coordinates of the highest and lowest points of the ship on the image sensor, the height h of the image of the measured ship on the target surface can be calculated as:

[0088]

[0089] In summary, the height of the ship is calculated as:

[0090]

[0091] Furthermore, the total loss uses the structural similarity loss L SSIM , overlap loss L IOU , the formula is:

[0092] L loss =αL SSIM (I v ,I i )+βL IOU (l f ,l d ) (37);

[0093] Where L loss is the loss function; α and β are hyperparameters used to adjust L SSIM and L IOU The weight between v is the visible light image, I i is the infrared image, l f is the recognition box of the target in the fused image, l d is the label of the target in the visible light image in the dataset;

[0094] L SSIM 1-SSIM is used to measure the structural similarity between the fused image and the multi-source image. The calculation formula is:

[0095] L SSIM =1-SSIM(I v ,I i ) (38);

[0096]

[0097] Where SSIM(·) represents the structural similarity operation of the objects, μ represents the average value, and ε vi represents the covariance of infrared and visible light images, σ i represents the variance of the infrared image, σ v represents the variance of the visible light image, C1 and C2 are constants;

[0098] L IOUThe intersection-over-union ratio is used as an indicator to measure the promotion ability of the fused image to the target detection network; the intersection and union in IOU refer to the intersection and union of the real bounding box and the predicted bounding box of the target. Assuming that A1 is the real bounding box of the target ship and A2 is the bounding box of the ship predicted by the target detection algorithm, their intersection and union can be expressed as:

[0099]

[0100] Where S(·) represents the calculated area.

[0101] Compared with the prior art, the present invention has the following beneficial effects:

[0102] (1) In order to solve the problems of the existing ship clearance height measurement scheme, such as the troublesome installation, high cost and measurement distance, the present invention designs a ship recognition and height detection method based on visual image fusion, based on the pinhole imaging principle, and considering the influence of pitch angle and lens distortion on the measurement accuracy, the perspective transformation and distortion correction are performed. At the same time, the existing AIS system is used to realize the calculation of the measurement distance, without using additional equipment, the installation is simple and cost-saving. Finally, only the information obtained by the camera and the AIS information of the ship are needed to measure the ship's clearance height.

[0103] (2) In order to solve the problems of poor imaging quality of visible light cameras at night and in low light environments and low detection accuracy of target detection algorithms for visible light images, the present invention designs a ship recognition and height detection method based on visual image fusion, taking into account the need for high-precision target detection in measurement tasks, and designs feature extractors for them according to the characteristics of infrared and visible light images. The target detection network itself trains ship recognition while driving the fusion network, so that the fusion results of the fusion network are helpful for the target detection task of ships. Comparative experiments on public data sets show that the infrared and visible light image fusion algorithm proposed in this paper is superior in subjective and objective evaluation, and has a significant improvement in the detection indicators of targets. The feature extractor and target detection network are effective for the overall task.

[0104] (3) The present invention has high accuracy in measuring the height of a ship and can be used in an early warning system for excessive height of a ship. BRIEF DESCRIPTION OF THE DRAWINGS

[0105] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0106] Figure 1 It is an overall flow chart of the ship recognition and height detection method based on visual image fusion according to an embodiment of the present invention.

[0107] Figure 2 It is a schematic diagram of the principle of acquiring and fusing infrared images and visible light images according to an embodiment of the present invention.

[0108] Figure 3 It is a specific flow chart of calculating the height of a ship according to an embodiment of the present invention.

[0109] Figure 4 is a ship-related image to which the embodiment of the present invention is applied, wherein: Figure 4 (a) and Figure 4 (b) shows the infrared image and visible light image taken by the dual-spectrum PTZ camera during the experiment. Figure 4 (c) shows the fused image result.

[0110] Figure 5 A graph showing the proportion of each IOU range when ship target detection is performed using an embodiment of the present invention. DETAILED DESCRIPTION

[0111] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.

[0112] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.

[0113] like Figure 1 As shown, the ship recognition and height detection method based on visual image fusion of this embodiment includes the following steps:

[0114] Step 1. After entering the camera parameters, establish communication with the camera. The camera uses an intelligent thermal imaging dual-spectrum gimbal that can image within a range of 5 kilometers, including a monocular camera and an infrared camera, and the monocular camera and the infrared camera are integrated; the visible light image containing the entire ship to be measured is obtained through the monocular camera, and the infrared image containing the entire ship to be measured is obtained through the infrared camera. The camera parameters include camera focal length and camera inclination; the camera focal length is obtained through camera calibration.

[0115] Step 2. Determine whether the camera is online; if it is online, acquire and fuse the infrared image and the visible light image to obtain an image; if it is not online, re-establish communication with the camera;

[0116] Step 3. Detect whether there is a ship based on the infrared image and the visible light image. If yes, proceed to the next step. If no, continue to acquire and fuse the infrared image and the visible light image until a ship is detected.

[0117] Step 4. Calculate the ship height by integrating various parameters, where the various parameters refer to the camera focal length f.

[0118] Among them, Figure 2 As shown, in step 2, the specific method of acquiring and fusing the infrared image and the visible light image includes the following steps:

[0119] Step 2-1. Input the infrared image and the visible light image into the feature extractor respectively, and fuse and splice the extracted features;

[0120] Step 2-2. The feature extractor for infrared images uses the LKDF module; the feature extractor for visible light images uses the improved DTRM combined with the Vision Outlooke attention mechanism;

[0121] The LKDF module contains 4 3×3 convolutional layers, 4 ReLU layers, 2 1×1 convolutional layers and 1 LSK Block. In the LKDF module, after 4 convolutional feature extractions, the features of each stage are cascaded to the following layers, so that the features of the front and middle layers in the module are retained to the output of the latter layer, ensuring that the network can obtain information from features of different scales in the infrared image. The 4 ReLU layers nonlinearize the features obtained by the 3×3 convolutional layer. The 2 1×1 convolutional layers compress the features point by point.

[0122] The improved DTRM mainly consists of 1 CDFB module and 2 TRB modules; the CDFB module extracts global information and contains two branches. After receiving the input, the lower branch first uses a 7×7 large kernel convolution to extract the global structure and general features; in the upper branch of CDFB, spatial pyramid pooling is used to replace the global average pooling to obtain features at different spatial scales; the TRB module is a Transformer block; in the subsequent TRB module, Outlook attention is used to obtain detailed information of the image.

[0123] Step 2-3. Put the image into the decoder to reconstruct the image and obtain the fused image;

[0124] Step 2-4. After obtaining the fused image, put it into YOLOv8 for ship target detection and training;

[0125] Step 2-5. Calculate the target detection loss and fusion loss for the target detection and fusion images respectively, add them together and output the image, and get the total loss to guide the fusion network and conduct the next round of training;

[0126] like Figure 3 As shown, in step 4, assuming that the ship height is H, the calculated ship height is:

[0127]

[0128] The distance between the camera and the ship to be measured is D; the height of the image of the ship to be measured on the target surface is h; and the focal length of the camera is f. The camera target surface, that is, the size of the image sensor inside the camera, is an important indicator for measuring camera performance. The larger the target surface size, the more light and details the camera can capture, with better low-light performance and shallower depth of field. The size of the target surface directly affects the image quality and usage scenarios of the camera.

[0129] According to the above formula, various parameters are combined to calculate the ship height, which specifically includes the following steps:

[0130] Step 4-1. Calculate the distance D between the camera and the ship to be measured according to the distance measurement method;

[0131] The distance measurement method is to measure the distance D based on the AIS system, use the spherical model to calculate the spatial distance, and simplify the longitude and latitude lines into straight lines;

[0132] Let M and S represent the locations of the camera and the ship respectively, Lon 1 represents the longitude of the coordinates of point M, and Lat 1 represents the latitude of the coordinates of point M; Lon2 represents the longitude of the coordinates of point S, and Lat2 represents the latitude of the coordinates of point S.

[0133] Calculate the difference in longitude and latitude between two points:

[0134] ΔLon=Lon2-Lon1 (2);

[0135] ΔLat=Lat2-Lat1 (3);

[0136] The radius of the earth R is 6370996.81m, then the east-west distance DLon in longitude can be expressed as:

[0137]

[0138] The north-south distance DLat in latitude can be expressed as:

[0139] DLat=RΔLat (5);

[0140] Since the longitude and latitude are assumed to be straight lines, ∠MOS is 90°, so the distance LMS between M and S can be obtained as:

[0141]

[0142] After the camera lens distortion correction is performed, two values ​​are obtained, and after the pitch angle correction, the height h of the image of the measured ship on the target surface is obtained;

[0143] Camera lens distortion correction includes the following steps:

[0144] Suppose in the image coordinate system, the coordinates of a point in the corrected image are (x, y), and the coordinates of the point in the corrected image are r represents the distance from the point to the center of the image, then the effect of radial distortion on the pixel can be described as:

[0145]

[0146] Among them, k i represents the coefficient of radial distortion;

[0147] (μ0,υ0) is the representation of the center of the image coordinate system in the pixel coordinate system. Let dx and dy be the number of pixels per unit mm length in each row and column respectively. Therefore, the conversion relationship between pixel coordinates and image coordinates when not corrected can be obtained as follows:

[0148]

[0149] Similarly, after the distortion is corrected, the conversion relationship between pixel coordinates and image coordinates can be obtained as follows:

[0150]

[0151] According to formula (10) and formula (11), we can get:

[0152]

[0153] Substituting formula (12) into formula (7) and formula (8) yields:

[0154]

[0155] Simplifying, we get:

[0156]

[0157] Using m points in n calibration plate images, putting all equations together can get 2mn equations; converting the equation in (14) into matrix form can get:

[0158]

[0159] Formula (15) can be simplified as:

[0160] Dk = d (16);

[0161] The least square method can be used to obtain the distortion coefficient matrix k and the distortion parameters k1 and k2;

[0162]

[0163] Pitch angle correction includes the following steps:

[0164] When the camera tilt angle is β, the actual object H is on the image plane Π β The upper image is P β , after correction, in the image plane Π c The upper image is P c ;

[0165] When the camera tilt angle is β, the object is in the image plane Π β and Π c The imaging on has the following relationship:

[0166]

[0167] Among them, f is the focal length of the camera, t is the straight line parameter, according to the principle of camera imaging, z c The distance to the imaging plane is the focal length f, then:

[0168] z c =f = (v β sinβ+fcosβ)t (19);

[0169] Then the straight line parameter t can be expressed as:

[0170]

[0171] Then y c It can be expressed as:

[0172]

[0173] Assume that the coordinates of the highest point of the ship in the image are (x,y h ), the point on the boundary between the ship and the water surface is (x,y l ), then when β is not 0, the pixel height h of the ship in the image p for:

[0174] h p =y h -y l (twenty two);

[0175] According to formula (21), we can get yh and l In Image Plane II c The coordinates on are:

[0176]

[0177] According to equations (22), (23) and (24), we can get c The pixel height of the ship for:

[0178]

[0179] The specific method for calculating the height h of the image of the measured ship on the target surface is:

[0180] Assume that the pixel coordinate of the highest point of the ship's imaging in the image sensor is (x sh ,y sh ), the pixel coordinates of the lowest point are (x sl ,y sl ), assuming that the two distortion parameters of the camera obtained by the camera lens distortion correction are k1 and k2, then the y pixel coordinates of the highest and lowest points after the camera lens distortion correction are:

[0181]

[0182] in:

[0183]

[0184] According to the pitch angle correction, when the camera has a tilt angle β, and The coordinates after correcting the inclination are:

[0185]

[0186] According to equations (30) and (31), the pixel coordinate difference of the ship after distortion correction can be obtained as:

[0187] Δy s =y shβ -y slβ (32);

[0188] Substituting it into the simplified form, we get:

[0189]

[0190] Let the physical height of the camera sensor be h s , the resolution of the camera output image in the y direction is p h, then the height of the target surface imaging corresponding to a single pixel point of the camera in the y direction can be obtained as:

[0191]

[0192] According to the pixel coordinates of the highest and lowest points of the ship on the image sensor, the height h of the image of the measured ship on the target surface can be calculated as:

[0193]

[0194] In summary, the height of the ship is calculated as:

[0195]

[0196] The total loss uses the structural similarity loss L SSIM , overlap loss L IOU , the formula is:

[0197] L loss =αL SSIM (I v ,I i )+βL IOU (l f ,l d ) (37);

[0198] Where L loss is the loss function; α and β are hyperparameters used to adjust L SSIM and L IOU The weight between v is the visible light image, I i is the infrared image, l f is the recognition box of the target in the fused image, l d is the label of the target in the visible light image in the dataset;

[0199] L SSIM 1-SSIM is used to measure the structural similarity between the fused image and the multi-source image. The calculation formula is:

[0200] L SSIM =1-SSIM(I v ,I i ) (38);

[0201]

[0202] Where SSIM(·) represents the structural similarity operation of the objects, μ represents the average value, and ε vi represents the covariance of infrared and visible light images, σ i represents the variance of the infrared image, σ vrepresents the variance of the visible light image, C1 and C2 are constants;

[0203] L IOU The intersection-over-union ratio is used as an indicator to measure the promotion ability of the fused image to the target detection network; the intersection and union in IOU refer to the intersection and union of the real bounding box and the predicted bounding box of the target. Assuming that A1 is the real bounding box of the target ship and A2 is the bounding box of the ship predicted by the target detection algorithm, their intersection and union can be expressed as:

[0204]

[0205] Where S(·) represents the calculated area.

[0206] The field experiment of this embodiment was applied to select a ship in the Yangtze River, and the headroom height of the ship was manually measured before the experiment. The load of the ship was not changed during the experiment to ensure that the headroom height remained unchanged. The experiment was conducted to change the position of the ship in the Yangtze River, and the identity and longitude and latitude of the ship were confirmed on the monitoring screen to achieve the change of the measurement distance. The headroom height of the measured ship was measured to be 12.5m before the experiment. Figure 4 (a) and Figure 4 (b) shows the infrared image and visible light image taken by the dual-spectrum PTZ camera during the experiment. Figure 4 (c) shows the fused image result. As can be seen from the figure, the fused image retains the image details such as the water surface color, light, and light reflection in the visible light image, and the outline of the infrared image is clearly preserved.

[0207] The experiment took photos of ships on the river in the evening and at night, and obtained a total of 312 pairs of infrared and visible light images after processing. After the infrared and visible light images were fused, the YOLOv8 network weights trained by the fusion network were used for target detection, and the proportion of IOU of each segment was counted. For visible light, the official weights of YOLOv8 were used for ship target detection. The proportion of each IOU range was obtained as shown in the figure below: Figure 5 As shown, from Figure 5 It can be seen that the ship IOU range of the visible light image is mainly distributed between 0-0.4, while the ship IOU of the fused image is distributed between 0.4-0.8. The IOU ratio of the fused image above 0.6 is much higher than that of the visible light image. As can be seen from the above figure, compared with the traditional visible light image, the fused image has a better detection effect on the ship.

[0208] After the experimental ship changes its position many times, the ship's clearance height data is calculated in the fused image by continuously changing the camera parameters as follows:

[0209] Table 1 Ship clearance height measurement results

[0210]

[0211] From the data in Table 1, it can be seen that when the ship's measurement distance changes, the error obtained by changing the appropriate focal length and pitch angle for measurement is within the range of 0.1 to 0.5m. When the measurement distance is less than 520m, the measurement error is less than 0.4m. The effectiveness of the algorithm has been proved by multiple clearance height measurements of ships, and it can be used in the over-altitude early warning monitoring of ships.

[0212] The above is a detailed introduction to the ship identification and height detection method based on visual image fusion provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A ship recognition and height detection method based on visual image fusion, characterized in that: The following steps are involved: After inputting the camera parameters, communication is established with the camera; the camera includes a monocular camera and an infrared camera, and the monocular camera and the infrared camera are formed in one piece; a visible light image including the entire ship to be measured is obtained by the monocular camera, and an infrared image including the entire ship to be measured is obtained by the infrared camera; the camera parameters include camera focal length and camera inclination; Determine whether the camera is online; if online, acquire and fuse the infrared image and the visible light image to obtain an image; if not online, re-establish communication with the camera; Detect whether there is a ship based on the infrared image and the visible light image. If yes, proceed to the next step. If no, continue to acquire and fuse the infrared image and the visible light image until a ship is detected; The ship height is calculated by integrating various parameters, which refer to the focal length f of the camera; The specific method for acquiring and fusing infrared images and visible light images comprises the following steps: The infrared image and the visible light image are input into the feature extractor respectively, and the extracted features are fused and spliced; Put it into the decoder to reconstruct the image and obtain the fused image; After obtaining the fused image, put it into YOLOv8 for ship target detection and training; Calculate the target detection loss and fusion loss for the target detection and fusion images respectively and add them to output the image. The total loss is used to guide the fusion network and conduct the next round of training. The calculation of ship height by combining various parameters specifically includes the following steps: The distance D between the camera and the ship to be measured is calculated according to the distance measurement method; After the camera lens distortion correction is performed in sequence, the 2 and pitch angle corrections are obtained and then the height h of the image of the measured ship on the target surface is calculated; Assuming the ship height is H, the calculated ship height is:

2. The ship recognition and height detection method based on visual image fusion according to claim 1 is characterized in that: The camera uses an intelligent thermal imaging dual-spectrum gimbal capable of imaging within a range of 5 kilometers.

3. The ship recognition and height detection method based on visual image fusion according to claim 1 is characterized in that: The camera focal length is obtained by calibrating the camera.

4. The ship recognition and height detection method based on visual image fusion according to claim 1 is characterized in that: The feature extractor for infrared images uses the LKDF module; the feature extractor for visible light images uses the improved DTRM combined with the Vision Outlooke attention mechanism; The LKDF module contains 4 3×3 convolutional layers, 4 ReLU layers, 2 1×1 convolutional layers and 1 LSK Block. In the LKDF module, after 4 convolutional feature extractions, the features of each stage are jump-cascaded to the following layers, so that the features of the front and middle layers in the module are retained to the output of the latter layer, ensuring that the network can obtain information from features of different scales in the infrared image. The 4 ReLU layers nonlinearize the features obtained by the 3×3 convolutional layer; Two 1×1 convolutional layers perform point-by-point convolution to compress the features; The improved DTRM mainly consists of one CDFB module and two TRB modules. The CDFB module extracts global information and contains two branches. After receiving the input, the lower branch first uses a 7×7 large kernel convolution to extract the global structure and general features. In the upper branch of CDFB, spatial pyramid pooling is used to replace the global average pooling to obtain features at different spatial scales. The TRB module is a Transformer block; in the subsequent TRB module, Outlook attention is used to obtain the detailed information of the image.

5. The ship recognition and height detection method based on visual image fusion according to claim 1 is characterized in that: The distance measurement method is to measure the distance D based on the AIS system. A spherical model is used to calculate spatial distances, and longitude and latitude lines are simplified into straight lines; Let M and S represent the locations of the camera and the ship respectively, Lon1 represents the longitude of the coordinates of point M, and Lat1 represents the latitude of the coordinates of point M; Lon2 represents the longitude of the coordinates of point S, and Lat2 represents the latitude of the coordinates of point S; Calculate the difference in longitude and latitude between two points: ΔLon=Lon2-Lon1 (2); ΔLat=Lat2-Lat1 (3); The radius of the earth R is 6370996.81m, then the east-west distance DLon in longitude can be expressed as: The north-south distance DLat in latitude can be expressed as: DLat=RΔLat (5); Since the longitude and latitude are assumed to be straight lines, ∠MOS is 90°, so the distance LMS between M and S can be obtained as:

6. The ship recognition and height detection method based on visual image fusion according to claim 1 is characterized in that: Camera lens distortion correction includes the following steps: Suppose in the image coordinate system, the coordinates of a point in the corrected image are (x, y), and the coordinates of the point in the corrected image are r represents the distance from the point to the center of the image, then the effect of radial distortion on the pixel can be described as: Among them, k i represents the coefficient of radial distortion; (μ0,υ0) is the representation of the center of the image coordinate system in the pixel coordinate system. Let dx and dy be the number of pixels per unit mm length in each row and column respectively. Therefore, the conversion relationship between pixel coordinates and image coordinates when not corrected can be obtained as follows: Similarly, after the distortion is corrected, the conversion relationship between pixel coordinates and image coordinates can be obtained as follows: According to formula (10) and formula (11), we can get: Substituting formula (12) into formula (7) and formula (8) yields: Simplifying, we get: Using m points in n calibration plate images, putting all equations together can get 2mn equations; converting the equation in (14) into matrix form can get: Formula (15) can be simplified as: Dk = d (16); The least square method can be used to obtain the distortion coefficient matrix k and the distortion parameters k1 and k2; 7. The method for ship identification and height detection based on visual image fusion according to claim 1 is characterized in that: Pitch angle correction includes the following steps: When the camera tilt angle is β, the actual object H is on the image plane Π β The upper image is P β , after correction, in the image plane Π c The upper image is P c ; When the camera tilt angle is β, the object is in the image plane Π β and Π c The imaging on has the following relationship: Among them, f is the focal length of the camera, t is the straight line parameter, according to the principle of camera imaging, z c The distance to the imaging plane is the focal length f, then: z c =f=(v β sinβ+fcosβ)t (19); Then the straight line parameter t can be expressed as: Then y c It can be expressed as: Assume that the coordinates of the highest point of the ship in the image are (x,y h ), the point on the boundary between the ship and the water surface is (x,y l ), then when β is not 0, the pixel height h of the ship in the image p for: h p =y h -y l (22); According to formula (21), we can get y h and l In the image plane Π c The coordinates on are: According to equations (22), (23) and (24), we can get c The pixel height of the ship for:

8. The ship recognition and height detection method based on visual image fusion according to claim 1 is characterized in that: The specific method for calculating the height h of the image of the measured ship on the target surface is: Assume that the pixel coordinate of the highest point of the ship's imaging in the image sensor is (x sh ,y sh ), the pixel coordinates of the lowest point are (x sl ,y sl ), assuming that the two distortion parameters of the camera obtained by the camera lens distortion correction are k1 and k2, then the y pixel coordinates of the highest and lowest points after the camera lens distortion correction are: in: According to the pitch angle correction, when the camera has a tilt angle β, and The coordinates after correcting the inclination are: According to equations (30) and (31), the pixel coordinate difference of the ship after distortion correction can be obtained as: Δy s =y shβ -y slβ (32); Substituting it into the simplification, we can get: Let the physical height of the camera sensor be h s , the resolution of the camera output image in the y direction is p h , then the height of the target surface imaging corresponding to a single pixel point of the camera in the y direction can be obtained as: According to the pixel coordinates of the highest and lowest points of the ship on the image sensor, the height h of the image of the measured ship on the target surface can be calculated as:

9. The method for ship identification and height detection based on visual image fusion according to claim 1, characterized in that: The total loss uses the structural similarity loss L SSIM , overlap loss L IOU , the formula is: L loss =αL SSIM (I v ,I i )+βL IOU (l f ,l d ) (37); Where L loss is the loss function; α and β are hyperparameters used to adjust L SSIM and L IOU The weight between v is the visible light image, I i is the infrared image, l f is the recognition box of the target in the fused image, l d is the label of the target in the visible light image in the dataset; L SSIM 1-SSIM is used to measure the structural similarity between the fused image and the multi-source image. The calculation formula is: L SSIM =1-SSIM(I v ,I i ) (38); Where SSIM(·) represents the structural similarity operation of the objects, μ represents the average value, and ε vi represents the covariance of infrared and visible light images, σ i represents the variance of the infrared image, σ v represents the variance of the visible light image, C1 and C2 are constants; L IOU The intersection-over-union ratio is used as an indicator to measure the promotion ability of the fused image to the target detection network; the intersection and union in IOU refer to the intersection and union of the real bounding box and the predicted bounding box of the target. Assuming that A1 is the real bounding box of the target ship and A2 is the bounding box of the ship predicted by the target detection algorithm, their intersection and union can be expressed as: Where S(·) represents the calculated area.

Citation Information

Cited By

  • Water surface target height calculation method, system and device and computer readable storage medium

    CN120672824A