Underwater vision large model compression method based on KVcache optimization

By constructing a sub-block feature database and dynamically recycling shared data, the problems of transmission delay and computational complexity of large underwater visual models in resource-constrained environments are solved, achieving efficient target detection and semantic segmentation.

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

Patent Information

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

AI Technical Summary

Technical Problem

Underwater visual large models are limited by hardware resources and communication bandwidth in underwater environments, making it difficult to achieve efficient target detection and semantic segmentation. Furthermore, the model transmission delay and interruption problems are severe.

Method used

Image features are extracted by regular grid partitioning and deep neural networks, a sub-block feature database is constructed, similar sub-blocks are calculated using cosine similarity and Euclidean distance, a shared storage index table is established, and data is dynamically recycled according to the frequency of access to optimize model compression.

Benefits of technology

It effectively compresses model size, improves storage efficiency and deployment adaptability, reduces computational complexity, and enhances processing efficiency and real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121120807A_ABST
    Figure CN121120807A_ABST
Patent Text Reader

Abstract

The invention discloses an underwater vision large model compression method based on KVcache optimization, and relates to the technical field of model compression methods.The method comprises the steps that an original image is obtained through an underwater vision large model, and after low-pass filtering and normalization preprocessing are conducted, edges, textures and colors are extracted through a convolutional neural network to serve as basic visual features; dividing the image into a plurality of sub-blocks, extracting shape, material and other high-dimensional feature vectors through a deep neural network, and constructing a sub-block feature database; calculating the weighted similarity degree of the sub-blocks by using the cosine similarity and the Euclidean distance, establishing a similar set and reserving shared data, comparing and calling the shared data through the Hausdorff distance, the chi-square distance and the color moment, and finally dynamically recycling low-frequency data according to the calling frequency. According to the scheme, through feature sharing and dynamic storage optimization, the model parameter scale is reduced, the underwater environment storage efficiency and the processing real-time performance are improved, and the method has the advantages of precision and calculation efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of model compression methods, specifically a KVcache-optimized underwater vision large model compression method. Background Technology

[0002] As the core of intelligent sensing technology, underwater visual large models play a key role in marine resource exploration, underwater facility inspection, and ecological environment monitoring. This not only requires the model to have high-precision target detection and semantic segmentation capabilities, but also to adapt to complex underwater lighting changes, water turbidity and other interference factors, which puts extremely high demands on the model's environmental robustness and computational efficiency.

[0003] On the one hand, underwater robots, sensor nodes, and other equipment are limited by the high cost and maintenance difficulty of underwater operations, and their hardware architectures typically adopt lightweight designs, making it difficult to integrate high-performance computing chips. On the other hand, underwater wireless communication bandwidth is extremely low. Directly transmitting raw model data or uncompressed high-dimensional features would lead to a surge in data transmission latency, and could even disrupt mission execution due to communication interruptions. Therefore, compressing large underwater visual models to reduce the scale of model parameters and computational complexity has become a necessary means to improve the feasibility of deploying models in resource-constrained underwater environments and ensure the efficient execution of marine exploration missions. Summary of the Invention

[0004] The purpose of this invention is to provide a KVcache-optimized underwater visual large model compression method to solve the problems raised in the prior art.

[0005] To achieve the above objectives, the present invention provides the following technical solution: Step S1: Obtain raw image data through an underwater visual large model; preprocess the raw image data to obtain processed image data; extract the basic visual features of the processed image data through a convolutional neural network. Step S2: Divide the processed image data into fixed-size sub-blocks using a regular grid partitioning method, and obtain the basic visual features corresponding to the sub-blocks; extract the feature information of each sub-block through a deep neural network to form a high-dimensional feature vector; Step S3: Obtain the spatial location identifier of the sub-block. Use the spatial location identifier of the sub-block as the key and the high-dimensional feature vector corresponding to the sub-block as the value to obtain the key-value pair of the sub-block. Construct a sub-block feature database based on the key-value pair to store the high-dimensional feature vector and the corresponding basic visual features of each sub-block. Step S4: Perform pairwise comparisons of the high-dimensional feature vectors in the sub-block feature database to determine whether the sub-blocks are similar; establish a set of similar sub-blocks, and retain the key-value data and basic visual features of one sub-block in the set of similar sub-blocks as shared data; establish a shared storage index table; Step S5: The underwater visual large model retrieves shared data from the shared storage index table based on the basic visual features of the current processing sub-block; Step S6: Record the call frequency of shared data, set a call frequency threshold, and recycle shared data whose call frequency is lower than the call frequency threshold.

[0006] Furthermore, step S1 also includes: Step S1-1: The underwater visual large model is an artificial intelligence model designed for the underwater environment. It is used to acquire and process raw image data. The raw image data is preprocessed to obtain processed image data. The preprocessing includes using a low-pass filter to reduce noise in the raw image data and normalizing it. The original image data is a pixel value matrix converted from the light signals directly acquired by the underwater visual large model; The low-pass filtering method is a signal processing method used to handle scattering from suspended particles in water and interference from electronic components of equipment. The normalization process involves subtracting the minimum value of each element in the pixel value matrix from the minimum value of the elements in the matrix, and then dividing by the difference between the maximum and minimum values ​​of the elements in the matrix, thus mapping the element to the interval [0, 1]. Step S1-2: Construct a convolutional neural network consisting of convolutional layers, pooling layers, and fully connected layers; extract the basic visual features of the processed image data through the convolutional neural network; the basic visual features include edge features, texture features, and color features. The edge features are a set of pixel-level edge points representing the outline of an object in the image; The texture feature is a statistical histogram generated by the local binary mode of objects in the image. The local binary mode is to take a certain pixel point in the image as the center, obtain the value of the center pixel, compare the value of the pixel in its neighborhood with the value of the center pixel, and generate a binary code. This code corresponds to a texture feature value. The texture feature value of the image is divided into Q intervals from small to large, that is, the histogram has Q groups, and the frequency of each group is the number of times the feature value falls in that interval. The color feature is the color moment of the object in the image, and the color moment includes the mean, variance and third moment of the color distribution of the image.

[0007] Furthermore, step S2 also includes: Step S2-1: Divide the processed image data into M intervals by row and N intervals by column, divide the image data into M×N sub-blocks, and obtain the basic visual features of the M×N sub-blocks. Step S2-2: Construct a deep neural network consisting of an input layer, a hidden layer, and an output layer. The hidden layer extracts feature information by performing sliding window operations on the input sub-blocks through convolution kernels, downsamples the sub-blocks, and maps the feature information into a high-dimensional feature vector.

[0008] The feature information includes the shape, material, and structural features of the object within the sub-block; the shape features include the perimeter, area, aspect ratio, and roundness of the object's outline; the material features include the surface roughness, reflectivity, and gloss of the object; the structural features include the connection method, relative position, and symmetry of the object's parts, and the structural features are assigned values ​​and quantized; the shape, material, and structural features are sequentially concatenated into a high-dimensional vector F = [f1, f2, ..., f d Where f represents feature information, d represents the number of types of feature information, and f d This represents the d-th type of feature information.

[0009] Furthermore, step S3 also includes: Step S3-1: The position of each sub-block is determined by its row index i and column index j, where i∈[1,M] and j∈[1,N]; establish a two-dimensional coordinate ID=(i,j) as the spatial location identifier of the sub-block; Step S3-2: Use the spatial location identifier of the sub-block as the key and the high-dimensional feature vector corresponding to the sub-block as the value to form key-value pairs (ID, F); Step S3-3: Construct a sub-block feature database using a hash table structure, and establish a one-dimensional index index = (i-1) × N + j, where index represents a one-dimensional index and N represents the number of intervals in the processed image data divided by columns; the hash function is h(index) = index mod C, where h represents the hash function, mod represents the modulo operation, and C represents the capacity of the hash table; store the key-value pairs and corresponding high-dimensional feature vectors of each sub-block in the sub-block feature database according to the hash table, and at the same time store the basic visual features corresponding to each sub-block in the sub-block feature database.

[0010] Furthermore, step S4 also includes: Step S4-1: Perform pairwise comparisons of high-dimensional feature vectors in the sub-block feature database using the cosine similarity algorithm and Euclidean distance calculation method.

[0011] A and B represent two types of sub-blocks, respectively. and represents the high-dimensional feature vectors of sub-blocks A and B respectively, · represents the dot product operation between vectors, and Sim represents the cosine similarity between the high-dimensional feature vectors of the two sub-blocks A and B;

[0012] Where Dist represents the Euclidean distance between the two types of sub-blocks A and B, n represents the dimension of the high-dimensional feature vectors corresponding to the two types of sub-blocks A and B, and i represents the i-th dimension; Step S4-2: Calculate the weighted similarity S of the high-dimensional feature vectors between sub-block A and sub-block B. A,B :

[0013] Where S A,B represents the weighted similarity of the high-dimensional feature vectors between sub-block A and sub-block B, Sim represents the cosine similarity of the high-dimensional feature vectors between sub-block A and sub-block B, Dist represents the Euclidean distance between sub-block A and sub-block B, and w1 and w2 are the weights, satisfying w1+w2=1; Set a similarity threshold. When the weighted similarity is greater than or equal to the similarity threshold, sub-block A and sub-block B are determined to be similar. Step S4-3: Create a set of similar sub-blocks based on the similar sub-block sets, and create a library of similar sub-block sets K=[K1, K2, ..., K2] based on the similar sub-block sets. u ], where K represents the library of similar sub-block sets, u represents the number of similar sub-block sets, K u Represents the set of the u-th similar sub-blocks; Step S4-4: For each set of similar sub-blocks, retain the key-value data and basic visual features of one sub-block as the shared data of that set of similar sub-blocks; establish a shared storage index table, which contains the shared data corresponding to the set of similar sub-blocks.

[0014] Furthermore, step S5 also includes: Step S5-1: Compare the edge features of the current sub-block with the edge features in the shared data corresponding to each similar sub-block set in the shared storage index table: Use Hough transform to detect straight and curved edge features, and calculate the Hausdorff distance D between the current sub-block and the pixel-level edge point set of each shared data. H :

[0015] Where D H Let A0 represent the pixel-level edge point set of the current sub-block and each shared data set, and B0 represent the pixel-level edge point set of the shared data B. H(A0, B0) represents the Hausdorff distance between the pixel-level edge point set of the current sub-block and the pixel-level edge point set of the shared data B, a represents any point in the pixel-level edge point set of the current sub-block, b represents any point in the pixel-level edge point set of the shared data B, d(a, b) represents the Euclidean distance between points a and b, max represents taking the maximum value, and min represents taking the minimum value. Set the Hausdorff distance threshold T H Keep D H ≤T H Shared data was used as preliminary candidate shared data; Step S5-2: Calculate the chi-square distance between the statistical histogram of the current processing sub-block and the statistical histogram corresponding to the preliminary candidate shared data. :

[0016] in A represents the chi-square distance between the statistical histogram of the current processing sub-block and the statistical histogram corresponding to the preliminary candidate shared data. r B is a statistical histogram representing the current sub-block being processed. r This is a statistical histogram representing shared data B from the preliminary candidate shared data. The chi-square distance between the statistical histogram of the current processing sub-block and the statistical histogram corresponding to shared data B in the preliminary candidate shared data; Q represents the number of groups in the statistical histogram, q represents the q-th group, A q B represents the frequency of the q-th group in the statistical histogram of the currently processed sub-block. q The frequency of the qth group in the statistical histogram corresponding to shared data B in the preliminary candidate shared data; Set chi-square distance threshold ,reserve ≤ Shared data is used as secondary candidate shared data; Step S5-3: Calculate the color moments of the current processed sub-block in the RGB channels, obtain the color moments of the sub-blocks in the secondary candidate shared data in the RGB channels, and use Euclidean distance to calculate the similarity D between the color moments of the current processed sub-block and the color moments of the sub-blocks in the secondary candidate shared data. CM :

[0017] Where D CM The color moment of the currently processed sub-block is represented by the color moment of the sub-block in the secondary candidate shared data, where c represents the color channel (RGB, three channels), m represents the order, and A represents the color depth. c,m B represents the m-th order color moment on the c-th color channel of the currently processed sub-block. c,mThis represents the m-th color moment on the c-th color channel of shared data B in the secondary candidate shared data; Set distance threshold T CM Keep D CM ≤T CM The secondary candidate shared data is the required shared data, and the required shared data is called; when the required shared data is not unique, D is called. CM The lowest value of the required shared data; Step S5-4: When D does not exist H ≤T H or ≤ Or D CM ≤T CM When sharing data, key-value data and basic visual features are directly retrieved from the sub-block feature database.

[0018] Furthermore, step S6 also includes: Step S6-1: Set a frequency counter to record the calling frequency of each type of shared data; whenever shared data is called as required shared data, the value of its corresponding frequency counter is incremented by 1; Step S6-2: Set the call frequency threshold and judgment period. At the end of each judgment period, the shared data whose value of the frequency counter is lower than the call frequency threshold is recycled. After the recycling process is completed, the next judgment period begins. Step S6-3: At the end of each recycling process, read the average value P of the frequency counters for all shared data in that cycle, and adjust the call frequency threshold to T. d =α×P; where T d α represents the call frequency threshold, and α represents the adjustment coefficient.

[0019] When a judgment cycle ends, shared data whose frequency counter value is lower than the call frequency threshold is marked as unprocessed shared data, and the number of times the shared data is marked as unprocessed shared data is recorded as the marking count; a marking threshold is set, and shared data whose marking count is higher than the marking threshold and the similar set corresponding to the shared data are deleted from the shared storage index table.

[0020] Compared with the prior art, the beneficial effects of the present invention are: 1. This invention preprocesses and divides the original image data into regular grids, and combines convolutional neural networks and deep neural networks to extract basic visual features and high-dimensional feature vectors, constructing a sub-block feature database. This lays the foundation for subsequent feature comparison and shared storage, realizing structured processing of large underwater visual model data, which facilitates model compression and optimization.

[0021] 2. This invention calculates the weighted similarity of high-dimensional feature vectors of sub-blocks based on cosine similarity and Euclidean distance, establishes a set of similar sub-blocks and retains shared data, reduces the storage of duplicate features, effectively compresses the model size, and improves the storage efficiency and deployment adaptability of the model in underwater resource-constrained environments.

[0022] 3. This invention calls shared data based on basic visual features such as edge features, statistical histograms, and color moments, and dynamically recycles low-frequency shared data according to the call frequency. While ensuring the accuracy of model processing, it optimizes the utilization of storage resources, reduces the computational complexity of the model, and improves the processing efficiency and real-time performance of large underwater visual models. Attached Figure Description

[0023] Figure 1 This is a flowchart illustrating a KVcache-optimized underwater visual large model compression method according to the present invention. Detailed Implementation

[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0025] Example: Figure 1 This invention provides a technical solution: a KVcache-optimized underwater visual large model compression method, which includes the following steps: Step S1: Obtain raw image data through an underwater visual large model; preprocess the raw image data to obtain processed image data; extract the basic visual features of the processed image data through a convolutional neural network. Step S2: Divide the processed image data into fixed-size sub-blocks using a regular grid partitioning method, and obtain the basic visual features corresponding to the sub-blocks; extract the feature information of each sub-block through a deep neural network to form a high-dimensional feature vector; Step S3: Obtain the spatial location identifier of the sub-block. Use the spatial location identifier of the sub-block as the key and the high-dimensional feature vector corresponding to the sub-block as the value to obtain the key-value pair of the sub-block. Construct a sub-block feature database based on the key-value pair to store the high-dimensional feature vector and the corresponding basic visual features of each sub-block. Step S4: Perform pairwise comparisons of the high-dimensional feature vectors in the sub-block feature database to determine whether the sub-blocks are similar; establish a set of similar sub-blocks, and retain the key-value data and basic visual features of one sub-block in the set of similar sub-blocks as shared data; establish a shared storage index table; Step S5: The underwater visual large model retrieves shared data from the shared storage index table based on the basic visual features of the current processing sub-block; Step S6: Record the call frequency of shared data, set a call frequency threshold, and recycle shared data whose call frequency is lower than the call frequency threshold.

[0026] Step S1 also includes: Step S1-1: The underwater visual large model is an artificial intelligence model designed for the underwater environment. It is used to acquire and process raw image data. The raw image data is preprocessed to obtain processed image data. The preprocessing includes using a low-pass filter to reduce noise in the raw image data and normalizing it. The original image data is a pixel value matrix converted from the light signals directly acquired by the underwater visual large model; The low-pass filtering method is a signal processing method used to handle scattering from suspended particles in water and interference from electronic components of equipment. The normalization process involves subtracting the minimum value of each element in the pixel value matrix from the minimum value of the elements in the matrix, and then dividing by the difference between the maximum and minimum values ​​of the elements in the matrix, thus mapping the element to the interval [0, 1]. Step S1-2: Construct a convolutional neural network consisting of convolutional layers, pooling layers, and fully connected layers; extract the basic visual features of the processed image data through the convolutional neural network; the basic visual features include edge features, texture features, and color features. The edge features are a set of pixel-level edge points representing the outline of an object in the image; The texture feature is a statistical histogram generated by the local binary mode of objects in the image. The local binary mode is to take a certain pixel point in the image as the center, obtain the value of the center pixel, compare the value of the pixel in its neighborhood with the value of the center pixel, and generate a binary code. This code corresponds to a texture feature value. The texture feature value of the image is divided into Q intervals from small to large, that is, the histogram has Q groups, and the frequency of each group is the number of times the feature value falls in that interval. The color feature is the color moment of the object in the image, and the color moment includes the mean, variance and third moment of the color distribution of the image.

[0027] Step S2 also includes: Step S2-1: Divide the processed image data into M intervals by row and N intervals by column, divide the image data into M×N sub-blocks, and obtain the basic visual features of the M×N sub-blocks. Step S2-2: Construct a deep neural network consisting of an input layer, a hidden layer, and an output layer. The hidden layer extracts feature information by performing sliding window operations on the input sub-blocks through convolution kernels, downsamples the sub-blocks, and maps the feature information into a high-dimensional feature vector.

[0028] The feature information includes the shape, material, and structural features of the object within the sub-block; the shape features include the perimeter, area, aspect ratio, and roundness of the object's outline; the material features include the surface roughness, reflectivity, and gloss of the object; the structural features include the connection method, relative position, and symmetry of the object's parts, and the structural features are assigned values ​​and quantized; the shape, material, and structural features are sequentially concatenated into a high-dimensional vector F = [f1, f2, ..., f d Where f represents feature information, d represents the number of types of feature information, and f d This represents the d-th type of feature information.

[0029] Step S3 also includes: Step S3-1: The position of each sub-block is determined by its row index i and column index j, where i∈[1,M] and j∈[1,N]; establish a two-dimensional coordinate ID=(i,j) as the spatial location identifier of the sub-block; Step S3-2: Use the spatial location identifier of the sub-block as the key and the high-dimensional feature vector corresponding to the sub-block as the value to form key-value pairs (ID, F); Step S3-3: Construct a sub-block feature database using a hash table structure, and establish a one-dimensional index index = (i-1) × N + j, where index represents a one-dimensional index and N represents the number of intervals in the processed image data divided by columns; the hash function is h(index) = index mod C, where h represents the hash function, mod represents the modulo operation, and C represents the capacity of the hash table; store the key-value pairs and corresponding high-dimensional feature vectors of each sub-block in the sub-block feature database according to the hash table, and at the same time store the basic visual features corresponding to each sub-block in the sub-block feature database.

[0030] Step S4 also includes: Step S4-1: Perform pairwise comparisons of high-dimensional feature vectors in the sub-block feature database using the cosine similarity algorithm and Euclidean distance calculation method.

[0031] A and B represent two types of sub-blocks, respectively. and represents the high-dimensional feature vectors of sub-blocks A and B respectively, · represents the dot product operation between vectors, and Sim represents the cosine similarity between the high-dimensional feature vectors of the two sub-blocks A and B;

[0032] Where Dist represents the Euclidean distance between the two types of sub-blocks A and B, n represents the dimension of the high-dimensional feature vectors corresponding to the two types of sub-blocks A and B, and i represents the i-th dimension; Step S4-2: Calculate the weighted similarity S of the high-dimensional feature vectors between sub-block A and sub-block B. A,B :

[0033] Where S A,B represents the weighted similarity of the high-dimensional feature vectors between sub-block A and sub-block B, Sim represents the cosine similarity of the high-dimensional feature vectors between sub-block A and sub-block B, Dist represents the Euclidean distance between sub-block A and sub-block B, and w1 and w2 are the weights, satisfying w1+w2=1; Set a similarity threshold. When the weighted similarity is greater than or equal to the similarity threshold, sub-block A and sub-block B are determined to be similar. Step S4-3: Create a set of similar sub-blocks based on the similar sub-block sets, and create a library of similar sub-block sets K=[K1, K2, ..., K2] based on the similar sub-block sets. u ], where K represents the library of similar sub-block sets, u represents the number of similar sub-block sets, K u Represents the set of the u-th similar sub-blocks; Step S4-4: For each set of similar sub-blocks, retain the key-value data and basic visual features of one sub-block as the shared data of that set of similar sub-blocks; establish a shared storage index table, which contains the shared data corresponding to the set of similar sub-blocks.

[0034] Step S5 also includes: Step S5-1: Compare the edge features of the current sub-block with the edge features in the shared data corresponding to each similar sub-block set in the shared storage index table: Use Hough transform to detect straight and curved edge features, and calculate the Hausdorff distance D between the current sub-block and the pixel-level edge point set of each shared data. H :

[0035] Where D H Let A0 represent the pixel-level edge point set of the current sub-block and each shared data set, and B0 represent the pixel-level edge point set of the shared data B. H(A0, B0) represents the Hausdorff distance between the pixel-level edge point set of the current sub-block and the pixel-level edge point set of the shared data B, a represents any point in the pixel-level edge point set of the current sub-block, b represents any point in the pixel-level edge point set of the shared data B, d(a, b) represents the Euclidean distance between points a and b, max represents taking the maximum value, and min represents taking the minimum value. Set the Hausdorff distance threshold T H Keep D H ≤T H Shared data was used as preliminary candidate shared data; Step S5-2: Calculate the chi-square distance between the statistical histogram of the current processing sub-block and the statistical histogram corresponding to the preliminary candidate shared data. :

[0036] in A represents the chi-square distance between the statistical histogram of the current processing sub-block and the statistical histogram corresponding to the preliminary candidate shared data. r B is a statistical histogram representing the current sub-block being processed. r This is a statistical histogram representing shared data B from the preliminary candidate shared data. The chi-square distance between the statistical histogram of the current processing sub-block and the statistical histogram corresponding to shared data B in the preliminary candidate shared data; Q represents the number of groups in the statistical histogram, q represents the q-th group, A q B represents the frequency of the q-th group in the statistical histogram of the currently processed sub-block. q The frequency of the qth group in the statistical histogram corresponding to shared data B in the preliminary candidate shared data; Set chi-square distance threshold ,reserve ≤ Shared data is used as secondary candidate shared data; Step S5-3: Calculate the color moments of the current processed sub-block in the RGB channels, obtain the color moments of the sub-blocks in the secondary candidate shared data in the RGB channels, and use Euclidean distance to calculate the similarity D between the color moments of the current processed sub-block and the color moments of the sub-blocks in the secondary candidate shared data. CM :

[0037] Where D CM The color moment of the currently processed sub-block is represented by the color moment of the sub-block in the secondary candidate shared data, where c represents the color channel (RGB, three channels), m represents the order, and A represents the color depth. c,m B represents the m-th order color moment on the c-th color channel of the currently processed sub-block. c,mThis represents the m-th color moment on the c-th color channel of shared data B in the secondary candidate shared data; Set distance threshold T CM Keep D CM ≤T CM The secondary candidate shared data is the required shared data, and the required shared data is called; when the required shared data is not unique, D is called. CM The lowest value of the required shared data; Step S5-4: When D does not exist H ≤T H or ≤ Or D CM ≤T CM When sharing data, key-value data and basic visual features are directly retrieved from the sub-block feature database.

[0038] Step S6 also includes: Step S6-1: Set a frequency counter to record the calling frequency of each type of shared data; whenever shared data is called as required shared data, the value of its corresponding frequency counter is incremented by 1; Step S6-2: Set the call frequency threshold and judgment period. At the end of each judgment period, the shared data whose value of the frequency counter is lower than the call frequency threshold is recycled. After the recycling process is completed, the next judgment period begins. Step S6-3: At the end of each recycling process, read the average value P of the frequency counters for all shared data in that cycle, and adjust the call frequency threshold to T. d =α×P; where T d α represents the call frequency threshold, and α represents the adjustment coefficient.

[0039] When a judgment cycle ends, shared data whose frequency counter value is lower than the call frequency threshold is marked as unprocessed shared data, and the number of times the shared data is marked as unprocessed shared data is recorded as the marking count; a marking threshold is set, and shared data whose marking count is higher than the marking threshold and the similar set corresponding to the shared data are deleted from the shared storage index table.

[0040] For example: 512×512 pixel underwater RGB images were acquired by an underwater visual large model. A 3×3 Gaussian filter (standard deviation σ=1.0) was used to reduce noise in the images and reduce interference from suspended particles in the water. Then, normalization is performed to map the pixel values ​​to the [0,1] interval: If a pixel has a value of 128, the minimum value of the pixel matrix is ​​0, and the maximum value is 255, then the normalized value is (128-0) / (255-0)≈0.501.

[0041] Configure a convolutional neural network: The network structure consists of two convolutional layers (3×3 convolutional kernels, stride 1), one max pooling layer (2×2 window), and one fully connected layer.

[0042] Edge features: Pixel-level edge point sets are extracted using the Canny operator, for example, 100 edge points are extracted from a certain sub-block.

[0043] Texture features: LBP (Local Binary Pattern) is used with a neighborhood size of 3×3 to generate statistical histograms. Assuming Q=16, the texture feature values ​​are divided into 16 intervals. For example, the frequency distribution of the histogram of a certain sub-block is [5,8,12,...,3].

[0044] Color characteristics: Calculate the mean, variance, and third moment of the RGB three channels. For example, the mean of the R channel is 100, the variance is 20, and the third moment is 50.

[0045] The processed image is divided into M=16 intervals by rows and N=16 intervals by columns, resulting in 16×16=256 sub-blocks, each sub-block being 32×32 pixels in size.

[0046] Configuring a deep neural network: The network structure consists of an input layer (32×32×3), two hidden layers (3×3 convolutional kernels with 64 and 128 channels respectively), and an output layer (1024-dimensional high-dimensional vector).

[0047] Shape characteristics: A sub-block contains a circular object with a perimeter of 100 pixels, an area of ​​600 pixels², an aspect ratio of 1.0, and a circularity of 0.8 (the closer to 1, the more rounded).

[0048] Material characteristics: Surface roughness = 0.6 (0-1 quantization), reflectivity = 0.3, gloss = 0.4.

[0049] Structural features: The object's symmetry is assigned a value of 0.9 (quantization range 0-1), and the relative position coordinates of each part are normalized to [0.2, 0.3, 0.5].

[0050] High-dimensional vector concatenation: The above features are concatenated into F=[f1,f2,...], where the first 4 dimensions are shape features, the next 3 dimensions are material features, and the subsequent dimensions are assigned and quantized structural features.

[0051] Spatial location identifier: For example, a sub-block is located in row i=5, column j=10, and has two-dimensional coordinates ID=(5,10).

[0052] One-dimensional index calculation: index = (5-1) × 16 + 10 = 74.

[0053] Hash table storage: The hash table capacity is C=512, and the hash function is h(74)=74mod512=74.

[0054] Store key-value pairs (ID=(5,10),F) and associate them with basic visual features (such as edge point sets, histograms, color moments).

[0055] Similarity calculation: Cosine similarity: The dot product of the high-dimensional vectors of sub-blocks A and B, divided by the product of their moduli, yields Sim=0.85.

[0056] Euclidean distance: For example, if the vector dimension n=1024, Dist=20.0 is calculated.

[0057] Weighted similarity: w1=0.6, w2=0.4, S A,B =0.6×(1 / (1+0.85))+0.4×(1(1+20.0))≈0.3432 Similarity threshold: set to 0.3. Since 0.3432 ≥ 0.3, A and B are considered similar.

[0058] A set of similar sub-blocks contains 10 sub-blocks. The sub-block with ID=(3,5) is retained as shared data, and its high-dimensional vector and basic features are stored in a shared storage index table.

[0059] Shared data access: Edge feature comparison: The Hough transform is used to detect the edges of the current sub-block, and the Hausdorff distance D is calculated with the edge point set of shared data B. H =8; Hausdorff distance threshold T H =10, since 8≤10, B becomes the preliminary candidate.

[0060] Texture feature comparison: Calculate the chi-square distance between the current sub-block histogram and B. =4.5; Chi-square distance threshold Let's set it to 5. Since 4.5 ≤ 5, B becomes a secondary candidate.

[0061] Color feature comparison: Calculate the Euclidean distance D of the RGB three-channel color moments. CM =0.4; Distance threshold T CM =0.5, since 0.4≤0.5, B is used as shared data.

[0062] Special case: If all shared data DCM If the value is greater than 0.5, the original data is retrieved directly from the sub-block feature database.

[0063] Call frequency record: Assuming a judgment period of 100 calls and an initial frequency threshold T d =10.

[0064] A certain shared data was accessed 8 times within a period, which is less than the threshold, so it is marked as pending processing.

[0065] Threshold dynamic adjustment: At the end of the cycle, the average frequency of all shared data accesses, P=15, the adjustment factor α=0.6, and the new threshold T. d =0.6×15=9.

[0066] Recycling and disposal: If a shared data is marked for 3 consecutive periods (marking count = 3, marking threshold = 2), then the shared data and its corresponding similar set are deleted from the index table.

[0067] 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 implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

Claims

1. A KVcache-optimized underwater vision large model compression method, characterized in that: The method includes the following steps: Step S1: Obtain raw image data through an underwater visual large model; preprocess the raw image data to obtain processed image data; extract the basic visual features of the processed image data through a convolutional neural network. Step S2: Divide the processed image data into fixed-size sub-blocks using a regular grid partitioning method, and obtain the basic visual features corresponding to the sub-blocks; extract the feature information of each sub-block through a deep neural network to form a high-dimensional feature vector; Step S3: Obtain the spatial location identifier of the sub-block. Use the spatial location identifier of the sub-block as the key and the high-dimensional feature vector corresponding to the sub-block as the value to obtain the key-value pair of the sub-block. Construct a sub-block feature database based on the key-value pair to store the high-dimensional feature vector and the corresponding basic visual features of each sub-block. Step S4: Perform pairwise comparisons of the high-dimensional feature vectors in the sub-block feature database to determine whether the sub-blocks are similar; establish a set of similar sub-blocks, and retain the key-value data and basic visual features of one sub-block in the set of similar sub-blocks as shared data; establish a shared storage index table; Step S5: The underwater visual large model retrieves shared data from the shared storage index table based on the basic visual features of the current processing sub-block; Step S6: Record the call frequency of shared data, set a call frequency threshold, and recycle shared data whose call frequency is lower than the call frequency threshold.

2. The KVcache-optimized underwater vision large model compression method according to claim 1, characterized in that: Step S1 further includes: Step S1-1: The underwater visual large model is an artificial intelligence model designed for the underwater environment. It is used to acquire and process raw image data. The raw image data is preprocessed to obtain processed image data. The preprocessing includes using a low-pass filter to reduce noise in the raw image data and normalizing it. Step S1-2: Construct a convolutional neural network consisting of convolutional layers, pooling layers, and fully connected layers; extract the basic visual features of the processed image data through the convolutional neural network; the basic visual features include edge features, texture features, and color features. The edge features are a set of pixel-level edge points representing the outline of an object in the image; The texture feature is a statistical histogram generated by the local binary pattern of objects in the image. The local binary pattern is generated by taking a certain pixel in the image as the center, obtaining the value of the center pixel, comparing the value of the pixel in its neighborhood with the value of the center pixel, and generating a binary code. The binary code corresponds to a texture feature value. The texture feature values ​​of the image are divided into Q intervals from small to large. That is, the statistical histogram has Q groups, and the frequency of each group is the number of times the feature value falls in that interval. The color feature is the color moment of the object in the image, and the color moment includes the mean, variance and third moment of the color distribution of the image.

3. The KVcache-optimized underwater vision large model compression method according to claim 1, characterized in that: Step S2 further includes: Step S2-1: Divide the processed image data into M intervals by row and N intervals by column, divide the image data into M×N sub-blocks, and obtain the basic visual features of the M×N sub-blocks. Step S2-2: Construct a deep neural network consisting of an input layer, a hidden layer, and an output layer. The hidden layer extracts feature information by performing sliding window operations on the input sub-blocks through convolution kernels, downsamples the sub-blocks, and maps the feature information into a high-dimensional feature vector.

4. The KVcache-optimized underwater vision large model compression method according to claim 4, characterized in that: Step S2 further includes: The feature information includes the shape, material, and structural features of the object within the sub-block; the shape features include the perimeter, area, aspect ratio, and roundness of the object's outline; the material features include the surface roughness, reflectivity, and gloss of the object; the structural features include the connection method, relative position, and symmetry of the object's parts, and the structural features are assigned values ​​and quantized; the shape, material, and structural features are sequentially concatenated into a high-dimensional vector F = [f1, f2, ..., f d Where f represents feature information, d represents the number of types of feature information, and f d This represents the d-th type of feature information.

5. The KVcache-optimized underwater vision large model compression method according to claim 1, characterized in that: Step S3 further includes: Step S3-1: The position of each sub-block is determined by its row index i and column index j, where i∈[1,M] and j∈[1,N]; establish a two-dimensional coordinate ID=(i,j) as the spatial location identifier of the sub-block; Step S3-2: Use the spatial location identifier of the sub-block as the key and the high-dimensional feature vector corresponding to the sub-block as the value to form key-value pairs (ID, F); Step S3-3: Construct a sub-block feature database using a hash table structure, and establish a one-dimensional index index = (i-1) × N + j, where index represents a one-dimensional index and N represents the number of intervals in the processed image data divided by columns; the hash function is h(index) = index mod C, where h represents the hash function, mod represents the modulo operation, and C represents the capacity of the hash table; store the key-value pairs and corresponding high-dimensional feature vectors of each sub-block in the sub-block feature database according to the hash table, and at the same time store the basic visual features corresponding to each sub-block in the sub-block feature database.

6. The KVcache-optimized underwater vision large model compression method according to claim 1, characterized in that: Step S4 further includes: Step S4-1: Perform pairwise comparisons of high-dimensional feature vectors in the sub-block feature database using the cosine similarity algorithm and Euclidean distance calculation method. ; A and B represent two types of sub-blocks, respectively. and represents the high-dimensional feature vectors of sub-blocks A and B respectively, · represents the dot product operation between vectors, and Sim represents the cosine similarity between the high-dimensional feature vectors of the two sub-blocks A and B; ; Where Dist represents the Euclidean distance between the two sub-blocks A and B, n represents the dimension of the high-dimensional feature vectors corresponding to the two sub-blocks A and B, and i represents the i-th dimension; Step S4-2: Calculate the weighted similarity S of the high-dimensional feature vectors between sub-block A and sub-block B. A,B : ; Where S A,B represents the weighted similarity of the high-dimensional feature vectors between sub-block A and sub-block B, Sim represents the cosine similarity of the high-dimensional feature vectors between sub-block A and sub-block B, Dist represents the Euclidean distance between sub-block A and sub-block B, and w1 and w2 are the weights, satisfying w1+w2=1; Set a similarity threshold. When the weighted similarity is greater than or equal to the similarity threshold, sub-block A and sub-block B are determined to be similar. Step S4-3: Create a set of similar sub-blocks based on the similar sub-block sets, and create a library of similar sub-block sets K=[K1, K2, ..., K2] based on the similar sub-block sets. u ], where K represents the library of similar sub-block sets, u represents the number of similar sub-block sets, K u Represents the set of the u-th similar sub-blocks; Step S4-4: For each set of similar sub-blocks, retain the key-value data and basic visual features of one sub-block as the shared data of that set of similar sub-blocks; establish a shared storage index table, which contains the shared data corresponding to the set of similar sub-blocks.

7. The KVcache-optimized underwater vision large model compression method according to claim 1, characterized in that: Step S5 further includes: Step S5-1: Compare the edge features of the current sub-block with the edge features in the shared data corresponding to each similar sub-block set in the shared storage index table: Use Hough transform to detect straight and curved edge features, and calculate the Hausdorff distance D between the current sub-block and the pixel-level edge point set of each shared data. H Set the Hausdorff distance threshold T H Keep D H ≤T H Shared data was used as preliminary candidate shared data; Step S5-2: Calculate the chi-square distance between the statistical histogram of the current processing sub-block and the statistical histogram corresponding to the preliminary candidate shared data. Set the chi-square distance threshold ,reserve ≤ Shared data is used as secondary candidate shared data; Step S5-3: Calculate the color moments of the current processed sub-block in the RGB channels, obtain the color moments of the sub-blocks in the secondary candidate shared data in the RGB channels, and use Euclidean distance to calculate the similarity D between the color moments of the current processed sub-block and the color moments of the sub-blocks in the secondary candidate shared data. CM C represents the channel, M represents the color moment; set the distance threshold T. CM Keep D CM ≤T CM The secondary candidate shared data is the required shared data, and the required shared data is called; when the required shared data is not unique, D is called. CM The lowest value of the required shared data; Step S5-4: When D does not exist H ≤T H or ≤ Or D CM ≤T CM When sharing data, key-value data and basic visual features are directly retrieved from the sub-block feature database.

8. The KVcache-optimized underwater vision large model compression method according to claim 1, characterized in that: Step S6 further includes: Step S6-1: Set a frequency counter to record the calling frequency of each type of shared data; whenever shared data is called as required shared data, the value of its corresponding frequency counter is incremented by 1; Step S6-2: Set the call frequency threshold and judgment period. At the end of each judgment period, the shared data whose value of the frequency counter is lower than the call frequency threshold is recycled. After the recycling process is completed, the next judgment period begins. Step S6-3: At the end of each recycling process, read the average value P of the frequency counters for all shared data in that cycle, and adjust the call frequency threshold to T. d =α×P; where T d α represents the call frequency threshold, and α represents the adjustment coefficient.

9. The KVcache-optimized underwater vision large model compression method according to claim 8, characterized in that: The recycling process includes: When a judgment cycle ends, shared data whose frequency counter value is lower than the call frequency threshold is marked as unprocessed shared data, and the number of times the shared data is marked as unprocessed shared data is recorded as the marking count; a marking threshold is set, and shared data whose marking count is higher than the marking threshold and the similar set corresponding to the shared data are deleted from the shared storage index table.