Underwater robot end side lightweight model compression method and system

Through multi-type sensor data fusion and dynamic correlation matrix analysis, combined with layered compression technology, the accuracy and resource waste problems of underwater robot models in complex environments are solved, and efficient adaptability and stability compression are achieved.

CN120633725AInactive Publication Date: 2025-09-12CHANGZHOU ZHIGAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510824281.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2025-09-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing underwater robot model compression schemes ignore the real-time correlation between parameters, resulting in a sharp drop in model reasoning accuracy and waste of computing resources in complex environments, affecting operational efficiency and accuracy.

Method used

Data is collected synchronously by multiple types of sensors, and a dynamic correlation matrix is ​​constructed using the mutual information algorithm and attention factor. Combined with global correlation and sensitivity analysis, low-rank decomposition and channel pruning methods are used for hierarchical compression, and the compression scheme is adjusted in real time to adapt to changes in the underwater environment.

Benefits of technology

It achieves efficient adaptive compression of the model in complex underwater environments, balances model accuracy and computing resources, and enhances the stability and robustness of the underwater robot on the terminal side.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120633725A_ABST
    Figure CN120633725A_ABST
Patent Text Reader

Abstract

The invention discloses an underwater robot end side lightweight model compression method and system, and relates to the technical field of model compression methods. According to the method, underwater data are synchronously collected through multiple types of sensors, data classification is performed after preprocessing, a dynamic incidence matrix is constructed by using a mutual information algorithm and an attention factor, the global correlation degree of the data is calculated, and the sensitivity degree of a model layer to the data is quantified; a layered compression scheme of low-rank decomposition or channel pruning is adopted for the model layers with different sensitivity degrees; and dynamically adjusting the compression ratio through a feedback error function. The system comprises a data acquisition and preprocessing module, a data association dynamic analysis module, a compression scheme generation module and a model compression and feedback optimization module. According to the scheme, the problems of sudden precision drop and resource waste caused by neglecting of data real-time association in a traditional static model compression scheme are solved, compression of the underwater robot end side lightweight model with limited computing power is realized, and reasoning instantaneity and stability in a complex underwater environment are guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of model compression methods, and in particular to a method and system for compressing lightweight models on the end side of an underwater robot. Background Art

[0002] In today's era of rapid technological development, the importance of ocean exploration and development is becoming increasingly prominent. Underwater robots, as key equipment in the ocean field, are ushering in a golden period of vigorous development.

[0003] With the continuous integration of advanced technologies such as sensor technology, artificial intelligence, and big data processing, the autonomous navigation, target recognition, and data processing capabilities of underwater robots have been significantly improved. However, the underwater environment is extremely complex. Traditional model compression schemes often only compress model structures or static data, ignoring the impact of real-time correlations between parameters on model reasoning. This ultimately leads to a sharp drop in model reasoning accuracy or waste of computing resources, seriously restricting the efficiency and accuracy of underwater robots in complex environments. Summary of the Invention

[0004] The purpose of the present invention is to provide a method and system for compressing a lightweight model of an underwater robot end side, so as to solve the problems raised in the prior art.

[0005] To achieve the above object, the present invention provides the following technical solutions: Step S1: Acquire underwater data by equipping an underwater robot with multiple types of sensors; and pre-process the acquired underwater data; Furthermore, step S1 further includes: Step S1-1, the multiple types of sensors include a sonar sensor, a visual sensor, a temperature sensor, a pressure sensor, an ocean current velocity sensor, and an inertial sensor; the multiple types of sensors are used to synchronously acquire underwater data according to the same sampling interval T; the sonar sensor is used to acquire the sonar distance of the underwater environment; the visual sensor is used to collect the visual coordinates of the image; the temperature sensor is used to measure the ambient temperature value; the pressure sensor is used to acquire the underwater pressure value; the ocean current velocity sensor is used to detect the speed of the ocean current; and the inertial sensor is used to acquire the attitude angle data of the underwater robot; Step S1-2: Generate a data sequence V(t) = [V1(t), V2(t), ..., V containing a timestamp t based on the acquired underwater data. n (t)], where n represents the number of underwater data types, t represents the timestamp, V(t) represents the data value of the underwater data at timestamp t, and the update frequency of the timestamp is the same as the sensor sampling interval T; Step S1-3: pre-process the underwater data using the minimum-maximum normalization method to obtain normalized underwater data and establish a normalized underwater data set. ={ , ,..., }, where n represents the number of underwater data types, t represents the timestamp, Represents the normalized data value of the underwater data at timestamp t; the normalization method is: ; in represents the normalized data value of the ith underwater data at timestamp t, V i (t) The data value of the ith underwater data at timestamp t before normalization, max(V i ) represents the maximum value of the ith underwater data at timestamp t before normalization, min(V i ) represents the minimum value of the i-th underwater data before normalization at timestamp t, i∈{1, 2, ..., n}.

[0006] Step S2: classify the underwater data according to data type and set the length of the data association time window; calculate the association strength between the underwater data and construct a data association dynamic graph, and generate a dynamic association matrix based on the data association dynamic graph; Furthermore, step S2 further includes: Step S2-1, the data types include spatial data, physical data, and motion data; the underwater data is classified according to the data types: the spatial data includes sonar distance and visual coordinates, the physical data includes ambient temperature and underwater pressure, and the motion data includes ocean current speed and attitude angle data of the underwater robot; Step S2-2, set the data association time window length D, for the i-th underwater data and the j-th underwater data in the normalized underwater data set, use the mutual information algorithm to calculate the mutual information value MI between the two underwater data within the time window [t-D+1,t] ij (t): ; where X i and Y j They are the normalized underwater datasets The value set of the normalized i-th underwater data and the normalized j-th underwater data when t is within the time window, i≠j, i and j belong to {1, 2, ..., n}; p(x, y) is the joint probability density of the normalized i-th underwater data taking the value x and the normalized j-th underwater data taking the value y, p(x) and p(y) are the marginal probability densities of the normalized i-th underwater data taking the value x and the normalized j-th underwater data taking the value y, respectively. MI represents the mutual information value, and t represents the timestamp; Set the mutual information threshold τ, when τ≤MI ij At (t), it is determined that there is a correlation between underwater data i and underwater data j; Step S2-3: Set the time attention factor to reflect the importance of the correlation between the current timestamp t and the historical timestamps: ; in represents the time attention factor, λ is the decay coefficient, t represents the current timestamp, and t` represents the historical timestamps adjacent to the current timestamp; Step S2-4: Determine whether the i-th underwater data and the j-th underwater data belong to the same data type, and set the data type attention factor of the same data type to , set the data type attention factor of different data types to , < ; Multiply the data type attention factor, time attention factor and mutual information value to obtain the correlation strength w between underwater data ij (t): ; where w` ij (t) represents the correlation strength value between the i-th underwater data and the j-th underwater data at timestamp t, represents the temporal attention factor, Represents the data type attention factor of the i-th underwater data for the j-th underwater data. When the i-th underwater data and the j-th underwater data are the same, = ; When the i-th underwater data and the j-th underwater data are different, = MI ij (t) represents the mutual information value between the i-th underwater data and the j-th underwater data at timestamp t; Step 2-5: Create an underwater data set v = {v1, v2, ..., v n}, where v1 represents the first type of underwater data, v2 represents the second type of underwater data, and v nRepresents n types of underwater data; establish underwater data association set e={e ij |i,j∈{1,2,...,n}}, where e ij Represents underwater data v i Underwater data v j One-way association relationship, when underwater data i and underwater data j are associated and data v i For data v j When there is a causal relationship, e ij The value is 1, otherwise it is 0; establish the association strength set w={w ij (t)|i,j∈{1,2,...,n}}, when e ij When the value is 1 and i≠j, w ij (t) = w` ij (t), when e ij When the value is 0 or i=j, w ij (t) = 0; with underwater data as nodes and underwater data associations as edges, a directed weighted graph G = (v, e, w) is established according to the underwater data set, the underwater data association set, and the association strength set; Step 2-6: According to the w in the association strength set w ij (t) generates an n×n dynamic incidence matrix w(t), and updates the dynamic incidence matrix when the timestamp t changes.

[0007] Step S3: calculating the global correlation of the underwater data according to the dynamic correlation matrix, wherein the global correlation is used to obtain the sensitivity of the underwater data to the model layer of the compression model; setting a sensitivity threshold to generate a layered compression scheme for the model layer; Furthermore, step S3 further includes: Step S3-1: Set the quantization target set for model compression, which includes the parameter compression rate R p , calculation amount compression ratio R f and the inference latency target D target : ; where R p Represents the parameter compression ratio, N before Represents the number of parameters of the model to be compressed, N after Represents the number of parameters of the compressed model, 0 <R p <1; ; where R f Represents the computational compression ratio, F after Represents the number of floating-point operations of the compressed model, F beforeRepresents the number of floating-point operations of the model to be compressed, 0 <R f <1; Inference latency target D target The maximum inference time allowed by the client device is determined based on the computing power of the underwater robot processor and the real-time requirements of the task. Step S3-2: Number the model layers of the model to be compressed in the order of processing. =1, 2, ..., L, where L is the total number of layers; Step S3-3: In the training phase of the model to be compressed, for the i-th underwater data, fix the other types of data, apply disturbance to the i-th underwater data, and calculate the value of the i-th underwater data according to the data before and after the disturbance. The absolute value of the ratio of the output change of the layer to the original output and the absolute value of the ratio of the perturbation amplitude to the original value are quantified. The response intensity a of the layer to the i-th underwater data li : ; where a li Represents the model to be compressed The response intensity of the layer to the i-th underwater data, ΔO l Representative The output change of the layer, O l Representative The original output of the layer, Δv` i represents the disturbance amplitude, v` i Represents the original value of the i-th underwater data; Step S3-4: Calculate the global correlation degree of each underwater data according to the dynamic correlation matrix w(t): ; Among them G i (t) represents the global correlation of the i-th underwater data, n represents the number of underwater data types, |w ij (t)| is the w in the dynamic incidence matrix w(t) ij The absolute value of (t); Step S3-5: Calculate the sensitivity of the model layer of the to-be-compressed model to the underwater data based on the global correlation and the response strength:

[0008] Among them S l (t) represents the first The sensitivity of the layer to underwater data, a li Represents the model to be compressed The response intensity of the layer to the i-th underwater data, G i (t) represents the global correlation of the i-th underwater data, and t represents the timestamp; Step S3-6: Set a sensitivity threshold, and adopt a low-rank decomposition compression method for the model layer of the model to be compressed whose sensitivity is greater than the sensitivity threshold; adopt a channel pruning compression method for the model layer of the model to be compressed whose sensitivity is less than or equal to the sensitivity threshold; and assign a compression rate to the model layer of the model to be compressed:

[0009] where r l (t) represents the first Layer compression ratio, R p Represents the parameter compression ratio, S l (t) represents the first The sensitivity of the layer to underwater data, L is the total number of layers, max represents the maximum value, and t is the timestamp.

[0010] Step S4: hierarchically compress the model layers of the model to be compressed according to the hierarchical compression scheme to obtain a compressed model; deploy the compressed model and collect the real-time performance of the compressed model, and perform feedback adjustment on the hierarchical compression scheme according to the real-time performance.

[0011] Furthermore, step S4 further includes: Step S4-1: for the model layer of the model to be compressed Layer, get its parameter matrix W l ∈R M×H , where M represents the input dimension of the layer, H represents the output dimension of the layer, and R represents the matrix space consisting of M×H real numbers; Step S4-2: For the model layer using the compression method of low-rank decomposition , W l Decomposed into two low-rank matrices W l `=Z l ×C l , where W l `Representing the The new parameter matrix of the layer, Z l ∈R M×K , C l ∈R K×H , K=[(1-r l )×(M×H)÷(M+H)], r l Representative Layer compression ratio, Z l and C l Represents two low-rank matrices, K is C l The rows and Z of the matrix l Columns of a matrix; For the model layer using the compression method of channel pruning , sort the channels by score, and delete A×r l channels, where A represents the model layer The number of channels before deletion, r l Representative The compression ratio of the layer; Step S4-3: perform layered compression on the model to be compressed to obtain a compressed model; deploy the compressed model, and measure the performance deviation of the layered compression scheme based on the feedback error: ; Where E(t) represents the feedback error, ACC0 represents the inference accuracy of the model to be compressed, ACC(t) represents the inference accuracy of the compressed model, and D target represents the maximum inference time allowed by the end device, D(t) represents the inference delay of the compressed model at timestamp t, FLOPs0 represents the floating-point calculation amount of the model to be compressed, FLOPs(t) represents the floating-point calculation amount of the compressed model at timestamp t, and R f Represents the computational compression ratio; Step S4-4: Adjust the compression rate using the gradient descent method according to the feedback error: ; where r l (t+1) represents the adjusted Layer compression ratio, r l Representative The original compression rate of the layer, η is the preset learning rate, and E(t) represents the feedback error.

[0012] A lightweight model compression system for an underwater robot end side, comprising a data acquisition and preprocessing module, a data association dynamic analysis module, a compression scheme generation module, and a model compression and feedback optimization module; the data acquisition and preprocessing module is used to acquire and preprocess underwater data and attitude angle data; the data association dynamic analysis module is used to calculate data association strength and construct a data association dynamic graph, and generate a dynamic association matrix based on the data association dynamic graph; the compression scheme generation module is used to formulate a targeted hierarchical compression scheme based on data association characteristics and model layer sensitivity; the model compression and feedback optimization module is used to perform compression operations and dynamically adjust the compression scheme through real-time performance feedback; The output end of the data acquisition and preprocessing module is electrically connected to the input end of the data association dynamic analysis module; the output end of the data association dynamic analysis module is electrically connected to the input end of the compression scheme generation module; the output end of the compression scheme generation module is electrically connected to the input end of the model compression and feedback optimization module.

[0013] The data acquisition and preprocessing module also includes a data acquisition unit and a data preprocessing unit; the data acquisition unit is used to control multiple types of sensors to synchronously acquire underwater data at the same sampling interval; the data preprocessing unit is used to generate a sequence with a timestamp from the acquired underwater data, and normalize the underwater data to obtain a normalized underwater data set.

[0014] The data association dynamic analysis module also includes an association strength calculation unit and a dynamic matrix generation unit; the association strength calculation unit is used to establish a data type set, set the time window length, calculate the association strength between data through the data type attention factor, mutual information algorithm and time attention factor, and judge the data association; the dynamic matrix generation unit is used to establish a directed weighted graph and generate a dynamic association matrix updated with the timestamp according to the association strength.

[0015] The compression scheme generation module also includes a sensitivity calculation unit and a scheme formulation unit; the sensitivity calculation unit is used to obtain the sensitivity of the model layer of the model to be compressed to the underwater data by quantifying the response strength of the model layer through perturbation, and calculating the global correlation of the data in combination with the dynamic correlation matrix; the scheme formulation unit is used to assign a compression method to the model layer of the model to be compressed according to the sensitivity threshold, and determine the compression rate.

[0016] The model compression and feedback optimization module also includes a hierarchical compression execution unit and a feedback optimization unit; the hierarchical compression execution unit is used to implement corresponding compression methods on different model layers according to the hierarchical compression scheme; the feedback optimization unit is used to design a feedback error function and adjust the compression rate according to the feedback error through the gradient descent method.

[0017] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention achieves efficient underwater data processing and feature correlation modeling through multi-type sensor fusion and dynamic correlation analysis. By synchronously collecting data from multiple sensors and combining mutual information algorithms with attention factors to construct a dynamic correlation matrix, this method accurately captures the real-time correlation characteristics between spatial, physical, and motion data in underwater environments. This provides more targeted data support for model compression, avoids model information loss due to insufficient data correlation analysis, and improves the adaptability of on-device models to complex underwater environments.

[0018] 2. This invention constructs a hierarchical adaptive compression scheme through quantitative analysis of global correlation and model layer sensitivity. The global correlation of data is calculated based on a dynamic correlation matrix, and the response strength of the model layer to different data is quantified in combination with perturbation experiments. Low-rank decomposition or channel pruning methods are used to differentiate the model layer based on sensitivity thresholds. While ensuring model accuracy, this scheme achieves targeted compression of parameters and computational complexity, effectively balancing the limited computing power of underwater robot-side equipment with the need for real-time model reasoning.

[0019] 3. This invention achieves dynamic optimization of the compression scheme through real-time performance feedback and a gradient descent adjustment mechanism. After the compression model is deployed, the feedback error comprehensively measures the deviation in inference accuracy, latency, and computational compression ratio. Gradient descent is then used to dynamically adjust the compression ratio of each layer, ensuring that the model maintains optimal performance despite changes in the underwater environment. This avoids the performance degradation of static compression schemes caused by environmental fluctuations and enhances the stability and robustness of the model on-device deployment. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is a flow chart of a method for compressing a lightweight model of an underwater robot end side according to the present invention; Figure 2 This is a structural schematic diagram of a lightweight model compression system for an underwater robot end side of the present invention. DETAILED DESCRIPTION

[0021] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0022] Example 1: Figure 1 As shown, the present invention provides a technical solution, a method for compressing a lightweight model of an underwater robot end side, and the lightweight model compression method includes the following steps: Step S1: Acquire underwater data by equipping an underwater robot with multiple types of sensors; and pre-process the acquired underwater data; Furthermore, step S1 further includes: Step S1-1, the multiple types of sensors include a sonar sensor, a visual sensor, a temperature sensor, a pressure sensor, an ocean current velocity sensor, and an inertial sensor; the multiple types of sensors are used to synchronously acquire underwater data according to the same sampling interval T; the sonar sensor is used to acquire the sonar distance of the underwater environment; the visual sensor is used to collect the visual coordinates of the image; the temperature sensor is used to measure the ambient temperature value; the pressure sensor is used to acquire the underwater pressure value; the ocean current velocity sensor is used to detect the speed of the ocean current; and the inertial sensor is used to acquire the attitude angle data of the underwater robot; Step S1-2: Generate a data sequence V(t) = [V1(t), V2(t), ..., V containing a timestamp t based on the acquired underwater data. n (t)], where n represents the number of underwater data types, t represents the timestamp, V(t) represents the data value of the underwater data at timestamp t, and the update frequency of the timestamp is the same as the sensor sampling interval T; Step S1-3: pre-process the underwater data using the minimum-maximum normalization method to obtain normalized underwater data and establish a normalized underwater data set. ={ , ,..., }, where n represents the number of underwater data types, t represents the timestamp, Represents the normalized data value of the underwater data at timestamp t; the normalization method is: ; in represents the normalized data value of the ith underwater data at timestamp t, V i (t) The data value of the ith underwater data at timestamp t before normalization, max(V i ) represents the maximum value of the ith underwater data at timestamp t before normalization, min(V i ) represents the minimum value of the i-th underwater data before normalization at timestamp t, i∈{1, 2, ..., n}.

[0023] Step S2: classify the underwater data according to data type and set the length of the data association time window; calculate the association strength between the underwater data and construct a data association dynamic graph, and generate a dynamic association matrix based on the data association dynamic graph; Furthermore, step S2 further includes: Step S2-1, the data types include spatial data, physical data, and motion data; the underwater data is classified according to the data types: the spatial data includes sonar distance and visual coordinates, the physical data includes ambient temperature and underwater pressure, and the motion data includes ocean current speed and attitude angle data of the underwater robot; Step S2-2, set the data association time window length D, for the i-th underwater data and the j-th underwater data in the normalized underwater data set, use the mutual information algorithm to calculate the mutual information value MI between the two underwater data within the time window [t-D+1,t] ij (t): ; where X i and Y j They are the normalized underwater datasets The value set of the normalized i-th underwater data and the normalized j-th underwater data when t is within the time window, i≠j, i and j belong to {1, 2, ..., n}; p(x, y) is the joint probability density of the normalized i-th underwater data taking the value x and the normalized j-th underwater data taking the value y, p(x) and p(y) are the marginal probability densities of the normalized i-th underwater data taking the value x and the normalized j-th underwater data taking the value y, respectively. MI represents the mutual information value, and t represents the timestamp; Set the mutual information threshold τ, when τ≤MI ij At (t), it is determined that there is a correlation between underwater data i and underwater data j; Step S2-3: Set the time attention factor to reflect the importance of the correlation between the current timestamp t and the historical timestamps: ; in represents the time attention factor, λ is the decay coefficient, t represents the current timestamp, and t` represents the historical timestamps adjacent to the current timestamp; Step S2-4: Determine whether the i-th underwater data and the j-th underwater data belong to the same data type, and set the data type attention factor of the same data type to , set the data type attention factor of different data types to , < ; Multiply the data type attention factor, time attention factor and mutual information value to obtain the correlation strength w between underwater data ij (t): ; where w` ij(t) represents the correlation strength value between the i-th underwater data and the j-th underwater data at timestamp t, represents the temporal attention factor, Represents the data type attention factor of the i-th underwater data for the j-th underwater data. When the i-th underwater data and the j-th underwater data are the same, = ; When the i-th underwater data and the j-th underwater data are different, = MI ij (t) represents the mutual information value between the i-th underwater data and the j-th underwater data at timestamp t; Step 2-5: Create an underwater data set v = {v1, v2, ..., v n}, where v1 represents the first type of underwater data, v2 represents the second type of underwater data, and v n Represents n types of underwater data; establish underwater data association set e={e ij |i,j∈{1,2,...,n}}, where e ij Represents underwater data v i Underwater data v j One-way association relationship, when underwater data i and underwater data j are associated and data v i For data v j When there is a causal relationship, e ij The value is 1, otherwise it is 0; establish the association strength set w={w ij (t)|i,j∈{1,2,...,n}}, when e ij When the value is 1 and i≠j, w ij (t) = w` ij (t), when e ij When the value is 0 or i=j, w ij (t) = 0; with underwater data as nodes and underwater data associations as edges, a directed weighted graph G = (v, e, w) is established according to the underwater data set, the underwater data association set, and the association strength set; Step 2-6: According to the w in the association strength set w ij (t) generates an n×n dynamic incidence matrix w(t), and updates the dynamic incidence matrix when the timestamp t changes.

[0024] Step S3: calculating the global correlation of the underwater data according to the dynamic correlation matrix, wherein the global correlation is used to obtain the sensitivity of the underwater data to the model layer of the compression model; setting a sensitivity threshold to generate a layered compression scheme for the model layer; Furthermore, step S3 further includes: Step S3-1: Set the quantization target set for model compression, which includes the parameter compression rate R p , calculation amount compression ratio R f and the inference latency target D target : ; where R p Represents the parameter compression ratio, N before Represents the number of parameters of the model to be compressed, N after Represents the number of parameters of the compressed model, 0 <R p <1; ; where R f Represents the computational compression ratio, F after Represents the number of floating-point operations of the compressed model, F before Represents the number of floating-point operations of the model to be compressed, 0 <R f <1; Inference latency target D target The maximum inference time allowed by the client device is determined based on the computing power of the underwater robot processor and the real-time requirements of the task. Step S3-2: Number the model layers of the model to be compressed in the order of processing. =1, 2, ..., L, where L is the total number of layers; Step S3-3: In the training phase of the model to be compressed, for the i-th underwater data, fix the other types of data, apply disturbance to the i-th underwater data, and calculate the value of the i-th underwater data according to the data before and after the disturbance. The absolute value of the ratio of the output change of the layer to the original output and the absolute value of the ratio of the perturbation amplitude to the original value are quantified. The response intensity a of the layer to the i-th underwater data li : ; where a li Represents the model to be compressed The response intensity of the layer to the i-th underwater data, ΔO l Representative The output change of the layer, O l Representative The original output of the layer, Δv` i represents the disturbance amplitude, v` i Represents the original value of the i-th underwater data; Step S3-4: Calculate the global correlation degree of each underwater data according to the dynamic correlation matrix w(t): ; Among them Gi (t) represents the global correlation of the i-th underwater data, n represents the number of underwater data types, |w ij (t)| is the w in the dynamic incidence matrix w(t) ij The absolute value of (t); Step S3-5: Calculate the sensitivity of the model layer of the to-be-compressed model to the underwater data based on the global correlation and the response strength:

[0025] Among them S l (t) represents the first The sensitivity of the layer to underwater data, a li Represents the model to be compressed The response intensity of the layer to the i-th underwater data, G i (t) represents the global correlation of the i-th underwater data, and t represents the timestamp; Step S3-6: Set a sensitivity threshold, and adopt a low-rank decomposition compression method for the model layer of the model to be compressed whose sensitivity is greater than the sensitivity threshold; adopt a channel pruning compression method for the model layer of the model to be compressed whose sensitivity is less than or equal to the sensitivity threshold; and assign a compression rate to the model layer of the model to be compressed:

[0026] where r l (t) represents the first Layer compression ratio, R p Represents the parameter compression ratio, S l (t) represents the first The sensitivity of the layer to underwater data, L is the total number of layers, max represents the maximum value, and t is the timestamp.

[0027] Step S4: hierarchically compress the model layers of the model to be compressed according to the hierarchical compression scheme to obtain a compressed model; deploy the compressed model and collect the real-time performance of the compressed model, and perform feedback adjustment on the hierarchical compression scheme according to the real-time performance.

[0028] Furthermore, step S4 further includes: Step S4-1: for the model layer of the model to be compressed Layer, get its parameter matrix W l ∈R M×H , where M represents the input dimension of the layer, H represents the output dimension of the layer, and R represents the matrix space consisting of M×H real numbers; Step S4-2: For the model layer using the compression method of low-rank decomposition , Wl Decomposed into two low-rank matrices W l `=Z l ×C l , where W l `Representing the The new parameter matrix of the layer, Z l ∈R M×K , C l ∈R K×H , K=[(1-r l )×(M×H)÷(M+H)], r l Representative Layer compression ratio, Z l and C l Represents two low-rank matrices, K is C l The rows and Z of the matrix l Columns of a matrix; For the model layer using the compression method of channel pruning , sort the channels by score, and delete A×r l channels, where A represents the model layer The number of channels before deletion, r l Representative The compression ratio of the layer; Step S4-3: perform layered compression on the model to be compressed to obtain a compressed model; deploy the compressed model, and measure the performance deviation of the layered compression scheme based on the feedback error: ; Where E(t) represents the feedback error, ACC0 represents the inference accuracy of the model to be compressed, ACC(t) represents the inference accuracy of the compressed model, and D target represents the maximum inference time allowed by the end device, D(t) represents the inference delay of the compressed model at timestamp t, FLOPs0 represents the floating-point calculation amount of the model to be compressed, FLOPs(t) represents the floating-point calculation amount of the compressed model at timestamp t, and R f Represents the computational compression ratio; Step S4-4: Adjust the compression rate using the gradient descent method according to the feedback error: ; where r l (t+1) represents the adjusted Layer compression ratio, r l Representative The original compression rate of the layer, η is the preset learning rate, and E(t) represents the feedback error.

[0029] For example: A certain type of underwater robot is equipped with 6 types of sensors, which synchronously collects underwater data with a sampling interval of T=0.5s. It continuously collects data for 10s to obtain 20 sets of data.

[0030] Sensor type and raw data example (at t=5s): Sonar sensor: sonar distance V1(5)=12.5m; Visual sensor: visual coordinate V2(5)=(3.2, -1.8)m; Temperature sensor: temperature value V3(5)=16.3℃; Pressure sensor: pressure value V4(5)=2.1MPa; Ocean current velocity sensor: velocity V5(5)=0.8m / s; Inertial sensor: pitch angle V6(5)=5.2°; The 20 groups of data were normalized to obtain the normalized data set.

[0031] Classify 6 types of data: Spatial data: v1 (sonar distance), v2 (visual coordinates); Physical data: v3 (temperature), v4 (pressure); Motion data: v5 (flow velocity), v6 (pitch angle); Set the time window D=3, that is, analyze the data of [t-2, t], t=5s.

[0032] Take v1 (sonar distance) and v2 (visual coordinates) as an example: Joint probability density p(x,y): According to historical data statistics, the co-occurrence probability of sonar distance and visual coordinates in the obstacle detection scene is 0.72, and the edge probability density p(x)=0.81, p(y)=0.75. The calculation result of mutual information is MI 12 (5) = 0.23 bit; Set the mutual information threshold τ=0.2, 0.23>τ, and determine that v1 and v2 are related.

[0033] Set the attenuation coefficient λ=0.5, the current timestamp t=5, and the adjacent historical timestamp t`=4, then the temporal attention factor α5=0.607.

[0034] If underwater data i and j are of the same type, then β ij =β1=0.9; if across types, β ij = =0.4. For example, the correlation strength between v1 and v2 is calculated as: 12 (5) = α5 × β 12 ×MI 12(5) = 0.126; Taking the 6 types of underwater data at t=5s as an example, the e ij value: Sonar detection of obstacles occurs before visual imaging, and it is determined that v1 has a causal relationship with v2, so e 12 =1,e 21 =0; The slow change of underwater temperature affects the pressure distribution, and it is determined that there is a causal relationship between v3 and v4, so e 34 =1,e 43 =0; The change in ocean current speed directly causes the robot's posture to shift, and it is determined that there is a causal relationship between v5 and v6, so e 56 =1,e 65 =0; There is no direct causal relationship between cross-type data (such as v1 and v3), so e ij =0.

[0035] According to e ij Adjust the value of the association strength, by w` ij (t) adjusted to w ij (t).

[0036] Quantitative goal setting: Parameter compression ratio R p =40%; Calculation compression ratio R f =35%; Inference latency target D target =50ms; Take v1 of a CNN model as an example, the total number of layers L=10, take the 5th layer ( =5) Analysis: Response intensity calculation: Apply 5% perturbation to v1 (Δv`1=0.625m), let the change in the 5th layer output after perturbation ΔO5=0.12, the original output O5=0.85, then a 51 =2.824; Calculation of global correlation: Let the global correlation of v1 be the sum of the absolute values ​​of the elements in the first row of the dynamic correlation matrix G1 (5) = 0.126; Sensitivity calculation: Let S5 (5) represent the first The sensitivity of the layer to underwater data is 0.756, that is, S5 (5) = 0.284 × 0.126... = 0.756.

[0037] The sensitivity threshold is set to 0.5, S5 (5) = 0.756> 0.5, and low-rank decomposition compression is used for the 5th layer. For example, the compression rate is allocated to 0.058, that is, r5 (5) = 0.4 × 0.756 ÷ ... = 0.058; Taking the 5th layer as an example, the parameter matrix W5∈R 128×256 , low-rank decomposition K = 256 × (1-0.058) = 80, decomposed into Z5∈R 128×80 , C l ∈R 80×256 The original parameter amount is 128×256=32768, which is reduced to 128×80+80×256=30720 after compression, and the parameter reduction rate is 6.25%.

[0038] If the model layer If channel pruning is used, the model layer The channels are scored and sorted, and after deletion, A×r l channels, where A represents the model layer The number of channels before deletion, r l Representative The compression ratio of the layer; After deployment, collect performance data of layer 5 at t=10s: ACC0=92.3%, ACC(10)=89.5%; D target =50ms, D(10)=48ms; FLOPs0 = 1.85 × 10 9 ; The amount of calculation is linearly related to the amount of parameters. After correction, the amount of parameters is reduced by 6.25%, so: FLOPs (10) = 1.85 × 10 9 × (1-6.25%) = 1.734 × 10 9 ; R f =35%; Let weights w1=0.4; w2=0.3; w3=0.3; E(10)=0.1094; Let r5(10) = 0.058, take the learning rate as 0.05, and use the gradient descent method to adjust the compression rate: r5(11)≈0.0602.

[0039] Example 2: Figure 2As shown, the present invention provides a lightweight model compression system for an underwater robot end side, the system comprising a data acquisition and preprocessing module, a data association dynamic analysis module, a compression scheme generation module, and a model compression and feedback optimization module; the data acquisition and preprocessing module is used to complete the acquisition and preprocessing of underwater data and attitude angle data; the data association dynamic analysis module is used to calculate the data association strength and construct a data association dynamic graph, and generate a dynamic association matrix based on the data association dynamic graph; the compression scheme generation module is used to formulate a targeted hierarchical compression scheme based on the data association characteristics and the sensitivity of the model layer; the model compression and feedback optimization module is used to perform the compression operation and dynamically adjust the compression scheme through real-time performance feedback; The output end of the data acquisition and preprocessing module is electrically connected to the input end of the data association dynamic analysis module; the output end of the data association dynamic analysis module is electrically connected to the input end of the compression scheme generation module; the output end of the compression scheme generation module is electrically connected to the input end of the model compression and feedback optimization module.

[0040] The data acquisition and preprocessing module also includes a data acquisition unit and a data preprocessing unit; the data acquisition unit is used to control multiple types of sensors to synchronously acquire underwater data at the same sampling interval; the data preprocessing unit is used to generate a sequence with a timestamp from the acquired underwater data, and normalize the underwater data to obtain a normalized underwater data set.

[0041] The data association dynamic analysis module also includes an association strength calculation unit and a dynamic matrix generation unit; the association strength calculation unit is used to establish a data type set, set the time window length, calculate the association strength between data through the data type attention factor, mutual information algorithm and time attention factor, and judge the data association; the dynamic matrix generation unit is used to establish a directed weighted graph and generate a dynamic association matrix updated with the timestamp according to the association strength.

[0042] The compression scheme generation module also includes a sensitivity calculation unit and a scheme formulation unit; the sensitivity calculation unit is used to obtain the sensitivity of the model layer of the model to be compressed to the underwater data by quantifying the response strength of the model layer through perturbation, and calculating the global correlation of the data in combination with the dynamic correlation matrix; the scheme formulation unit is used to assign a compression method to the model layer of the model to be compressed according to the sensitivity threshold, and determine the compression rate.

[0043] The model compression and feedback optimization module also includes a hierarchical compression execution unit and a feedback optimization unit; the hierarchical compression execution unit is used to implement corresponding compression methods on different model layers according to the hierarchical compression scheme; the feedback optimization unit is used to design a feedback error function and adjust the compression rate according to the feedback error through the gradient descent method.

[0044] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.

Claims

1. A method for compressing a lightweight model of an underwater robot end side, characterized by: Step S1: Acquire underwater data by equipping an underwater robot with multiple types of sensors; and pre-process the acquired underwater data; Step S2: classify the underwater data according to data type and set the data association time window length; Calculate the correlation strength between underwater data and construct a data correlation dynamic graph, and generate a dynamic correlation matrix based on the data correlation dynamic graph; Step S3: calculating the global correlation of the underwater data according to the dynamic correlation matrix, wherein the global correlation is used to obtain the sensitivity of the underwater data to the model layer of the compression model; Setting sensitivity thresholds to generate layered compression schemes for model layers; Step S4: performing layered compression on the model layers of the to-be-compressed model according to the layered compression scheme to obtain a compressed model; The compressed model is deployed and the real-time performance of the compressed model is collected, and feedback adjustment is performed on the layered compression scheme based on the real-time performance.

2. The method for compressing a lightweight model of an underwater robot end side according to claim 1, characterized in that: The step S1 further includes: Step S1-1, the multiple types of sensors include a sonar sensor, a visual sensor, a temperature sensor, a pressure sensor, an ocean current velocity sensor, and an inertial sensor; the multiple types of sensors are used to synchronously acquire underwater data according to the same sampling interval T; the sonar sensor is used to acquire the sonar distance of the underwater environment; the visual sensor is used to collect the visual coordinates of the image; the temperature sensor is used to measure the ambient temperature value; the pressure sensor is used to acquire the underwater pressure value; the ocean current velocity sensor is used to detect the speed of the ocean current; and the inertial sensor is used to acquire the attitude angle data of the underwater robot; Step S1-2: Generate a data sequence V(t) = [V1(t), V2(t), ..., V containing a timestamp t based on the acquired underwater data. n (t)], where n represents the number of underwater data types, t represents the timestamp, V(t) represents the data value of the underwater data at timestamp t, and the update frequency of the timestamp is the same as the sensor sampling interval T; Step S1-3: pre-process the underwater data using the minimum-maximum normalization method to obtain normalized underwater data and establish a normalized underwater data set. ={ , ,..., }, where n represents the number of underwater data types, t represents the timestamp, Represents the normalized data value of the underwater data at timestamp t.

3. The method for compressing a lightweight model of an underwater robot end side according to claim 1, characterized in that: The step S2 further includes: Step S2-1, the data types include spatial data, physical data, and motion data; the underwater data is classified according to the data types: the spatial data includes sonar distance and visual coordinates, the physical data includes ambient temperature and underwater pressure, and the motion data includes ocean current speed and attitude angle data of the underwater robot; Step S2-2: Set the data association time window length D. For the two underwater data in the normalized underwater data set, use the mutual information algorithm to calculate the mutual information value MI between the two underwater data in the time window [t-D+1, t] ij (t), where i and j represent two types of underwater data, MI represents the mutual information value, and t represents the timestamp; Set the mutual information threshold τ, when τ≤MI ij At (t), it is determined that there is a correlation between underwater data i and underwater data j; Step S2-3: Set the time attention factor to reflect the importance of the correlation between the current timestamp t and the historical timestamps: ; in represents the time attention factor, λ is the decay coefficient, t represents the current timestamp, and t` represents the historical timestamps adjacent to the current timestamp; Step S2-4: Determine whether the i-th underwater data and the j-th underwater data belong to the same data type, and set the data type attention factor of the same data type to , set the data type attention factor of different data types to , < ; Multiply the data type attention factor, time attention factor and mutual information value to obtain the correlation strength w between underwater data ij (t), the w` ij (t) represents the correlation strength value between the i-th underwater data and the j-th underwater data at timestamp t; Step 2-5: Create an underwater data set v = {v1, v2, ..., v n }, where v1 represents the first type of underwater data, v2 represents the second type of underwater data, and v n Represents n types of underwater data; establish underwater data association set e={e ij |i,j∈{1,2,...,n}}, where e ij Represents underwater data v i Underwater data v j One-way association relationship, when underwater data i and underwater data j are associated and data v i For data v j When there is a causal relationship, e ij The value is 1, otherwise it is 0; establish the association strength set w={w ij (t)|i,j∈{1,2,...,n}}, when e ij When the value is 1 and i≠j, w ij (t) = w` ij (t), when e ij When the value is 0 or i=j, w ij (t) = 0; with underwater data as nodes and underwater data associations as edges, a directed weighted graph G = (v, e, w) is established according to the underwater data set, the underwater data association set, and the association strength set; Step 2-6: According to the w in the association strength set w ij (t) generates an n×n dynamic incidence matrix w(t), and updates the dynamic incidence matrix when the timestamp t changes.

4. The method for compressing a lightweight model of an underwater robot end side according to claim 1, characterized in that: The step S3 further comprises: Step S3-1: Set the quantization target set for model compression, which includes the parameter compression rate R p , calculation amount compression ratio R f and the inference latency target D target : The parameter compression ratio is represented by the difference between the parameter ratios of the model to be compressed and the compressed model; the computational compression ratio is represented by the difference between the floating-point operation times of the model to be compressed and the compressed model; Inference latency target D target The maximum inference time allowed by the client device is determined based on the computing power of the underwater robot processor and the real-time requirements of the task. Step S3-2: Number the model layers of the model to be compressed in the order of processing. =1, 2, ..., L, where L is the total number of layers; Step S3-3: In the training phase of the model to be compressed, for the i-th underwater data v i , fix other types of data, for underwater data v i Apply disturbance, and quantify the effect of the layer on v according to the absolute value of the ratio of the output change of the layer before and after the disturbance to the original output and the absolute value of the ratio of the disturbance amplitude to the original value i The response intensity a li ; Step S3-4: Calculate the global correlation degree of each underwater data according to the dynamic correlation matrix w(t): ; Among them G i (t) represents the global correlation of the i-th underwater data, n represents the number of underwater data types, |w ij (t)| is the w in the dynamic incidence matrix w(t) ij The absolute value of (t); Step S3-5, calculating the sensitivity of the model layer of the model to be compressed to the underwater data according to the global correlation and the response strength: The response intensity of the layer to each underwater data is multiplied by the global correlation corresponding to the underwater data and then accumulated to obtain the first The sensitivity of the layer to underwater data; Step S3-6, setting a sensitivity threshold, adopting a low-rank decomposition compression method for the model layer of the model to be compressed whose sensitivity is greater than the sensitivity threshold; adopting a channel pruning compression method for the model layer of the model to be compressed whose sensitivity is less than or equal to the sensitivity threshold; and assigning a compression rate to the model layer of the model to be compressed.

5. The method for compressing a lightweight model of an underwater robot end side according to claim 1, characterized in that: The step S4 further includes: Step S4-1: for the model layer of the model to be compressed Layer, get its parameter matrix W l ∈R M×H , where M represents the input dimension of the layer, H represents the output dimension of the layer, and R represents the matrix space consisting of M×H real numbers; Step S4-2: For the model layer using the compression method of low-rank decomposition , W l Decomposed into two low-rank matrices W l `=Z l ×C l , where W l `Representing the The new parameter matrix of the layer, Z l ∈R M×K , C l ∈R K×H , K=[(1-r l )×(M×H)÷(M+H)], r l Representative Layer compression ratio, Z l and C l Represents two low-rank matrices, K is C l The rows and Z of the matrix l Columns of a matrix; For the model layer using the compression method of channel pruning , sort the channels by score, and delete A×r l channels, where A represents the model layer The number of channels before deletion, r l Representative The compression ratio of the layer; Step S4-3: perform layered compression on the model to be compressed to obtain a compressed model; deploy the compressed model, and measure the performance deviation of the layered compression scheme based on the feedback error: ; Where E(t) represents the feedback error, ACC0 represents the inference accuracy of the model to be compressed, ACC(t) represents the inference accuracy of the compressed model, and D target represents the maximum inference time allowed by the end device, D(t) represents the inference delay of the compressed model at timestamp t, FLOPs0 represents the floating-point calculation amount of the model to be compressed, FLOPs(t) represents the floating-point calculation amount of the compressed model at timestamp t, and R f Represents the computational compression ratio; Step S4-4: Adjust the compression rate using the gradient descent method according to the feedback error: ; where r l (t+1) represents the adjusted Layer compression ratio, r l Representative The original compression rate of the layer, η is the preset learning rate, and E(t) represents the feedback error.

6. A lightweight model compression system for an underwater robot end side, applied to the lightweight model compression method for an underwater robot end side according to any one of claims 1 to 5, characterized in that: The system includes a data acquisition and preprocessing module, a data association dynamic analysis module, a compression scheme generation module, and a model compression and feedback optimization module; the data acquisition and preprocessing module is used to complete the acquisition and preprocessing of underwater data; the data association dynamic analysis module is used to calculate the data association strength of underwater data and construct a data association dynamic graph, and generate a dynamic association matrix based on the data association dynamic graph; the compression scheme generation module is used to formulate a layered compression scheme based on the sensitivity of underwater data to the model layer of the compression model; The model compression and feedback optimization module is used to perform layered compression operations and adjust the layered compression scheme through real-time performance feedback; The output end of the data acquisition and preprocessing module is electrically connected to the input end of the data association dynamic analysis module; the output end of the data association dynamic analysis module is electrically connected to the input end of the compression scheme generation module; the output end of the compression scheme generation module is electrically connected to the input end of the model compression and feedback optimization module.

7. The underwater robot end-side lightweight model compression system according to claim 6, characterized in that: The data acquisition and preprocessing module also includes a data acquisition unit and a data preprocessing unit; the data acquisition unit is used to control multiple types of sensors to synchronously acquire underwater data at the same sampling interval; the data preprocessing unit is used to generate a sequence with a timestamp from the acquired underwater data, and normalize the underwater data to obtain a normalized underwater data set.

8. The underwater robot end-side lightweight model compression system according to claim 6, characterized in that: The data association dynamic analysis module also includes an association strength calculation unit and a dynamic matrix generation unit; the association strength calculation unit is used to establish a data type set, set the time window length, calculate the association strength between data through the data type attention factor, mutual information algorithm and time attention factor, and judge the data association; The dynamic matrix generation unit is used to establish a directed weighted graph and generate a dynamic association matrix updated with a timestamp according to the association strength.

9. The underwater robot end-side lightweight model compression system according to claim 6, characterized in that: The compression scheme generation module further includes a sensitivity calculation unit and a scheme formulation unit; the sensitivity calculation unit is used to obtain the sensitivity of the model layer of the to-be-compressed model to the underwater data by perturbing the response strength of the quantified model layer and calculating the global correlation of the data in combination with the dynamic correlation matrix; The scheme formulation unit is used to allocate a compression method to the model layer of the model to be compressed according to the sensitivity threshold and determine the compression rate.

10. The underwater robot end-side lightweight model compression system according to claim 6, characterized in that: The model compression and feedback optimization module also includes a layered compression execution unit and a feedback optimization unit; The layered compression execution unit is used to implement corresponding compression methods on different model layers according to the layered compression scheme; The feedback optimization unit is used to design a feedback error function and adjust the compression rate according to the feedback error through a gradient descent method.