A ship measurement method and system based on video recognition
By setting up camera equipment and virtual analysis lines above the ship, using video recognition technology to analyze the point of intersection between the ship and the parsing line, solve the problem of existing dual laser models when no accurate measurement is required. Accurate and low -cost ship measurement.
Patent Information
- Application Number
- CN202411365838.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-09-29
AI Technical Summary
The existing dual-laser mode ship measurement method is wasted performance without the need to accurately measure the width and length of the ship, and is costly and requires a new measurement environment.
Adopt video recognition -based ship measurement methods, set up camera devices above the ship, set up two virtual parsing lines, use video frames for object recognition, analyze the point of intersection between the ship and the analysis line, calculate the length, width and overline of the ship's shipping line, calculate the ship's length, width and cross -line line. time.
The measurement cost is reduced, it is convenient to transform in the existing environment, no need to build a new measurement environment, while improving the flexibility and accuracy of measurement.
Smart Images

Figure CN118865747B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of ship measurement, and in particular relates to a ship measurement method and system based on video recognition. Background Art
[0002] One of the ways to measure ships in motion is to use a measurement unit consisting of two laser scanners (hereinafter referred to as dual laser mode), which is installed on the bridge above the channel navigation hole or on the shore to scan the passing ships and measure various data of the ships. This method has its advantages over other measurement methods: compared with video recognition technology, the dual laser mode is not affected by lighting conditions; compared with radar imaging technology, the dual laser mode can scan the precise outline of the ship; compared with infrared imaging technology, the dual laser mode also has an advantage in measurement accuracy.
[0003] Although the dual laser mode has advantages over many other measurement methods, it also has certain shortcomings. In some cases where the focus is on ship flow rather than data such as the ship and ship width, performance is wasted and a new measurement environment must be built as required, which is too costly. Summary of the invention
[0004] In order to solve the above technical problems, the present invention provides a ship measurement method and system based on video recognition, which are used to solve the technical problems in the prior art.
[0005] On the one hand, the present invention provides the following technical solution, a ship measurement method based on video recognition, comprising:
[0006] A camera is arranged above the ship and is aimed at the channel of the ship. A resolution line is arranged within the shooting range of the camera and is arranged perpendicular to the heading of the ship, wherein the resolution line includes a main line and a secondary line.
[0007] Acquire a ship navigation video through the camera device, perform frame splitting processing on the ship navigation video to obtain a plurality of continuous ship video frames, and perform object recognition based on the ship video frames to obtain a ship data frame;
[0008] Perform data analysis on the ship data frame and determine whether the ship encounters the main line time T0, the ship crosses the main line time T1, the ship encounters the slave line time T2, and the ship crosses the slave line time T3 can be obtained normally;
[0009] If the time when the ship crosses the main line T1 and the time when the ship crosses the slave line T3 can be obtained normally and one of the time when the ship touches the main line T0 and the time when the ship touches the slave line T2 can be obtained normally, the ship measurement data set is determined according to the time when the ship crosses the main line T1 and the time when the ship crosses the slave line T3;
[0010] If the ship encounters the main line time T0 and the ship encounters the slave line time T2 can be obtained normally, and one of the ship crossing the main line time T1 and the ship crossing the slave line time T3 can be obtained normally, then the ship measurement data set is determined according to the ship encounters the main line time T0 and the ship encounters the slave line time T2;
[0011] If the time when the ship hits the main line T0 and the time when the ship crosses the main line T1 can be obtained normally, the ship measurement data set is determined according to the time when the ship hits the main line T0 and the time when the ship crosses the main line T1;
[0012] If the time when the ship hits the slave line T2 and the time when the ship passes through the slave line T3 can be normally obtained, the ship measurement data set is determined according to the time when the ship hits the slave line T2 and the time when the ship passes through the slave line T3.
[0013] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention sets two virtual analysis lines, and first determines, according to the analysis of the video, that the different positions of the ship in different video frames and at different time points correspond to the two analysis lines; when the ship leaves the video illumination area, the ship data is sorted, analyzed, and calculated; in response to different situations, different calculation methods are used to obtain data such as the length, width, and crossing time of the ship. Compared with other modes, the present invention has made improvements, making it cheaper and easier to modify in an existing environment without the need to build a new environment.
[0014] Preferably, the step of performing object recognition based on the ship video frame to obtain a plurality of groups of ship data frames includes:
[0015] A first main line point and a first sub-line point are respectively set on the shore on either side of the waterway within the shooting range of the camera device;
[0016] Controlling the distance between the first main line point and the first sub-line point to be within a preset range, and irradiating the opposite bank with rays from the first main line point and the first sub-line point as starting points, so as to obtain a second main line point and a second sub-line point;
[0017] Adjusting the positions of the second main line point and the second secondary line point so that the line between the first main line point and the second main line point and the line between the first secondary line point and the second secondary line point are both perpendicular to the heading of the ship;
[0018] The adjusted connection line between the first main line point and the second main line point is used as the main line, and the adjusted connection line between the first slave line point and the second slave line point is used as the main line.
[0019] Preferably, the step of performing object recognition based on the ship video frame to obtain a plurality of groups of ship data frames includes:
[0020] Determine an old data set, and determine the last frame of data in the old data set;
[0021] Determine whether the coverage area between the ship video frame and the last frame in the old data set is greater than a coverage threshold and determine whether the center point offset between the ship video frame and the last frame in the old data set is less than an offset threshold;
[0022] If the coverage area of the ship video frame and the last frame in the old data set is greater than the coverage threshold and the center point offset of the ship video frame and the last frame in the old data set is less than the offset threshold, the corresponding video frame is merged with the old data set; if the coverage area of the ship video frame and the last frame in the old data set is not greater than the coverage threshold or the center point offset of the ship video frame and the last frame in the old data set is not less than the offset threshold, the corresponding ship video frame is used as the ship data frame.
[0023] Preferably, the step of determining the ship measurement data set according to the time T1 when the ship passes through the main line and the time T3 when the ship passes through the slave line comprises:
[0024] Obtain annotated empty ship pictures and heavy ship pictures, input the annotated empty ship pictures and heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state identification results. If the empty and heavy state identification results of the ship data frames exceeding a preset proportion are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is an empty state;
[0025] The heading of the ship is determined according to the order of the time T1 when the ship crosses the main line and the time T3 when the ship crosses the secondary line. If the time T1 when the ship crosses the main line is earlier than the time T3 when the ship crosses the secondary line, the heading is upward, otherwise it is downward;
[0026] Calculate the ship speed based on the time it takes for the ship to cross the main line T1 and the time it takes for the ship to cross the secondary line T3 :
[0027] ;
[0028] In the formula, Indicates the distance between the main line and the slave line;
[0029] Based on ship speed Determining the length of the vessel With ship width :
[0030] ;
[0031] ;
[0032] In the formula, For the preset aspect ratio, Indicates absolute value calculation;
[0033] Based on the time when the ship crosses the main line T1 and the time when the ship crosses the secondary line T3, determine the time when the ship hits the main line T0 or the time when the ship hits the secondary line T2:
[0034] ; ;
[0035] Based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the ship's heading, and the ship's speed , Vessel length , Ship width Identify the ship measurement dataset.
[0036] Preferably, the step of determining the ship measurement data set according to the time T0 when the ship hits the main line and the time T2 when the ship hits the slave line comprises:
[0037] Obtain annotated empty ship pictures and heavy ship pictures, input the annotated empty ship pictures and heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state identification results. If the empty and heavy state identification results of the ship data frames exceeding a preset proportion are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is an empty state;
[0038] The heading of the ship is determined according to the order of the time when the ship hits the main line T0 and the time when the ship hits the secondary line T2. If the time when the ship hits the main line T0 is earlier than the time when the ship hits the secondary line T2, the heading is upward, otherwise it is downward;
[0039] Calculate the ship speed based on the time when the ship hits the main line T0 and the time when the ship hits the secondary line T2 :
[0040] ;
[0041] In the formula, Indicates the distance between the main line and the slave line, Indicates absolute value calculation;
[0042] Based on ship speed Determining the length of the vessel With ship width :
[0043] ;
[0044] ;
[0045] In the formula, is the preset aspect ratio;
[0046] Based on the time when the ship hits the main line T0 and the time when the ship hits the secondary line T2, determine the time when the ship crosses the main line T1 or the time when the ship crosses the secondary line T3:
[0047] ; ;
[0048] Based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the ship's heading, and the ship's speed , Vessel length , Ship width Identify the ship measurement dataset.
[0049] Preferably, the step of determining the ship measurement data set according to the time T0 when the ship hits the main line and the time T1 when the ship crosses the main line comprises:
[0050] Obtain annotated empty ship pictures and heavy ship pictures, input the annotated empty ship pictures and heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state identification results. If the empty and heavy state identification results of the ship data frames exceeding a preset proportion are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is an empty state;
[0051] Determine the ship's speed based on the ship's empty and loaded state , and based on the ship speed Determining the length of the vessel With ship width :
[0052] ;
[0053] ;
[0054] In the formula, For the preset aspect ratio, Indicates absolute value calculation;
[0055] Determine the outline rectangle of the ship in the ship data frame and determine the outline corner points of the outline rectangle, if the time required for the outline corner point away from the slave line to cross the main line is equal to the time T1 when the ship crosses the main line, then the heading is upward, if the time required for the outline corner point away from the slave line to cross the main line is not equal to the time T0 when the ship touches the main line, then the heading is downward;
[0056] Based on the course of the ship and the time T0 when the ship hits the main line and the time T1 when the ship crosses the main line, the time T2 when the ship hits the secondary line and the time T3 when the ship crosses the secondary line are determined:
[0057] If the heading is up, then:
[0058] ; ;
[0059] If the heading is down, then:
[0060] ; ;
[0061] In the formula, Indicates the distance between the main line and the slave line;
[0062] Based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the ship's heading, and the ship's speed , Vessel length , Ship width Identify the ship measurement dataset.
[0063] Preferably, the step of determining the ship measurement data set according to the time T2 when the ship hits the slave line and the time T3 when the ship passes through the slave line comprises:
[0064] Obtain annotated empty ship pictures and heavy ship pictures, input the annotated empty ship pictures and heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state identification results. If the empty and heavy state identification results of the ship data frames exceeding a preset proportion are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is an empty state;
[0065] Determine the ship's speed based on the ship's empty and loaded state , and based on the ship speed Determining the length of the vessel With ship width :
[0066] ;
[0067] ;
[0068] In the formula, For the preset aspect ratio, Indicates absolute value calculation;
[0069] Determine the outline rectangle of the ship in the ship data frame and determine the outline corner points of the outline rectangle, if the time required for the outline corner point away from the main line to cross the secondary line is equal to the time T2 when the ship hits the secondary line, then the heading is upward, if the time required for the outline corner point away from the main line to cross the secondary line is not equal to the time T3 when the ship crosses the secondary line, then the heading is downward;
[0070] Based on the course of the ship and the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the time when the ship hits the main line T0 is determined, and based on the time when the ship crosses the main line T1:
[0071] If the heading is up, then:
[0072] ; ;
[0073] If the heading is down, then:
[0074] ; ;
[0075] In the formula, Indicates the distance between the main line and the slave line;
[0076] Based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the ship's heading, and the ship's speed , Vessel length , Ship width Identify the ship measurement dataset.
[0077] In a second aspect, the present invention provides the following technical solution: a ship measurement system based on video recognition, the system comprising:
[0078] A resolution line module, used to set a camera above the ship and aim the camera at the channel of the ship, set a resolution line within the shooting range of the camera and set the resolution line perpendicular to the heading of the ship, the resolution includes a main line and a secondary line;
[0079] A processing module, used for acquiring a ship navigation video through the camera device, performing frame splitting processing on the ship navigation video to obtain a plurality of continuous ship video frames, and performing object recognition based on the ship video frames to obtain a ship data frame;
[0080] A judgment module, used for analyzing the ship data frame and judging whether the ship encounters the main line time T0, the ship crosses the main line time T1, the ship encounters the slave line time T2, and the ship crosses the slave line time T3 can be obtained normally;
[0081] The first data set module is used to determine the ship measurement data set according to the time T1 when the ship crosses the main line and the time T3 when the ship crosses the slave line if the time T1 when the ship crosses the main line and the time T3 when the ship crosses the slave line can be normally obtained and one of the time T0 when the ship hits the main line and the time T2 when the ship hits the slave line can be normally obtained;
[0082] The second data set module is used to determine the ship measurement data set according to the time when the ship hits the main line T0 and the time when the ship hits the slave line T2 if the time when the ship hits the main line T0 and the time when the ship hits the slave line T2 can be normally obtained and one of the time when the ship crosses the main line T1 and the time when the ship crosses the slave line T3 can be normally obtained;
[0083] The third data set module is used to determine the ship measurement data set according to the time T0 when the ship encounters the main line and the time T1 when the ship crosses the main line if the time T0 when the ship encounters the main line and the time T1 when the ship crosses the main line can be obtained normally;
[0084] The fourth data set module is used to determine the ship measurement data set according to the ship encountering the slave line time T2 and the ship passing through the slave line time T3 if the ship encountering the slave line time T2 and the ship passing through the slave line time T3 can be obtained normally.
[0085] In a third aspect, the present invention provides the following technical solution: a computer comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the ship measurement method based on video recognition as described above when executing the computer program.
[0086] In a fourth aspect, the present invention provides the following technical solution: a storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the ship measurement method based on video recognition as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0087] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, 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 work.
[0088] Figure 1A flow chart of a ship measurement method based on video recognition provided in Embodiment 1 of the present invention;
[0089] Figure 2 A schematic diagram of a master line and a slave line provided in Embodiment 1 of the present invention;
[0090] Figure 3 A structural block diagram of a ship measurement system based on video recognition provided in Embodiment 2 of the present invention;
[0091] Figure 4 A schematic diagram of the hardware structure of a computer provided in another embodiment of the present invention.
[0092] The embodiments of the present invention will be further described below with reference to the accompanying drawings. DETAILED DESCRIPTION
[0093] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the embodiments of the present invention, and should not be construed as limiting the present invention.
[0094] Embodiment 1
[0095] In the first embodiment of the present invention, Figure 1 As shown, a ship measurement method based on video recognition includes:
[0096] S1. Arrange a camera above the ship and aim the camera at the channel of the ship. Set a resolution line within the shooting range of the camera and set the resolution line perpendicular to the heading of the ship. The resolution line includes a main line and a secondary line.
[0097] Specifically, in the present application, the video recording device adopts a camera, and is specifically installed on a bridge above the waterway or on the shore side, and the shooting range of the video recording device is aimed at the waterway.
[0098] Wherein, the step S1 comprises:
[0099] S11, respectively setting a first main line point and a first sub-line point on the shore on either side of the waterway within the shooting range of the camera device.
[0100] S12, controlling the distance between the first main line point and the first slave line point to be within a preset range, and irradiating the opposite bank in a ray manner with the first main line point and the first slave line point as starting points, so as to obtain a second main line point and a second slave line point.
[0101] S13. Adjust the positions of the second main line point and the second secondary line point so that a line between the first main line point and the second main line point and a line between the first secondary line point and the second secondary line point are perpendicular to the heading of the ship.
[0102] S14, taking the adjusted connection line between the first main line point and the second main line point as the main line, and taking the adjusted connection line between the first secondary line point and the second secondary line point as the main line;
[0103] Specifically, when selecting the second main line point and the second secondary line point, the first main line point and the first secondary line point can be used as starting points to illuminate the opposite bank through a laser pen, and in this embodiment, the main line and the secondary line are kept horizontal, and the distance between them is 100m. The camera equipment illuminates the channel of the ship from the side, and the positions of the secondary line, the main line, the ship and the camera are as follows: Figure 2 shown.
[0104] S2. Acquire a ship navigation video through the camera device, perform frame splitting processing on the ship navigation video to obtain a plurality of continuous ship video frames, and perform object recognition based on the ship video frames to obtain a ship data frame;
[0105] Wherein, the step S2 comprises:
[0106] S21. Determine an old data set, and determine the last frame of data in the old data set.
[0107] S22, determining whether the coverage area between the ship video frame and the last frame in the old data set is greater than a coverage threshold and determining whether the center point offset between the ship video frame and the last frame in the old data set is less than an offset threshold.
[0108] S23, if the coverage area between the ship video frame and the last frame in the old data set is greater than the coverage threshold and the center point offset between the ship video frame and the last frame in the old data set is less than the offset threshold, then merge the corresponding video frame with the old data set; if the coverage area between the ship video frame and the last frame in the old data set is not greater than the coverage threshold or the center point offset between the ship video frame and the last frame in the old data set is not less than the offset threshold, then use the corresponding ship video frame as the ship data frame;
[0109] Specifically, the old data here can be selected from the historical measurement database. After the judgment process of step S23, it is judged whether the ship in the ship video frame is a measured ship. If the coverage area of the ship video frame and the last frame in the old data set is greater than the coverage threshold and the center point offset of the ship video frame and the last frame in the old data set is less than the offset threshold, it means that the ship in the ship video frame is measured old data, so it is merged into the old data set. If the coverage area of the ship video frame and the last frame in the old data set is not greater than the coverage threshold or the center point offset of the ship video frame and the last frame in the old data set is not less than the offset threshold, it means that the ship in the ship video frame is new data that has not been measured, and it is used as a ship data frame for subsequent measurement.
[0110] S3, analyzing the ship data frame and determining whether the ship hitting the main line time T0, the ship crossing the main line time T1, the ship hitting the slave line time T2, and the ship crossing the slave line time T3 can be obtained normally.
[0111] S4. If the time when the ship crosses the main line T1 and the time when the ship crosses the slave line T3 can be obtained normally and one of the time when the ship hits the main line T0 and the time when the ship hits the slave line T2 can be obtained normally, then determine the ship measurement data set according to the time when the ship crosses the main line T1 and the time when the ship crosses the slave line T3;
[0112] Wherein, the step S4 comprises:
[0113] S41, obtaining annotated empty ship pictures and heavy ship pictures, inputting the annotated empty ship pictures and heavy ship pictures into the YOLOv5 model for training, inputting each of the ship data frames into the trained YOLOv5 model for ship empty and heavy state recognition, and inputting empty and heavy state recognition results, if the empty and heavy state recognition results of the ship data frames exceeding a preset ratio are heavy state, then the empty and heavy state of the ship is the heavy state, otherwise it is an empty state;
[0114] Specifically, in actual situations, the empty or heavy load state of a ship can be determined based on the draft of the ship. If the empty or heavy load state of the ship in more than 50% of the ship data frames is heavy load, the corresponding ship is in a heavy load state, otherwise it is in an empty state.
[0115] S42, determining the heading of the ship according to the order of the time T1 when the ship crosses the main line and the time T3 when the ship crosses the secondary line. If the time T1 when the ship crosses the main line is earlier than the time T3 when the ship crosses the secondary line, the heading is upward, otherwise it is downward.
[0116] S43, calculating the ship speed according to the time T1 when the ship crosses the main line and the time T3 when the ship crosses the secondary line :
[0117] ;
[0118] In the formula, Indicates the distance between the main line and the slave line;
[0119] in, Indicates absolute value calculation.
[0120] S44, based on ship speed Determining the length of the vessel With ship width :
[0121] ;
[0122] ;
[0123] In the formula, is the preset aspect ratio;
[0124] In this embodiment, the ship width is assumed to be 0.2 times the ship length, so is 0.2.
[0125] S45, based on the time T1 when the ship crosses the main line and the time T3 when the ship crosses the secondary line, determine the time T0 when the ship hits the main line or the time T2 when the ship hits the secondary line:
[0126] ; .
[0127] S46, based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the heading of the ship, and the speed of the ship , Vessel length , Ship width Identify the ship measurement dataset.
[0128] S5. If the time when the ship hits the main line T0 and the time when the ship hits the slave line T2 can be obtained normally and one of the time when the ship crosses the main line T1 and the time when the ship crosses the slave line T3 can be obtained normally, then determine the ship measurement data set according to the time when the ship hits the main line T0 and the time when the ship hits the slave line T2;
[0129] Specifically, step S5 includes:
[0130] S51. Obtain annotated empty ship pictures and heavy ship pictures, input the annotated empty ship pictures and heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy loaded states of the ship, and input the empty and heavy loaded identification results. If the empty and heavy loaded identification results of the ship data frames exceeding a preset proportion are heavy loaded states, the empty and heavy loaded states of the ship are heavy loaded states, otherwise they are empty.
[0131] S52, determining the heading of the ship according to the order of the time when the ship hits the main line T0 and the time when the ship hits the secondary line T2. If the time when the ship hits the main line T0 is earlier than the time when the ship hits the secondary line T2, the heading is upward, otherwise it is downward.
[0132] S53, calculating the ship speed according to the time when the ship hits the main line T0 and the time when the ship hits the secondary line T2 :
[0133] ;
[0134] In the formula, Indicates the distance between the main line and the slave line, Indicates absolute value calculation.
[0135] S54, based on ship speed Determining the length of the vessel With ship width :
[0136] ;
[0137] ;
[0138] In the formula, is the preset aspect ratio.
[0139] S55, based on the time when the ship hits the main line T0 and the time when the ship hits the secondary line T2, determine the time when the ship crosses the main line T1 or the time when the ship crosses the secondary line T3:
[0140] ; .
[0141] S56, based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the heading of the ship, and the speed of the ship , Vessel length , Ship width Determine the ship measurement data set;
[0142] Specifically, the calculation process of step S5 is similar to the calculation process of step S4, so it will not be described in detail here.
[0143] S6. If the time when the ship hits the main line T0 and the time when the ship crosses the main line T1 can be obtained normally, then determine the ship measurement data set according to the time when the ship hits the main line T0 and the time when the ship crosses the main line T1;
[0144] Wherein, the step S6 comprises:
[0145] S61, obtaining annotated empty ship pictures and heavy ship pictures, inputting the annotated empty ship pictures and heavy ship pictures into a YOLOv5 model for training, inputting each of the ship data frames into the trained YOLOv5 model for ship empty and heavy state recognition, and inputting empty and heavy state recognition results, if the empty and heavy state recognition results of the ship data frames exceeding a preset ratio are heavy state, then the empty and heavy state of the ship is the heavy state, otherwise it is an empty state;
[0146] S62: Determine the ship speed based on the empty or loaded state of the ship , and based on the ship speed Determining the length of the vessel With ship width :
[0147] ;
[0148] ;
[0149] In the formula, For the preset aspect ratio, Indicates absolute value calculation;
[0150] Specifically, since it is impossible to obtain the time T2 when the ship hits the line and the time T3 when the ship passes through the line, the ship speed cannot be obtained. Therefore, a predicted value is used to replace the ship speed in this application, and the predicted value is determined according to the empty and loaded states of the ship. In the empty state, the ship speed is 2.5m / s, and in the heavily loaded state it is 1.5m / s.
[0151] S63, determining the outline rectangle of the ship in the ship data frame and determining the outline corner points of the outline rectangle; if the time required for the outline corner point away from the slave line to cross the main line is equal to the time T1 when the ship crosses the main line, the heading is upward; if the time required for the outline corner point away from the slave line to cross the main line is equal to the time T0 when the ship touches the main line, the heading is downward.
[0152] S64, based on the course of the ship, the time when the ship hits the main line T0, and the time when the ship crosses the main line T1, determine the time when the ship hits the secondary line T2, and the time when the ship crosses the secondary line T3:
[0153] If the heading is up, then:
[0154] ; ;
[0155] If the heading is down, then:
[0156] ; ;
[0157] In the formula, Indicates the distance between the main line and the slave line.
[0158] S65, based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the heading of the ship, and the speed of the ship , Vessel length , Ship width Identify the ship measurement dataset.
[0159] S7. If the time when the ship hits the slave line T2 and the time when the ship passes through the slave line T3 can be normally obtained, then determine the ship measurement data set according to the time when the ship hits the slave line T2 and the time when the ship passes through the slave line T3.
[0160] The step S7 comprises:
[0161] S71. Obtain labeled empty ship pictures and heavy ship pictures, input the labeled empty ship pictures and heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy loaded states of the ship, and input the empty and heavy loaded identification results. If more than a preset proportion of the empty and heavy loaded identification results of the ship data frames are heavy loaded states, the empty and heavy loaded states of the ship are heavy loaded states, otherwise they are empty states.
[0162] S72: Determine the ship speed based on the empty or loaded state of the ship , and based on the ship speed Determining the length of the vessel With ship width :
[0163] ;
[0164] ;
[0165] In the formula, For the preset aspect ratio, Indicates absolute value calculation.
[0166] S73. Determine the outline rectangle of the ship in the ship data frame and determine the outline corner points of the outline rectangle. If the time required for the outline corner point away from the main line to cross the slave line is equal to the time T2 when the ship hits the slave line, the heading is upward. If the time required for the outline corner point away from the main line to cross the slave line is not equal to the time T3 when the ship crosses the slave line, the heading is downward.
[0167] S74, based on the course of the ship, the time when the ship hits the secondary line T2, and the time when the ship crosses the secondary line T3, determine the time when the ship hits the main line T0, and based on the time when the ship crosses the main line T1:
[0168] If the heading is up, then:
[0169] ; ;
[0170] If the heading is down, then:
[0171] ; ;
[0172] In the formula, Indicates the distance between the main line and the slave line.
[0173] S75, based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the heading of the ship, and the speed of the ship , Vessel length , Ship width Identify the ship measurement dataset.
[0174] The ship measurement method based on video recognition provided in the first embodiment of the present invention sets two virtual analysis lines, and first determines the different positions of the ship corresponding to the two analysis lines in different video frames and at different time points according to the analysis of the video. When the ship leaves the video illumination area, the ship data is sorted, analyzed, and calculated. In response to different situations, different calculation methods are used to obtain data such as the length, width, and crossing time of the ship. Compared with other modes, the improvement made by the present invention makes the cost lower and is convenient for modification in an existing environment without the need to build a new environment.
[0175] Embodiment 2
[0176] like Figure 3 As shown, in the second embodiment of the present invention, a ship measurement system based on video recognition is provided, and the system includes:
[0177] A resolution line module 1 is used to set a camera above the ship and aim the camera at the channel of the ship, set a resolution line within the shooting range of the camera and set the resolution line perpendicular to the heading of the ship, and the resolution includes a main line and a secondary line;
[0178] Processing module 2, used for acquiring a ship navigation video through the camera device, performing frame splitting processing on the ship navigation video to obtain a plurality of continuous ship video frames, and performing object recognition based on the ship video frames to obtain a ship data frame;
[0179] A judgment module 3 is used to analyze the ship data frame and judge whether the ship encounters the main line time T0, the ship crosses the main line time T1, the ship encounters the secondary line time T2, and the ship crosses the secondary line time T3 can be obtained normally;
[0180] The first data set module 4 is used to determine the ship measurement data set according to the time T1 when the ship crosses the main line and the time T3 when the ship crosses the slave line if the time T1 when the ship crosses the main line and the time T3 when the ship crosses the slave line can be obtained normally and one of the time T0 when the ship hits the main line and the time T2 when the ship hits the slave line can be obtained normally;
[0181] The second data set module 5 is used to determine the ship measurement data set according to the time when the ship hits the main line T0 and the time when the ship hits the slave line T2 if the time when the ship hits the main line T0 and the time when the ship hits the slave line T2 can be normally obtained and one of the time when the ship crosses the main line T1 and the time when the ship crosses the slave line T3 can be normally obtained;
[0182] The third data set module 6 is used to determine the ship measurement data set according to the time T0 when the ship encounters the main line and the time T1 when the ship crosses the main line if the time T0 when the ship encounters the main line and the time T1 when the ship crosses the main line can be obtained normally;
[0183] The fourth data set module 7 is used to determine the ship measurement data set according to the ship encountering the slave line time T2 and the ship crossing the slave line time T3 if the ship encountering the slave line time T2 and the ship crossing the slave line time T3 can be normally obtained.
[0184] Wherein, the analysis line module 1 comprises:
[0185] A submodule is provided, for respectively providing a first main line point and a first sub-line point on the shore on either side of the waterway within the shooting range of the camera device;
[0186] A ray submodule, used to control the distance between the first main line point and the first slave line point to be within a preset range, and to irradiate the opposite bank with rays starting from the first main line point and the first slave line point, respectively, so as to obtain a second main line point and a second slave line point;
[0187] an adjusting submodule, used for adjusting the positions of the second main line point and the second secondary line point so that the connecting line between the first main line point and the second main line point and the connecting line between the first secondary line point and the second secondary line point are perpendicular to the heading of the ship;
[0188] The parsing line output submodule is used to use the adjusted connection line between the first main line point and the second main line point as the main line, and use the adjusted connection line between the first slave line point and the second slave line point as the main line.
[0189] The processing module 2 comprises:
[0190] A data set submodule, used to determine an old data set, and determine the last frame of data in the old data set;
[0191] A judgment submodule, used to judge whether the coverage area between the ship video frame and the last frame in the old data set is greater than a coverage threshold and whether the center point offset between the ship video frame and the last frame in the old data set is less than an offset threshold;
[0192] The data frame output submodule is used to merge the corresponding video frame with the old data set if the coverage area between the ship video frame and the last frame in the old data set is greater than the coverage threshold and the center point offset between the ship video frame and the last frame in the old data set is less than the offset threshold; if the coverage area between the ship video frame and the last frame in the old data set is not greater than the coverage threshold or the center point offset between the ship video frame and the last frame in the old data set is not less than the offset threshold, then use the corresponding ship video frame as the ship data frame.
[0193] The first data set module 4 includes:
[0194] The first recognition submodule is used to obtain the annotated empty ship pictures and the heavy ship pictures, input the annotated empty ship pictures and the heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state recognition results. If the empty and heavy state recognition results of the ship data frames exceeding a preset ratio are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is the empty state;
[0195] The first heading submodule is used to determine the heading of the ship according to the order of the time T1 when the ship crosses the main line and the time T3 when the ship crosses the secondary line. If the time T1 when the ship crosses the main line is earlier than the time T3 when the ship crosses the secondary line, the heading is upward, otherwise it is downward;
[0196] The first speed submodule is used to calculate the ship speed based on the time T1 when the ship passes through the main line and the time T3 when the ship passes through the secondary line. :
[0197] ;
[0198] In the formula, Indicates the distance between the main line and the slave line;
[0199] The first length and width calculation submodule is used to calculate the length and width of the ship based on the ship speed. Determining the length of the vessel With ship width :
[0200] ;
[0201] ;
[0202] In the formula, For the preset aspect ratio, Indicates absolute value calculation;
[0203] The first time calculation submodule is used to determine the time when the ship hits the main line T0 or the time when the ship hits the secondary line T2 based on the time when the ship crosses the main line T1 and the time when the ship crosses the secondary line T3:
[0204] ; ;
[0205] The first data set submodule is used to calculate the ship's empty and loaded state, ship's heading, and ship's speed based on the ship's encounter time T0, ship's crossing time T1, ship's encounter time T2, ship's crossing time T3, and ship's main line time T1, ship's main line time T2, ship's main line time T3, ... , Vessel length , Ship width Identify the ship measurement dataset.
[0206] The second data set module 5 comprises:
[0207] The second recognition submodule is used to obtain the annotated empty ship pictures and the heavy ship pictures, input the annotated empty ship pictures and the heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state recognition results. If the empty and heavy state recognition results of the ship data frames exceeding a preset ratio are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is the empty state;
[0208] The second heading submodule is used to determine the heading of the ship according to the order of the time T0 when the ship hits the main line and the time T2 when the ship hits the secondary line. If the time T0 when the ship hits the main line is earlier than the time T2 when the ship hits the secondary line, the heading is upward, otherwise it is downward;
[0209] The second speed submodule is used to calculate the ship speed based on the time when the ship hits the main line T0 and the time when the ship hits the slave line T2 :
[0210] ;
[0211] In the formula, Indicates the distance between the main line and the slave line, Indicates absolute value calculation;
[0212] The second length and width calculation submodule is used to calculate the length and width of the ship based on the ship speed. Determining the length of the vessel With ship width :
[0213] ;
[0214] ;
[0215] In the formula, is the preset aspect ratio;
[0216] The second time calculation submodule is used to determine the time T1 when the ship crosses the main line or the time T3 when the ship crosses the secondary line based on the time T0 when the ship encounters the main line and the time T2 when the ship encounters the secondary line:
[0217] ; ;
[0218] The second data set submodule is used to calculate the ship's empty and loaded state, ship's heading, and ship's speed based on the ship's encounter time T0, ship's crossing time T1, ship's encounter time T2, ship's crossing time T3, and ship's main line time T1, ship's main line time T2, ship's main line time T3, ... , Vessel length , Ship width Identify the ship measurement dataset.
[0219] The third data set module 6 comprises:
[0220] The third recognition submodule is used to obtain the annotated empty ship pictures and the heavy ship pictures, input the annotated empty ship pictures and the heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state recognition results. If the empty and heavy state recognition results of the ship data frames exceeding a preset ratio are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is the empty state;
[0221] The third length and width calculation submodule is used to determine the ship speed based on the empty and loaded state of the ship , and based on the ship speed Determining the length of the vessel With ship width :
[0222] ;
[0223] ;
[0224] In the formula, For the preset aspect ratio, Indicates absolute value calculation;
[0225] A third heading submodule is used to determine the outline rectangle of the ship in the ship data frame and determine the outline corner points of the outline rectangle. If the time required for the outline corner point away from the slave line to cross the main line is equal to the time T1 of the ship crossing the main line, the heading is upward; if the time required for the outline corner point away from the slave line to cross the main line is not equal to the time T0 of the ship hitting the main line, the heading is downward;
[0226] The third time calculation submodule is used to determine the time when the ship hits the secondary line T2 and the time when the ship crosses the secondary line T3 based on the heading of the ship and the time when the ship hits the main line T0 and the time when the ship crosses the main line T1:
[0227] If the heading is up, then:
[0228] ; ;
[0229] If the heading is down, then:
[0230] ; ;
[0231] In the formula, Indicates the distance between the main line and the slave line;
[0232] The third data set submodule is used to calculate the ship's empty and loaded state, the ship's heading, and the ship's speed based on the ship's encounter time T0, the ship's crossing time T1, the ship's encounter time T2, the ship's crossing time T3, the ship's empty and loaded state, the ship's heading, and the ship's speed. , Vessel length , Ship width Identify the ship measurement dataset.
[0233] The fourth data set module 7 steps include:
[0234] The fourth recognition submodule is used to obtain the annotated empty ship pictures and the heavy ship pictures, input the annotated empty ship pictures and the heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state recognition results. If the empty and heavy state recognition results of the ship data frames exceeding a preset ratio are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is the empty state;
[0235] The fourth length and width calculation submodule is used to determine the ship speed based on the empty and loaded state of the ship , and based on the ship speed Determining the length of the vessel With ship width :
[0236] ;
[0237] ;
[0238] In the formula, For the preset aspect ratio, Indicates absolute value calculation;
[0239] A fourth heading submodule is used to determine the outline rectangle of the ship in the ship data frame and determine the outline corner points of the outline rectangle. If the time required for the outline corner point away from the main line to cross the slave line is equal to the time T2 when the ship hits the slave line, the heading is upward; if the time required for the outline corner point away from the main line to cross the slave line is not equal to the time T3 when the ship crosses the slave line, the heading is downward;
[0240] The fourth time calculation submodule is used to determine the time when the ship encounters the main line T0 based on the heading of the ship, the time when the ship encounters the secondary line T2, and the time when the ship crosses the secondary line T3, and the time when the ship crosses the main line T1:
[0241] If the heading is up, then:
[0242] ; ;
[0243] If the heading is down, then:
[0244] ; ;
[0245] In the formula, Indicates the distance between the main line and the slave line;
[0246] The fourth data set submodule is used to calculate the ship's empty and loaded state, the ship's heading, and the ship's speed based on the ship's encounter time T0, the ship's crossing time T1, the ship's encounter time T2, the ship's crossing time T3, the ship's empty and loaded state, the ship's heading, and the ship's speed. , Vessel length , Ship width Identify the ship measurement dataset.
[0247] In some other embodiments of the present invention, the embodiments of the present invention provide the following technical solutions: a computer, comprising a memory 102, a processor 101, and a computer program stored in the memory 102 and executable on the processor 101, wherein the processor 101 implements the ship measurement method based on video recognition as described above when executing the computer program.
[0248] Specifically, the processor 101 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiment of the present invention.
[0249] Among them, the memory 102 may include a large-capacity memory for data or instructions. By way of example and not limitation, the memory 102 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 102 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 102 may be inside or outside the data processing device. In a specific embodiment, the memory 102 is a non-volatile memory. In a specific embodiment, the memory 102 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM) or a flash memory (FLASH), or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0250] The memory 102 may be used to store or cache various data files that need to be processed and / or used for communication, as well as possible computer program instructions executed by the processor 101 .
[0251] The processor 101 implements the above-mentioned ship measurement method based on video recognition by reading and executing the computer program instructions stored in the memory 102.
[0252] In some embodiments, the computer may further include a communication interface 103 and a bus 100. Figure 4 As shown, the processor 101, the memory 102, and the communication interface 103 are connected via a bus 100 and communicate with each other.
[0253] The communication interface 103 is used to implement communication between the modules, devices, units and / or equipment in the embodiment of the present invention. The communication interface 103 can also implement data communication with other components such as: external devices, image / data acquisition equipment, databases, external storage, and image / data processing workstations.
[0254] The bus 100 includes hardware, software or both, and couples the components of the computer device to each other. The bus 100 includes but is not limited to at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 100 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, bus 100 may include one or more buses. Although embodiments of the present invention describe and illustrate a particular bus, the present invention contemplates any suitable bus or interconnect.
[0255] The computer can execute the ship measurement method based on video recognition of the present invention based on the acquisition of the ship measurement system based on video recognition, thereby realizing the ship measurement method based on video recognition.
[0256] In some further embodiments of the present invention, in combination with the above-mentioned ship measurement method based on video recognition, the embodiments of the present invention provide the following technical solutions: a storage medium having a computer program stored thereon, and the computer program implements the above-mentioned ship measurement method based on video recognition when executed by a processor.
[0257] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0258] More specific examples of readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0259] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0260] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0261] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A ship measurement method based on video recognition, characterized in that: include: A camera is arranged above the ship and is aimed at the channel of the ship. A resolution line is arranged within the shooting range of the camera and is arranged perpendicular to the heading of the ship, wherein the resolution line includes a main line and a secondary line. Acquire a ship navigation video through the camera device, perform frame splitting processing on the ship navigation video to obtain a plurality of continuous ship video frames, and perform object recognition based on the ship video frames to obtain a ship data frame; Perform data analysis on the ship data frame and determine whether the ship encounters the main line time T0, the ship crosses the main line time T1, the ship encounters the slave line time T2, and the ship crosses the slave line time T3 can be obtained normally; If the time when the ship crosses the main line T1 and the time when the ship crosses the slave line T3 can be obtained normally and one of the time when the ship touches the main line T0 and the time when the ship touches the slave line T2 can be obtained normally, the ship measurement data set is determined according to the time when the ship crosses the main line T1 and the time when the ship crosses the slave line T3; If the ship encounters the main line time T0 and the ship encounters the slave line time T2 can be obtained normally, and one of the ship crossing the main line time T1 and the ship crossing the slave line time T3 can be obtained normally, then the ship measurement data set is determined according to the ship encounters the main line time T0 and the ship encounters the slave line time T2; If the time when the ship hits the main line T0 and the time when the ship crosses the main line T1 can be obtained normally, the ship measurement data set is determined according to the time when the ship hits the main line T0 and the time when the ship crosses the main line T1; If the time when the ship hits the slave line T2 and the time when the ship passes through the slave line T3 can be obtained normally, the ship measurement data set is determined according to the time when the ship hits the slave line T2 and the time when the ship passes through the slave line T3; The step of determining the ship measurement data set according to the time T0 when the ship hits the main line and the time T1 when the ship crosses the main line comprises: Obtain annotated empty ship pictures and heavy ship pictures, input the annotated empty ship pictures and heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state identification results. If the empty and heavy state identification results of the ship data frames exceeding a preset proportion are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is an empty state; Determine the ship's speed based on the ship's empty and loaded state , and based on the ship speed Determining the length of the vessel With ship width : ; ; In the formula, For the preset aspect ratio, Indicates absolute value calculation; Determine the outline rectangle of the ship in the ship data frame and determine the outline corner points of the outline rectangle, if the time required for the outline corner point away from the slave line to cross the main line is equal to the time T1 when the ship crosses the main line, then the heading is upward, if the time required for the outline corner point away from the slave line to cross the main line is not equal to the time T0 when the ship touches the main line, then the heading is downward; Based on the course of the ship and the time T0 when the ship hits the main line and the time T1 when the ship crosses the main line, the time T2 when the ship hits the secondary line and the time T3 when the ship crosses the secondary line are determined: If the heading is up, then: ; ; If the heading is down, then: ; ; In the formula, Indicates the distance between the main line and the slave line; Based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the ship's heading, and the ship's speed , Vessel length , Ship width Determine the ship measurement dataset; The step of determining the ship measurement data set according to the time T2 when the ship hits the slave line and the time T3 when the ship passes through the slave line comprises: Obtain annotated empty ship pictures and heavy ship pictures, input the annotated empty ship pictures and heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state identification results. If the empty and heavy state identification results of the ship data frames exceeding a preset proportion are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is an empty state; Determine the ship's speed based on the ship's empty and loaded state , and based on the ship speed Determining the length of the vessel With ship width : ; ; In the formula, For the preset aspect ratio, Indicates absolute value calculation; Determine the outline rectangle of the ship in the ship data frame and determine the outline corner points of the outline rectangle, if the time required for the outline corner point away from the main line to cross the secondary line is equal to the time T2 when the ship hits the secondary line, then the heading is upward, if the time required for the outline corner point away from the main line to cross the secondary line is not equal to the time T3 when the ship crosses the secondary line, then the heading is downward; Based on the course of the ship and the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the time when the ship hits the main line T0 is determined, and based on the time when the ship crosses the main line T1: If the heading is up, then: ; ; If the heading is down, then: ; ; In the formula, Indicates the distance between the main line and the slave line; Based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the ship's heading, and the ship's speed , Vessel length , Ship width Identify the ship measurement dataset.
2. The ship measurement method based on video recognition according to claim 1, characterized in that: The step of performing object recognition based on the ship video frame to obtain a plurality of groups of ship data frames comprises: A first main line point and a first sub-line point are respectively set on the shore on either side of the waterway within the shooting range of the camera device; Controlling the distance between the first main line point and the first sub-line point to be within a preset range, and irradiating the opposite bank with rays from the first main line point and the first sub-line point as starting points, so as to obtain a second main line point and a second sub-line point; Adjusting the positions of the second main line point and the second secondary line point so that the line between the first main line point and the second main line point and the line between the first secondary line point and the second secondary line point are both perpendicular to the heading of the ship; The adjusted connection line between the first main line point and the second main line point is used as the main line, and the adjusted connection line between the first slave line point and the second slave line point is used as the main line.
3. The ship measurement method based on video recognition according to claim 1, characterized in that: The step of performing object recognition based on the ship video frame to obtain a plurality of groups of ship data frames comprises: Determine an old data set, and determine the last frame of data in the old data set; Determine whether the coverage area between the ship video frame and the last frame in the old data set is greater than a coverage threshold and determine whether the center point offset between the ship video frame and the last frame in the old data set is less than an offset threshold; If the coverage area of the ship video frame and the last frame in the old data set is greater than the coverage threshold and the center point offset of the ship video frame and the last frame in the old data set is less than the offset threshold, the corresponding video frame is merged with the old data set; if the coverage area of the ship video frame and the last frame in the old data set is not greater than the coverage threshold or the center point offset of the ship video frame and the last frame in the old data set is not less than the offset threshold, the corresponding ship video frame is used as the ship data frame.
4. The ship measurement method based on video recognition according to claim 1, characterized in that: The step of determining the ship measurement data set according to the time T1 when the ship passes through the main line and the time T3 when the ship passes through the secondary line comprises: Obtain annotated empty ship pictures and heavy ship pictures, input the annotated empty ship pictures and heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state identification results. If the empty and heavy state identification results of the ship data frames exceeding a preset proportion are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is an empty state; The heading of the ship is determined according to the order of the time T1 when the ship crosses the main line and the time T3 when the ship crosses the secondary line. If the time T1 when the ship crosses the main line is earlier than the time T3 when the ship crosses the secondary line, the heading is upward, otherwise it is downward; Calculate the ship speed based on the time it takes for the ship to cross the main line T1 and the time it takes for the ship to cross the secondary line T3 : ; In the formula, Indicates the distance between the main line and the slave line; Based on ship speed Determining the length of the vessel With ship width : ; ; In the formula, For the preset aspect ratio, Indicates absolute value calculation; Based on the time when the ship crosses the main line T1 and the time when the ship crosses the secondary line T3, determine the time when the ship hits the main line T0 or the time when the ship hits the secondary line T2: ; ; Based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the ship's heading, and the ship's speed , Vessel length , Ship width Identify the ship measurement dataset.
5. The ship measurement method based on video recognition according to claim 1, characterized in that: The step of determining the ship measurement data set according to the time T0 when the ship hits the main line and the time T2 when the ship hits the slave line comprises: Obtain annotated empty ship pictures and heavy ship pictures, input the annotated empty ship pictures and heavy ship pictures into the YOLOv5 model for training, input each of the ship data frames into the trained YOLOv5 model to identify the empty and heavy states of the ship, and input the empty and heavy state identification results. If the empty and heavy state identification results of the ship data frames exceeding a preset proportion are heavy states, the empty and heavy state of the ship is the heavy state, otherwise it is an empty state; The heading of the ship is determined according to the order of the time when the ship hits the main line T0 and the time when the ship hits the secondary line T2. If the time when the ship hits the main line T0 is earlier than the time when the ship hits the secondary line T2, the heading is upward, otherwise it is downward; Calculate the ship speed based on the time when the ship hits the main line T0 and the time when the ship hits the secondary line T2 : ; In the formula, Indicates the distance between the main line and the slave line, Indicates absolute value calculation; Based on ship speed Determining the length of the vessel With ship width : ; ; In the formula, is the preset aspect ratio; Based on the time when the ship hits the main line T0 and the time when the ship hits the secondary line T2, determine the time when the ship crosses the main line T1 or the time when the ship crosses the secondary line T3: ; ; Based on the time when the ship hits the main line T0, the time when the ship crosses the main line T1, the time when the ship hits the secondary line T2, the time when the ship crosses the secondary line T3, the empty and loaded state of the ship, the ship's heading, and the ship's speed , Vessel length , Ship width Identify the ship measurement dataset.
6. A ship measurement system based on video recognition, the system adopts the ship measurement method based on video recognition as claimed in claim 1, characterized in that: The system comprises: A resolution line module, used to set a camera above the ship and aim the camera at the channel of the ship, set a resolution line within the shooting range of the camera and set the resolution line perpendicular to the heading of the ship, the resolution includes a main line and a secondary line; A processing module, used for acquiring a ship navigation video through the camera device, performing frame splitting processing on the ship navigation video to obtain a plurality of continuous ship video frames, and performing object recognition based on the ship video frames to obtain a ship data frame; A judgment module, used for analyzing the ship data frame and judging whether the ship encounters the main line time T0, the ship crosses the main line time T1, the ship encounters the slave line time T2, and the ship crosses the slave line time T3 can be obtained normally; The first data set module is used to determine the ship measurement data set according to the time T1 when the ship crosses the main line and the time T3 when the ship crosses the slave line if the time T1 when the ship crosses the main line and the time T3 when the ship crosses the slave line can be normally obtained and one of the time T0 when the ship hits the main line and the time T2 when the ship hits the slave line can be normally obtained; The second data set module is used to determine the ship measurement data set according to the time when the ship hits the main line T0 and the time when the ship hits the slave line T2 if the time when the ship hits the main line T0 and the time when the ship hits the slave line T2 can be normally obtained and one of the time when the ship crosses the main line T1 and the time when the ship crosses the slave line T3 can be normally obtained; The third data set module is used to determine the ship measurement data set according to the time T0 when the ship encounters the main line and the time T1 when the ship crosses the main line if the time T0 when the ship encounters the main line and the time T1 when the ship crosses the main line can be obtained normally; The fourth data set module is used to determine the ship measurement data set according to the ship encountering the slave line time T2 and the ship passing through the slave line time T3 if the ship encountering the slave line time T2 and the ship passing through the slave line time T3 can be obtained normally.
7. A computer comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the ship measurement method based on video recognition as described in any one of claims 1 to 5 is implemented.
8. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the ship measurement method based on video recognition as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Distributed ship height detection system based on multi-view stereoscopic vision
CN115083211A
Ship measurement method and system based on combination of laser scanning and radar scanning
CN117470107A