A method for automatically identifying floating objects

By using annealing-based filters and kernel PCA algorithms for image preprocessing, combined with convolutional neural networks and metric learning algorithms, the problem of low accuracy in traditional floating object recognition is solved, and efficient floating object recognition in complex water environments is achieved.

CN118747821BActive Publication Date: 2025-09-05北京长河数智科技有限责任公司 +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410911933.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-09
Publication Date
2025-09-05
Estimated Expiration
2044-07-09

AI Technical Summary

Technical Problem

The existing technology has low accuracy in identifying floating objects, which makes it difficult to meet the needs of rapid and accurate identification of water pollution, and traditional methods are not competent in complex water environments.

Method used

A filter based on the annealing algorithm is used for denoising, combined with the kernel PCA algorithm for dimensionality reduction, a pre-trained convolutional neural network is used to extract image features, and classification is performed through the metric learning algorithm and clustering algorithm.

Benefits of technology

The accuracy and real-time performance of floating object identification are improved, and it can quickly adapt to the identification of unknown floating objects in complex water environments, meeting the needs of fast and accurate water pollution monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747821B_ABST
    Figure CN118747821B_ABST
Patent Text Reader

Abstract

This application discloses a method for automatically identifying floating objects, which relates to the field of image recognition technology. The method comprises: collecting a water image dataset containing floating objects; preprocessing the collected image dataset, wherein the preprocessing comprises: denoising the image using a filter based on an annealing algorithm; performing dimensionality reduction on the denoised image dataset using a kernel PCA algorithm; extracting image features from the preprocessed image dataset using a pretrained convolutional neural network; extracting a feature metric space based on the image features using a metric learning algorithm; and classifying floating objects based on the feature metric space using a clustering algorithm. To address the low floating object recognition accuracy problem in the prior art, the present application employs a wavelet transform algorithm to reduce noise in the image, utilizes a kernel PCA algorithm to reduce the image dimensionality, employs a structural metric learning method to learn the metric distance between samples in the feature space, and performs classification using a density-based DBSCAN clustering algorithm, thereby improving recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition technology, and in particular to a method for automatically identifying floating objects. Background Art

[0002] With rapid socioeconomic development and accelerating industrialization and urbanization, water pollution is becoming increasingly prominent. Industrial emissions, agricultural waste, and the direct discharge of municipal solid waste are leading to an increasing variety and quantity of floating debris in water bodies. This debris includes not only visible waste like plastic and paper, but also tiny, imperceptible pollutants like microplastics and oil films. These have a serious impact on the aquatic ecosystem and biodiversity, posing a threat to human health and quality of life.

[0003] To effectively investigate and control water pollution, it's essential to be able to quickly and accurately identify different types of floating debris in the water, enabling timely implementation of appropriate control measures. However, traditional floating debris identification technologies rely primarily on manual observation and hand-crafted feature extraction methods, resulting in low accuracy and poor real-time performance. These traditional methods often struggle in complex water environments, failing to meet the demand for rapid and accurate identification of water pollution.

[0004] In related technologies, for example, Chinese patent document CN112784729A provides a method for automatically identifying floating objects in water bodies. The method includes the following steps: constructing a feature database of different characteristic data representing different types of floating objects; capturing images of the water body to be monitored at intervals to obtain raw water images, and storing the image data in a distributed database; preprocessing the raw water images, identifying the raw water color, comparing them with normal water images, and extracting images containing floating objects; accurately segmenting and extracting the images containing floating objects, and performing feature segmentation on the segmented and extracted floating object images. However, this solution, which performs feature segmentation after image segmentation, may destroy the complete feature information of floating objects, resulting in incomplete features, and thus the accuracy of floating object identification needs to be further improved. Summary of the Invention

[0005] 1. Technical problems to be solved

[0006] In response to the problem of low floating object recognition accuracy in the existing technology, the present application provides a floating object automatic recognition method, which improves the recognition accuracy by denoising and dimensionality reduction of images and combining neural networks.

[0007] 2. Technical solution

[0008] The purpose of this application is achieved through the following technical solutions.

[0009] The embodiments of this specification provide a method for automatically identifying floating objects, comprising: collecting a water image dataset containing floating objects; preprocessing the collected image dataset, wherein the preprocessing comprises: denoising the image using a filter based on an annealing algorithm; performing dimensionality reduction on the denoised image dataset using a kernel PCA algorithm; extracting image features from the preprocessed image dataset using a pretrained convolutional neural network; extracting a feature metric space based on the image features using a metric learning algorithm; and classifying the floating objects using a clustering algorithm based on the feature metric space.

[0010] Specifically, floating debris refers to various floating materials present on the surface of or in water bodies. It generally refers to various waste or natural materials floating on the water surface or in the water body. These mainly include: Plastic waste: man-made floating objects such as plastic bottles, plastic bags, and foam plastics. Natural plants: floating objects found in nature such as leaves, branches, and aquatic plants. Accidental waste: various floating objects that enter the water body due to accidents, such as oil spills and chemical waste liquids. Plankton: such as cyanobacteria and various phytoplankton and zooplankton. By identifying different types of floating objects in the water body, it is possible to monitor water pollution, accidental discharges, and other situations, and protect the aquatic environment.

[0011] Specifically, when collecting a dataset of water images containing floating objects, water images can include the following categories: River water images: including images of river water bodies such as main rivers, tributaries, and artificial waterways. Lake water images: including images of still water bodies such as natural lakes, reservoirs, and artificial lakes. Ocean water images: including images of open water bodies such as offshore, nearshore, and deep sea. Water images of various water treatment facilities: including images of artificial facilities that treat water bodies, such as tap water treatment plants, sewage treatment plants, and drainage ditches. Water images of different seasons and times: including images of water bodies taken in different seasons, at different times, and under different weather conditions. Water images containing various common floating objects: such as images of floating objects such as plastic, wood, foam, and vegetation. Water images with different lighting and water flow rates: lighting and water flow can affect the visual effects of images. Water images of different resolutions and scales: including images of water bodies of different resolutions taken at macro, close-up, and long distances.

[0012] Among them, filters are a technique for eliminating image noise. Annealing-based filters refer to a type of filter that utilizes the concept of a simulated annealing process to iteratively optimize filter parameters to eliminate image noise. In this application, annealing-based filters are used to remove noise from water images, improving the accuracy of subsequent processing. By tuning the filter parameters through a simulated annealing process, different types of noise can be effectively eliminated. Specifically, annealing-based filters can include: wavelet-domain annealing filters, which introduce the annealing algorithm into the wavelet domain, select appropriate filters and thresholds based on the signal-to-noise ratio after the wavelet transform, and achieve denoising through iterative optimization through a simulated annealing process. Sine-based annealing filters, which construct a sinusoidal annealing function with oscillatory attenuation characteristics as an improved filter function and introduce it into the spatial or frequency domain for filtering. Adaptive annealing filters, which utilize local statistical information to adjust the filter window shape and annealing curve to achieve adaptive denoising. Dictionary-learning-based annealing filters, which utilize dictionary learning methods to train a denoising dictionary and combine them with an annealing algorithm to optimize filter coefficients to achieve adaptive denoising. A filter based on tight beam search combines simulated annealing with the tight beam search algorithm to rapidly optimize filter parameters through local search. A deep learning-based annealing filter uses convolutional neural networks to learn prior knowledge about image denoising, supplemented by an annealing algorithm for detailed optimization.

[0013] Among them, kernel PCA is an extended algorithm of principal component analysis (PCA). It uses the kernel technique to map the input samples to a high-dimensional feature space and calculate PCA in this space rather than the original space. This enables it to reduce the dimensionality of nonlinear data. In this application, kernel PCA is used to reduce the dimensionality of the denoised image. By nonlinear mapping and calculating PCA in a high-dimensional space, data redundancy can be effectively reduced and processing efficiency can be improved. The filter based on the annealing algorithm can effectively remove noise, and kernel PCA can achieve nonlinear dimensionality reduction. The introduction of both can improve the performance of the floating object recognition solution.

[0014] Among them, image features are feature information extracted from an image that can represent the main visual content of the image. Image features are usually vectors or numerical values ​​that are obtained through mathematical transformation and can describe visual information such as image details, texture, and shape. In this application, a pre-trained convolutional neural network is used to extract features from the preprocessed image. The image features here refer to the vector expressions that can depict the image content obtained by using a convolutional neural network to perform layer-by-layer abstract extraction on the input image. By extracting the semantic features of the image through operations such as convolution and pooling, a more abstract and distinguishable feature expression can be obtained than directly using pixel information. This image semantic feature obtained based on deep learning can better depict the visual differences between different types of floating objects and has a certain degree of robustness. This can improve the effect of subsequent metric learning and classification. Compared with traditional manual features, the features learned using convolutional neural networks are more suitable for this task and can improve the accuracy of floating object recognition.

[0015] Among them, metric learning algorithms are a type of machine learning method used to learn distance metrics or similarity metrics between samples, resulting in a metric space that accurately reflects the relationships between samples. A feature metric space is a new feature space obtained through metric learning. Within this space, the distances between different samples accurately reflect their degree of similarity. In this application, a metric learning algorithm is used to learn similarity metrics between samples in the feature space based on the semantic features of the image, resulting in a metric space that accurately depicts the relationships between different floating objects. The feature metric space generated by the metric learning algorithm can distinguish different types of floating objects, making similar floating object samples closer together in the new space and dissimilar floating object samples farther apart. This helps improve the effectiveness of subsequent distance-based clustering algorithms.

[0016] Among them, the clustering algorithm is an unsupervised machine learning method that can automatically group samples into multiple classes or clusters based on the similarities between data samples. In this application, a clustering algorithm is used based on the feature metric space obtained by metric learning to divide different floating object image samples into different categories or groups. The feature metric space has obtained a feature expression that can characterize the relationship between samples through metric learning. In this space, similar samples are close in distance, and dissimilar samples are far away. Therefore, a clustering algorithm can be used to automatically classify similar samples into the same cluster based on the distance between samples, that is, to perform classification. Using a clustering algorithm, complex and unknown floating objects can be automatically classified according to the distance relationship in the feature space, without the need to manually label a large number of samples. Therefore, this application can quickly adapt to the identification of unknown floating objects in different water environments.

[0017] Furthermore, a filter based on an annealing algorithm is used to denoise the image, including: obtaining a set of collected images; detecting the noise type of the image using a Hilbert cycle wavelet transform algorithm; generating a cosine annealing curve using a wavelet transform method according to the detected noise type; filtering the image using the cosine annealing curve to output a denoised image; determining whether the peak signal-to-noise ratio of the denoised image is greater than a threshold, and if not, adjusting the parameters of the cosine annealing curve using an annealing iterative algorithm until the peak signal-to-noise ratio of the denoised image is greater than the threshold.

[0018] Among them, the Hilbert cyclic wavelet transform is a time-frequency analysis method. It uses the Hilbert transform and cyclic wavelet transform to provide the time-frequency information of the signal. Image noise types generally include Gaussian noise, salt and pepper noise, random noise, etc. Different types of noise have different energy distribution characteristics in the time-frequency plane. In this application, this algorithm is used to perform multi-scale time-frequency decomposition of the image and detect the type of noise in the image based on the time-frequency information. It can provide the energy distribution and characteristics of the noise signal in the time-frequency plane. It is necessary to identify the type of noise in the image in order to design a suitable denoising algorithm. By distinguishing the noise type through time-frequency analysis, the noise in the image can be removed in a targeted manner. The Hilbert cyclic wavelet transform can provide the time-frequency characteristics of the noise signal, which is used to identify the noise type in the image to guide the subsequent denoising process.

[0019] Among them, wavelet transform is a time-frequency analysis method that can capture the time domain and frequency domain information of the signal. Wavelet transform has a variety of basis functions, and can approximate various signals by linear superposition of basis functions. The cosine annealing curve refers to an annealing optimization curve constructed in the form of a cosine function. It has a smooth annealing process. In this application, according to the type of noise detected, a suitable wavelet basis function is selected, and a cosine annealing curve is generated by superimposing basis functions of different scales and time shifts. The cosine annealing curve is used as an improved function of the filter and loaded into the filter for denoising. Constructing a suitable cosine annealing curve according to the noise type can guide the filter to eliminate noise in a targeted manner. Wavelet transform generates targeted cosine annealing curves to guide the filter to remove specific types of noise, thereby improving the denoising effect.

[0020] Specifically, using the cosine annealing curve to denoise an image includes: performing a wavelet transform on the input image to be denoised to obtain wavelet coefficients containing different frequency subbands. Based on a pre-set cosine annealing curve, a cosine WINDOW function is constructed. This WINDOW function has a smoothly decaying cosine form. The constructed cosine WINDOW function is multiplied point by point with the wavelet coefficients of each frequency subband. This can smoothly suppress noise signals while retaining useful information. After the multiplication, the wavelet coefficients of each frequency subband are inversely transformed and reconstructed into an image. The peak signal-to-noise ratio of the reconstructed image is calculated to determine the denoising effect. If unsatisfactory, the cosine WINDOW function is adjusted, and the process is repeated until the peak signal-to-noise ratio reaches the threshold requirement, and the currently reconstructed denoised image is output. The cosine annealing curve is used to selectively suppress noise signals while retaining useful information, thereby achieving the purpose of removing noise. The parameters of the cosine curve can also be adjusted to achieve adaptive denoising.

[0021] Among them, the peak signal-to-noise ratio (PSNR) is an objective image quality evaluation indicator, which compares the image before and after denoising to indicate the effect of the denoising result. The higher the PSNR, the better the denoising effect. The annealing iterative algorithm is a global optimization method that gradually approaches the optimal solution by simulating the annealing process of matter. In each iteration, a slightly worsened solution is accepted in an attempt to escape the local optimum. In this application, PSNR is used to judge the quality of the filtered image. If the threshold requirement is not met, the denoising process needs to be further optimized. If the PSNR is not met, the annealing iterative algorithm is used to adjust the parameters of the cosine annealing curve, and the filtering is performed again until a satisfactory denoising effect is obtained. The PSNR evaluation guides the optimization direction, and the annealing iterative algorithm realizes adaptive parameter adjustment, which together improves the denoising effect.

[0022] Furthermore, the Hilbert cycle wavelet transform algorithm is used to detect the noise type of the image, including: inputting the collected image set, using the Hilbert cycle wavelet transform algorithm to perform multi-scale time-frequency decomposition, and obtaining a complex wavelet coefficient matrix containing time-frequency information as the time-frequency plane; according to the complex wavelet coefficient matrix, calculating the signal energy of each point on the time-frequency plane, and obtaining a two-dimensional energy distribution map of the noise signal distributed on the time-frequency plane; on the two-dimensional energy distribution map, using the Otsu threshold algorithm to slide and collect the image texture features of the noise signal; according to the preset noise template, using the Euclidean distance to calculate the distance between the extracted image texture features and the template as the feature distance; using the minimum distance discrimination method to match the nearest template, and outputting the corresponding noise type.

[0023] Among them, multi-scale time-frequency decomposition refers to using basis functions of different scales to perform wavelet transform on the signal to obtain time domain information corresponding to different frequency components. After the wavelet transform, the wavelet coefficients of different scales and at different times can be organized into a two-dimensional matrix. Because the transformation uses complex operations, it is a complex matrix. The time-frequency plane is a two-dimensional graph that represents the time-frequency distribution, which can intuitively display the distribution of the signal in time and frequency. In this application, the Hilbert cycle wavelet transform is used to perform multi-scale time-frequency decomposition on the image to obtain time-frequency information at different scales. Each element in the matrix represents the wavelet coefficient at each time and each scale. It reflects the time-frequency characteristics of the noise signal. The wavelet coefficients in the matrix determine the distribution of the noise signal on the time-frequency plane and are used to analyze the noise type.

[0024] Among them, signal energy refers to the power of the signal, which reflects the signal strength. For the signal after time-frequency decomposition, its energy is usually represented by the power spectrum of the signal. The two-dimensional energy distribution diagram refers to a two-dimensional image that visualizes the signal energy of each point on the time-frequency plane. In this application, it is necessary to calculate the energy of the signal at each point on the time-frequency plane to reflect the intensity of the noise signal at that moment and in that frequency band. Draw the distribution of the energy of the noise signal on the entire time-frequency plane. Different types of noise have different characteristics in their energy distribution. Through the two-dimensional energy distribution diagram, the time-frequency structure of the noise signal can be intuitively analyzed, the noise type can be identified, and a suitable denoising scheme can be designed.

[0025] Specifically, the image is decomposed by wavelet packet to obtain the wavelet coefficient matrices {C1, C2, ..., C n}. For each subband wavelet coefficient matrix C n Energy calculation: E(C n )=∑|C n (t,f)| 2 . Li|C n (t,f)| is the complex modulus of the wavelet coefficients corresponding to time t and frequency f in the matrix. The energy E(C n ) is mapped to the corresponding area of ​​the time-frequency plane, and the energy distribution diagram is obtained: E(t,f)=E(C n ), if (t,f) belongs to C n The time-frequency region represented by . Performing the above calculations for all subbands yields the energy values ​​E(t,f) for all points on the time-frequency plane. Visualizing the two-dimensional matrix E(t,f) plots the energy distribution of the noise signal on the time-frequency plane. Based on the high and low energy areas on the energy distribution plot, the noise type can be analyzed and identified. In this way, energy calculation based on wavelet decomposition can intuitively determine the energy concentration of the noise signal on the time-frequency plane, assisting in noise type identification.

[0026] Among them, the Otsu threshold algorithm is a method of image segmentation that can automatically calculate the global binarization threshold of the image. It determines the optimal threshold by statistically analyzing the image histogram features. The image texture features reflect the visual appearance of the local area of ​​the image, and usually use adjacent pixel information to describe the statistical characteristics of the image such as roughness and contrast. In this application, the Otsu threshold algorithm is used to slide the calculation threshold on the two-dimensional energy distribution map to extract the texture features of the noise image. The Otsu threshold algorithm can effectively segment the noise image into different texture areas, and then extract the texture features of the noise area for identifying the noise type. The Otsu threshold algorithm can be used to analyze and extract key image texture features from the noise time-frequency energy map to assist in noise type identification.

[0027] Among them, feature distance refers to the distance measure between the feature vector extracted from the input image and the template feature vector. It can be used to judge the similarity between two feature vectors. In this application, Euclidean distance is used to calculate the distance between the extracted image texture features and the preset noise template features, that is, their geometric distance in the feature space. The smaller the feature distance of the noise type template, the higher the similarity between the input noise image and the type of noise. By calculating the feature distances of different noise templates, the noise type that best matches the input noise features can be found. Therefore, feature distance provides a quantitative judgment basis for noise type identification. Using Euclidean distance to calculate feature distance can directly reflect the difference in feature vectors in Euclidean space, thereby realizing the classification and identification of noise types.

[0028] Specifically, the feature distance is calculated and noise type templates are constructed. Each template contains the typical image texture features of a noise. For the input noise image to be identified, the image texture features of the noise area are extracted using the Otsu threshold algorithm to obtain the feature vector F = [f1, f2, ..., f n ] Calculate the input feature F and each template M i The corresponding eigenvector T i Euclidean distance between: Get the distance dist between the input feature F and each template Mi i Compare the distances dist_i of all templates and select the template with the smallest distance: type = argmin(dist i ), where i = 1, 2, ..., m, the template type closest to the input feature F is considered the most likely noise type. The recognition result type is returned as the input noise type. This process systematically calculates the distance between feature vectors, finds the template that best matches the input vector, and completes noise type identification.

[0029] Among them, the minimum distance discrimination method is a pattern recognition method based on distance measurement. It calculates the distance between the sample features and each category template, and assigns the sample to the category to which the template with the closest distance belongs. In this application, for the feature vector F extracted from the input noise image, the Euclidean distance between it and the feature vectors of each type of noise template is calculated. Then, the noise template that minimizes the distance is selected to determine whether the input noise image belongs to the noise type corresponding to this template. That is to say, after calculating the distance between the input feature F and all candidate templates, the minimum distance discrimination method is used to match the template with the smallest distance to achieve the recognition of the noise type. This template matching method based on distance measurement can effectively identify the noise type with the help of preset templates without the need for complex model training.

[0030] Furthermore, according to the noise type detected, a cosine annealing curve is generated by using a wavelet transform method, including: setting a wavelet basis storage template, the wavelet basis storage template containing one of Haar, Db, sym, bior, and coif; inputting the detected noise type, and selecting a wavelet basis matching the noise type in the wavelet basis storage template; setting the scale range of the wavelet basis, and setting the time shift range of the wavelet basis according to a preset step size; and generating a cosine annealing curve by linearly weighted superposition of the selected wavelet basis based on the determined scale range and time shift range.

[0031] Among them, Haar wavelet: the simplest and oldest orthogonal wavelet basis, with block characteristics, suitable for representing signal jumps and mutations. Db wavelet: has the highest number of vanishing moments, suitable for analyzing smooth signals. Sym wavelet: a symmetrical wavelet with linear phase characteristics, suitable for filtering processing. Bior wavelet: an orthogonal asymmetric biorthogonal wavelet with a quadratic scaling relationship, suitable for image compression. Coif wavelet: a symmetrical wave with the highest number of vanishing moments, suitable for signal analysis. By setting different wavelet basis functions, corresponding noise templates can be constructed to match and identify different types of noise.

[0032] Among them, the wavelet basis is the basis function in wavelet analysis, which constitutes a wavelet system through scaling and translation. Different wavelet basis functions have different characteristics. In this application, the wavelet basis function is pre-set as a template to match different types of noise. For example, the Db wavelet is suitable for representing smooth signals and can be used as a template for Gaussian noise; the Haar wavelet is suitable for representing mutation signals and can be used as a template for salt and pepper noise, etc. After inputting the detected noise type, a wavelet basis function that matches the noise type is selected from the template library. In other words, a wavelet basis function that best represents the input noise characteristics will be selected from candidate basis functions such as Haar, Db, Sym, etc. In this way, the selected wavelet basis function becomes the matching template for the current input noise. Subsequent operations such as wavelet transform and construction of denoising filters can be performed based on this template.

[0033] Among them, in wavelet analysis, the scale range determines the number of scale layers for wavelet transform, which corresponds to the frequency band range. The larger the scale range, the richer frequency information can be obtained. The time shift range determines the step size and range of the wavelet basis moving the sample in the time domain. The denser the time shift range, the finer the time domain information can be obtained. In this application, the scale range of the wavelet basis is set to realize multi-scale wavelet decomposition and obtain wavelet coefficients at different scales to match and represent noise signals. The time shift range is related to the sampling frequency, and its preset step size will affect the final time domain sampling resolution. Dense time shift can more accurately match the time domain waveform of the noise. By appropriately setting the scale and time shift range, time-frequency information that meets the target noise type can be obtained for constructing a noise matching template.

[0034] Specifically, setting the scale range and time shift range of the wavelet basis function includes: according to the sampling frequency f of the input signal s , determine the scale range of wavelet transform: scale range [s min ,s max ]. According to experience and knowledge, select the appropriate minimum scale s min The initial setting is 2 to ensure a sufficiently detailed high-frequency analysis. According to the Nyquist theorem, the maximum scale s max Can be set to f s / 2. Divide the scale range into equal-step logarithms with 2 as the base to obtain the scale set {s j}, for example {2, 4, 8, 16, 32}. Set the time shift step length τ of the wavelet transform, which is generally taken as 1 or 2. Calculate the total time shift length of the wavelet transform: time shift length = signal length / τ, divide the above time shift length into equal parts with τ as the step length, and get the time shift range {τ j}. In the scale set {s j} and time shift range {τ j}, a wavelet basis function template is constructed by scaling and translating. Finally, the wavelet basis function is applied to the input signal for matching and noise modeling. By setting a reasonable scale and time shift range based on the input signal, a wavelet basis function that matches the target noise can be constructed for noise modeling and matching.

[0035] Among them, linear weighted superposition refers to superimposing multiple functions according to certain weights. The size of the weight reflects the contribution of each function in the superposition result. In this application, a cosine annealing curve is synthesized by weighted superposition of wavelet basis functions over a determined scale range and time shift range. Specifically, the selected wavelet basis generates corresponding wavelet functions at different scales and time shifts, and then performs weighted superposition. The setting of the weighting coefficient will determine the importance of the wavelet function in the synthetic curve at different scales and time shifts. By linearly weighted superposition of different wavelet components, a smooth cosine annealing curve can be constructed. This curve combines the information of the wavelet basis function in the entire time-frequency range and can be used for subsequent annealing filtering and denoising. Linear weighted superposition can make full use of the information of the wavelet basis function to generate a cosine annealing curve that meets the denoising target.

[0036] Specifically, generating a cosine annealing curve by linear weighted superposition of wavelet basis functions includes: in a certain scale range {s j} and time shift range {τ i}, calculate the wavelet basis function Set the weight W(s) for each scale and time shift wavelet function j ,τ i ), the larger the weight, the greater its contribution to the composite curve. Initialize the composite curve f(t) = 0. Traverse all scales s j and time shift τ i , multiply the wavelet function by the weight and then accumulate: Add a cosine envelope to construct the final annealing curve: y(t) = Acos(ωt) × f(t), where A and ω control the parameters of the cosine envelope. By adjusting the weight W(s j ,τ i ) and the parameters of the cosine envelope can be adaptively generated to produce different annealing optimization curves y(t). These constructed annealing curves are then applied to subsequent image denoising and filtering. This weighted superposition approach fully utilizes the information of the wavelet basis functions across the entire time-frequency range to construct a cosine annealing curve that meets denoising requirements.

[0037] Furthermore, a kernel PCA algorithm is used to perform dimensionality reduction processing on the denoised image set, including: taking the denoised image set as input; mapping the input image set to a high-dimensional kernel feature space H using a radial basis kernel function kernel, and outputting the mapped image set; calculating the covariance matrix C of the mapped image set in the high-dimensional kernel feature space H; performing eigenvalue decomposition on the covariance matrix C, and obtaining eigenvectors corresponding to the first K largest eigenvalues ​​as principal components; using the extracted first K principal components, performing kernel feature projection on the input image set to obtain a low-dimensional representation in the high-dimensional kernel feature space H, and outputting the low-dimensional representation as the image set after dimensionality reduction processing.

[0038] Among them, the radial basis kernel function (RBF kernel) is a popular kernel function that can map data to a high-dimensional feature space through kernel techniques. Its mathematical form is: Where σ is the kernel parameter. A high-dimensional kernel feature space refers to a new feature space mapped using a kernel function, whose dimensionality is typically much higher than the original space. A high-dimensional feature space can make data more separable. In this application, a radial basis kernel function is used to map image data to a high-dimensional kernel feature space H. The high-dimensional space H has a richer feature representation, which is beneficial for distinguishing different types of images. The radial basis kernel function implements the kernel technique, mapping the image to a high-dimensional feature space to assist in subsequent image classification processing.

[0039] Specifically, calculating the covariance matrix C of the mapped image set in the high-dimensional kernel feature space includes: assuming that the image set after being mapped to the high-dimensional feature space H is {x1,x2,.....,x n}, where x i Represents the high-dimensional feature vector of the i-th image. Calculate the Mean value of the mapped sample: Construct the deviation matrix of each sample from the Mean: Calculate the covariance matrix C: here Represents the matrix outerproduct operation. Using the characteristics of the kernel function, the above calculation can be performed on the image matrix in the original space: Among them, K is the kernel matrix, K ij =K(x i ,x j In this way, the covariance matrix C in the high-dimensional feature space is directly calculated using the kernel matrix K. The C matrix contains the feature distribution information of the mapped image set and can be used for subsequent operations such as feature extraction and dimension reduction. Using the kernel technique, the covariance matrix of the high-dimensional feature space can be calculated directly in the original space, avoiding complex high-dimensional calculations.

[0040] Specifically, performing eigenvalue decomposition on the covariance matrix C to obtain the principal components includes: performing eigenvalue decomposition on the covariance matrix C: C = VΛV T , where Λ is a diagonal matrix whose diagonal elements are the eigenvalues ​​λ of C i . V is the eigenvector matrix, and the column vector is the eigenvector V corresponding to C i . Set the eigenvalue λ i Sort and select the first K largest eigenvalues. Extract the eigenvectors corresponding to these K largest eigenvalues, recorded as: V_principal component = [V1, V2, ..., V k], the eigenvectors v1, v2, ..., vK are the first K principal components of the covariance matrix C. The principal components reflect the main changes in the sample in that direction, preserving the main characteristic information. V_principal components is used as the output for subsequent use. V_principal components can also be used to perform a matrix transformation, mapping the original image set into the principal component subspace. This eliminates redundancy and reduces the dimensionality of the image set. Extracting the principal components of the covariance matrix through eigenvalue decomposition can be used for image dimensionality reduction, feature extraction, and other processing.

[0041] Specifically, the kernel features are projected into a low-dimensional subspace according to the principal components, including: the input image set {x1, x2, ..., xn}, and the principal component eigenvector matrix V_principal component = [V1, V2, ..., V k ]. For each image xi, use the kernel function Map it to the high-dimensional feature space H: In the high-dimensional space H, the principal component eigenvector is used as the projection direction to perform kernel feature projection: Here y i is the coordinate of the K-dimensional subspace H'. For all images x i The above operations yield the reduced-dimensional image set: Y = [y1, y2, ..., yn], where Y is the low-dimensional representation of the kernel features projected onto the high-dimensional kernel feature space H using the first K principal components. The low-dimensional representation Y is used as the output, completing the kernel feature dimensionality reduction using principal component analysis. This preserves the essential kernel feature information, eliminates redundancy, and improves processing efficiency. The combination of principal component analysis and kernel techniques effectively reduces the dimensionality of high-dimensional features.

[0042] Furthermore, the radial basis kernel function kernel adopts a multivariate Gaussian kernel. Specifically, the multivariate Gaussian kernel is a commonly used radial basis kernel function (RBF), which is used to realize high-dimensional mapping of kernel techniques. A multivariate Gaussian kernel is used as the radial basis kernel function and acts on the image data. Each image is expanded into a high-dimensional vector, and then input into the multivariate Gaussian kernel for kernel comparison to obtain a kernel matrix. The kernel matrix contains the inner product information after mapping to the high-dimensional feature space. In this way, a richer feature representation can be obtained, which is beneficial for image analysis. Compared with the single-dimensional Gaussian kernel, the multivariate Gaussian kernel takes into account the joint effects of different dimensions, can model complex data distributions, and is more suitable for image processing tasks. The multivariate Gaussian kernel is suitable for kernel technique mapping of high-dimensional data, and is used to extract the kernel feature information of the image in this technical solution.

[0043] Furthermore, the multivariate Gaussian kernel expression is as follows: Among them, x and y are input samples, both are L-dimensional vectors, representing the characteristics of the input image; ω m is the weight of the mth Gaussian kernel; G m(x,y) is the mth Gaussian kernel function, defined as: ||xy|| represents the Euclidean distance between x and y; σ m is the kernel width parameter of the mth Gaussian kernel.

[0044] Specifically, the input image features x and y are both L-dimensional vectors. Set the number of Gaussian kernels M, which is generally the same as the feature vector dimension L. For each Gaussian kernel m = 1, 2, ..., M: initialize the kernel weight ω m Is a positive value. Set the kernel width parameter σ m Is a positive value. Calculate the mth Gaussian kernel: Summing this gives a multivariate Gaussian kernel:

[0045] By adjusting ω m and σ m , the importance of different dimensions can be changed to achieve personalized kernel mapping. Substituting x and y into the kernel function K(x,y), their kernel feature combination can be obtained. Repeating the calculation can obtain the kernel matrix K, where Kij=K(x i ,x j The kernel matrix reflects the inner product of the original features after being mapped into the high-dimensional kernel space. Various kernel methods, such as PCA, can be performed based on the kernel matrix.

[0046] Different Gaussian kernel components can capture features in different dimensions, and when combined, they can model the overall distribution and structural information of the data. By adjusting the kernel weight ω m and kernel width σ m , can control the role of each dimension and achieve adjustable mapping. Gaussian kernel can be mapped to infinite dimensional space, avoiding information loss caused by dimensionality reduction. Multivariate Gaussian kernel calculates the inner product of the original features, avoiding complex high-dimensional space calculations. Only a small number of ω needs to be adjusted m and σ m , which reduces the difficulty of parameter tuning. It is decomposed into multiple simple Gaussian kernels, reducing the computational complexity.

[0047] Furthermore, image features are extracted, including: inputting a denoised image set; constructing an Inception-ResNet-v2 model, which includes: a convolutional layer, a residual connection layer, a pooling layer, and a fully connected layer; the convolutional layer uses convolution kernels of different scales to perform multi-scale feature extraction on the input image and output feature maps of different scales; the residual connection layer performs residual connection on the feature maps of different scales output by the convolutional layer to obtain fused features; the pooling layer performs maximum pooling and average pooling on the fused features to obtain features of the compressed feature dimension; the fully connected layer flattens the features of the compressed feature dimension and fully connects them to obtain a one-dimensional feature vector as the image feature.

[0048] Among them, the Inception-ResNet-v2 model is a convolutional neural network architecture that integrates the advantages of the Inception module and residual connection. The Inception module captures features of different ranges through convolution kernels of different sizes. Residual connections can alleviate the gradient diffusion problem when the network is deepened. In this application, Inception-ResNet-v2 is used as a feature extractor, which mainly includes: Convolution layer: different convolution kernels are used to extract hierarchical features. Pooling layer: Dimensionality reduction to improve computational efficiency. Residual module: implements residual learning and enhances feature expression. Fully connected layer: implements image classification. Through the deep neural network structure of Inception-ResNet-v2, feature representations that express the content and category of image data can be learned, providing powerful feature extraction capabilities for subsequent image classification tasks.

[0049] Among them, residual connection refers to adding the output of the previous layer directly to the subsequent layer through skip connection in the network model. By directly transmitting the underlying information, it can avoid the gradient vanishing phenomenon in deep networks. Fusing features refers to integrating feature maps of different layers in some way (such as concat, addition, etc.) to obtain a feature representation with richer information. In this application, the feature maps output by different convolutional layers of the Inception-ResNet-v2 model are added together through residual connection. This can achieve the fusion of features at different scales and obtain a comprehensive feature representation that takes into account both global and local, semantic and detailed features. This fusion feature is more beneficial to subsequent image classification tasks.

[0050] Among them, maximum pooling and average pooling are aggregation functions used to reduce the size of the feature map output by the convolutional layer. Maximum pooling takes the maximum value within the receptive field, and average pooling takes the average value. Compressing feature dimensions means reducing the length and width of the feature map through pooling, thereby reducing the dimension of the feature. In this application, maximum pooling and average pooling are performed on the fused features obtained by residual connection. This can extract the main components of the features and compress the feature dimensions. The size of the feature map is reduced and the computational efficiency is improved. The simultaneous use of the two pooling methods can provide feature compression from different perspectives, making the features more stable and robust. The pooling layer compresses the feature dimensions while retaining key feature information, providing stable feature input for subsequent classification.

[0051] In this process, the multidimensional feature map is flattened into a one-dimensional vector and then fully connected, meaning that each neuron is connected to all neurons in the previous layer. The one-dimensional features obtained by the fully connected layer retain the main discriminative information of the input image. In this application, the multidimensional feature map output by the pooling layer is flattened into a one-dimensional vector and input into the fully connected layer. The fully connected layer can capture the nonlinear and complex relationships between features. Finally, a one-dimensional feature vector is output for each image, which highly summarizes the overall content and semantic information of the image. This one-dimensional vector is the final feature representation of the image and can be directly used for image classification tasks.

[0052] Furthermore, based on the image features, a metric learning algorithm is used to extract the feature metric space; based on the image features, a structural metric learning algorithm is used to calculate the similarity between image feature samples and generate a similarity graph of image features; using the similarity graph, the metric projection matrix A of the image features is generated by measuring the objective function: L(A) = Σ(Sij×||Axi-Axj|| 2 ), where Sij is the similarity weight between sample i and sample j in the similarity matrix S, Sij∈[0,1], Sij=Sji; xi and xj are the feature vectors corresponding to image feature samples i and j, xi,xj∈R D , D is the feature dimension; A is the metric projection matrix, A∈R {D×d} , d is the projection target dimension; ||Axi-Axj|| is the Euclidean distance between xi and xj under the projection matrix A; the image features are mapped according to the metric projection matrix A to obtain the feature metric space of the image features.

[0053] Among them, the structural metric learning algorithm makes similar samples close and dissimilar samples far apart by learning the distance metric between samples. Commonly used structural metric learning algorithms include LMNN, ITML, etc. The similarity graph reflects the similarity relationship between all samples and is usually represented by a matrix. In this application, a structural metric learning algorithm is used to learn a similarity metric for the feature vectors of the image. Then, based on the learned metric, the distance between the image feature vectors is calculated to construct a similarity graph matrix of the image samples. The similarity graph intuitively reflects the similarity relationship between images in the feature space. Subsequently, tasks such as image clustering and image retrieval can be performed based on the similarity graph.

[0054] Specifically, using a structural metric learning algorithm to generate an image feature similarity graph includes: collecting an image feature sample set {x1, x2, ..., xn}, where xi is the d-dimensional feature vector of the i-th sample. Selecting an appropriate structural metric learning algorithm, such as LMNN, ITML, etc. Using labeled similar / dissimilar sample pairs, the metric learning algorithm is trained to learn a metric matrix M. For any two samples x i and xj , calculate their distance under the learned metric: dist(x i ,x j )=(x i -x j ) T ×M×(x i -x j ). For all sample pairs (x i ,x j )Calculate the distance dist(x i ,x j ), forming an n*n distance matrix D. Convert the distance matrix D into a similarity matrix S: The S matrix is ​​the image similarity graph, where Sij represents the degree of similarity between images i and j. The similarity graph intuitively reflects the distribution of samples in the image feature space. Save the similarity graph S as the algorithm output for subsequent tasks.

[0055] Specifically, using the metric projection matrix A to map image features to the feature metric space includes: Input: image feature matrix X = [x1, x2, ..., x n ]∈R {D×N} , similarity matrix S, target dimension d. Optimize the objective function L(A) and learn the metric projection matrix A∈R {D×d} For each image feature vector xi: calculate the projection vector: yi = A*xi, use yi as the new sample point, and construct the projected sample matrix Y = [y1, y2, ..., y n ]∈R {d×N} Matrix Y represents the coordinates in the feature metric space obtained by mapping the projection matrix A. In the new space Y, the distance ||yi - yj|| between similar samples xi and xj is closer, while the distance between dissimilar samples is farther. The feature metric space enhances the structural similarity between samples. Save the mapping matrix A and the feature metric matrix Y for subsequent algorithm use. The new space achieves better clustering, retrieval, and other performance.

[0056] Furthermore, the DBSCAN clustering algorithm is used to classify floating objects. DBSCAN (Density-Based Spatial Clustering of Applications with Noise) is a density-based clustering algorithm. In this application, the DBSCAN algorithm can be applied to floating object classification. A similarity graph or distance matrix is ​​constructed for floating object image features. The DBSCAN algorithm is run on the distance matrix. Based on the algorithm results, density-connected samples are grouped together, and isolated noise points are identified as anomalous samples. DBSCAN can automatically identify clusters of any shape and is suitable for density clustering and anomaly detection of floating objects, achieving effective classification.

[0057] Preferably, the DBSCAN clustering algorithm includes the following steps: inputting a sample point set D and clustering parameters Eps and MinPts in the feature metric space; randomly selecting an unvisited sample point p and marking p as visited; determining the Eps neighborhood N_Eps(p) of p with p as the center and Eps as the radius; if the number of sample points in N_Eps(p) is greater than or equal to MinPts, creating a new cluster C, adding p to C, and adding the unvisited sample points in N_Eps(p) to the seed set S; taking a sample point q from S, marking q as visited, determining the Eps neighborhood N_Eps(q) of q, and if the number of sample points in N_Eps(q) is greater than or equal to MinPts, adding the unvisited points in N_Eps(q) to S; repeating until S is empty; repeating until all points in D are visited; outputting all clusters C, and marking the sample points that do not belong to any cluster as noise points. Eps represents the scanning radius, which is the neighborhood radius threshold for determining whether a sample point is a core object. MinPts represents the lower limit of the number of cluster samples, which is the minimum number of samples within the neighborhood of Eps required for a sample point to qualify as a core object. The values ​​of the clustering parameters Eps and MinPts are determined by the following steps: calculating the distance between any two sample points in the feature metric space to obtain the distance set Dis; sorting Dis in ascending order to obtain the sorted distance set sort_Dis; plotting a distance curve on sort_Dis; finding the first inflection point on the curve and determining the distance value d corresponding to the inflection point; Eps is set between d and 1.5 times d, and MinPts is set between 1% and 2% of the total number of samples. For each cluster after DBSCAN clustering, the number of samples within the cluster is counted. Based on the proportion of samples within the cluster to the total number of samples, clusters with too few samples are removed, and the main clusters are retained. The samples corresponding to the retained clusters are used to train an SVM classifier to obtain a floating object classification model. The SVM classifier uses a radial basis kernel function. When training the SVM classifier, the penalty coefficient C and kernel function parameter γ of the SVM classifier are optimized through grid search and cross validation.

[0058] 3. Beneficial effects

[0059] Compared with the existing technology, the advantages of this application are:

[0060] The wavelet transform algorithm is used to reduce the noise in the image, which improves the accuracy and reliability of subsequent processing steps, thereby improving the accuracy of floating object identification;

[0061] The kernel PCA algorithm is used to reduce the dimension of the image, which reduces the existence of redundant information, simplifies the complexity of subsequent processing, and improves the processing efficiency and speed of the system;

[0062] End-to-end deep learning feature extraction is achieved through convolutional neural networks, which obtains more abstract and semantic feature representations and improves the accuracy and robustness of floating object recognition.

[0063] The structural metric learning method is used to learn the metric distance between samples in the feature space to obtain more distinguishable features, which helps to improve the accuracy and reliability of floating object classification;

[0064] The density-based DBSCAN clustering algorithm can adaptively classify samples with complex distributions, effectively cope with the diversity and complexity of floating objects in different environments, and improve the robustness and adaptability of floating object identification. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] This specification will be further described in the form of exemplary embodiments, which will be described in detail with reference to the accompanying drawings. These embodiments are not limiting, and in these embodiments, the same numbers represent the same structures, wherein:

[0066] Figure 1 is an exemplary flow chart of a method for automatically identifying floating objects according to some embodiments of this specification;

[0067] Figure 2 is an exemplary flow chart of denoising processing according to some embodiments of this specification;

[0068] Figure 3 is an exemplary flow chart of a dimensionality reduction process according to some embodiments of this specification;

[0069] Figure 4 is an exemplary flow chart of extracting image features according to some embodiments of this specification;

[0070] Figure 5 is an exemplary flow chart of extracting feature metric space according to some embodiments of this specification. DETAILED DESCRIPTION

[0071] The methods and systems provided in the embodiments of this specification are described in detail below with reference to the accompanying drawings.

[0072] Figure 1 This is an exemplary flow chart of a method for automatically identifying floating objects according to some embodiments of this specification. The method includes collecting a water image dataset containing floating objects; preprocessing the collected image dataset, wherein the preprocessing includes: denoising the image using a filter based on an annealing algorithm; performing dimensionality reduction on the denoised image dataset using a kernel PCA algorithm; extracting image features from the preprocessed image dataset using a pretrained convolutional neural network; extracting a feature metric space based on the image features using a metric learning algorithm; and classifying floating objects based on the feature metric space using a clustering algorithm.

[0073] Image Dataset Acquisition: Collect raw water images containing various types of floating objects as a dataset. Acquisition Scenario: Select water areas such as docks or dams for image acquisition. Acquisition Equipment: Use an industrial camera with a certain resolution, mounted on a bridge or at a high point, to capture the water surface from a bird's-eye view. Acquisition Time: Shoot during the day with ample sunlight. Avoid times when direct sunlight hits the water surface to reduce reflections. Acquisition Content: Record the movement of various types of floating objects, such as plastic bags, plastic bottles, wood, and seaweed, across the water. Number of Images: Collect 50-100 sample images for each category, for a total of 500-1000 raw water surface images containing floating objects. Image Storage: Store raw images in a lossless format (such as TIFF) with a resolution of ≥2048x1536. Image Annotation: Professionals will annotate the images, recording information such as the type and quantity of floating objects. Data Cleaning: Delete images of poor quality to ensure dataset quality. Dataset Saving: Organize images by category and acquisition time for future use.

[0074] Figure 2 is an exemplary flow chart of denoising processing according to some embodiments of this specification, obtaining a set of collected images {I1, I2, ..., In}, converting the image Ii into a two-dimensional matrix, denoted as A, initializing the complex mother wavelet ψ and the scaling function Construct complex wavelet basis at different scales s and time t: ψ c(s,t) =ψ(s,t)+j×Hψ(s,t), where H represents Hilbert transform. Perform wavelet decomposition on A: C=∑s,t<A,ψ c(s,t) >ψ c(s,t), where <, > denote the inner product operation, and C is the complex wavelet coefficient matrix. Matrix C contains the transformation characteristics of image Ii in the time-frequency domain. The coefficients corresponding to different s and t reflect the information of Ii at the corresponding scale and time. The complex matrix C, as the time-frequency plane, can be used for subsequent noise detection. Thus, the Hilbert wavelet transform can be used to obtain the time-frequency information of image Ii, laying the foundation for noise analysis.

[0075] Calculate the energy E of the complex wavelet coefficient matrix C and generate the energy distribution map E_map: Input the complex wavelet coefficient matrix C, size M×N, initialize the energy matrix E, the same size as C, traverse each element c(m,n) in C, and calculate the energy of the point: e(m,n)=|c(m,n) 2 , where |x| represents the modulus of the complex number. Write e(m,n) to the corresponding position in E, and repeat this process for all elements of matrix C. Input the energy matrix E and set a color mapping mode (here, using the jet heat map). Normalize the values ​​in E to the range [0, 1] and apply a color map. Convert the result to an image representation, obtaining the energy distribution map E_img. In E_img, areas with high energy values ​​appear hotter and brighter. Different noise types have different energy distributions, and E_img intuitively reflects the noise energy distribution.

[0076] Slide the energy distribution map E_map to collect noise texture features: Input the energy distribution map E_map, of size M×N. Set the sliding window size, such as 5×5, and slide the window on E_map, traversing all positions with a certain step size. At each window position, extract texture features: calculate statistical features such as the pixel mean and standard deviation within the window, calculate the gradient feature histogram within the window, construct the GLCM matrix within the window, and calculate texture features such as contrast and entropy. These features are concatenated into a vector, which serves as the texture feature f at that window position. After the sliding window traversal is completed, the feature set FF for all window positions is obtained, representing the noise texture features collected on E_map. F is distinguishable for different noise types. F is used for subsequent template matching to determine the noise type.

[0077] Calculate the distance between F and the template, match the nearest template, and output the noise type Ni: Construct a noise template library T = {t1, t2, ..., tk}, which contains the standard features of k types of noise. Input the collected feature set F = {f1, f2, ..., fn}, which contains the features of n windows, and define the distance metric function: dist(x, y) = ∑i × (x i -y i ) 2 , traverse each feature vector fi: calculate the distance dist(f with each template tj i -t j ), find the template t with the smallest distancemin , t min =argmindist(f i -t j ), output the matching noise type yi: yi = type (tmin), and finally obtain the noise type vector Y = {y1, y2, ..., yn} of n windows. Through statistical voting, output the main noise type Ni of the entire image.

[0078] Select the wavelet basis according to the noise type and generate the cosine annealing curve: input the detected noise type Ni, such as salt and pepper noise, Gaussian noise, etc., set the wavelet basis template library: {Haar, Db4, Sym5, Coif3, Bior1.3, ...,}, according to Ni, look up the table to select the matching wavelet basis Bi: if Ni is salt and pepper noise, Bi = Haar, if Ni is Gaussian noise, Bi = Db4, set Bi's scale range s_min5, set Bi's time shift range k_min8, and generate the cosine annealing curve: Where S = s max -s min +1, K=k max -k min +1. W i That is, according to the noise type N i The generated wavelet filter curve, W i Contains cosine modulation of scale and time shift direction. When the image is transformed by wavelet, W is used. i Performs controllable filtering.

[0079] Use the cosine annealing curve W i Perform wavelet denoising: Input the original image Ii and the cosine annealing curve W i , perform wavelet decomposition and obtain the subband coefficient matrix Cs of different scales s. For each scale s: C s '=C s ×W i (s,:), where W i (s,:) takes out the filter coefficient corresponding to the s-th scale, and reconstructs the filtered coefficient matrix to obtain the denoised image.

[0080] I i ' = wavelet reconstruction (C' s ), I i ' is based on the filter curve W i The processed denoised image, W i The waveform design preserves important components and suppresses noise signals. Through the adaptive design of the curve, various types of noise can be effectively suppressed. Repeating this process for all images completes the denoising task.

[0081] Use PSNR to adjust the filter curve to achieve denoising: Input the original image Ii and the denoised image I'. Calculate PSNR:

[0082] i PSNR=10*log10(MAX^2 / MSE), where MAX is the maximum pixel value and MSE is the mean square error. If PSNR is less than the set threshold (such as 30dB), it means that the denoising effect is insufficient and the filter curve W needs to be adjusted. i . Use annealing algorithm to adjust W i Parameters: scale range s min 、s max , time shift range k min 、k max , modulation factor w, repeat wavelet denoising and PSNR calculation until PSNR is greater than the threshold, output the final denoising result Ii', and repeat the above process for all images.

[0083] Figure 3 is an exemplary flow chart of dimensionality reduction processing according to some embodiments of this specification. The denoised image set {X1, X2, ..., XN} is input, Xi is the L-dimensional feature vector of the image, and a multivariate Gaussian kernel is constructed: M Gaussian kernels are initialized, ω m , σ m , calculate the kernel similarity K(X i ,X j ), let the two samples in the input space be: X i =[x i1 ,x i2 ,......,x iL ], X j =[x j1 ,x j2 ,......,x jL ], then according to the definition of multivariate Gaussian kernel, the sample X i and X j The kernel similarity between them is: Among them G m (X i ,X j ) is the mth Gaussian kernel function: Substituting Xi and Xj into the formula, we can get: i -X j || 2 =(x i1 -x j1 ) 2 +(x i2 -x j2 ) 2 +......+(x il -x jl ) 2Combining the formula, the kernel similarity between samples Xi and Xj is:

[0084] Map the sample to the high-dimensional kernel feature space: Let the input space be X, and the input sample be {X1,X2,......,X N}, define a mapping function from X to high-dimensional feature space H: Then the expression after the sample Xi is mapped to the H space is: Where D is the dimension of H space, D>>L (the dimension of input space), Represents the mapping function of the k-th high-dimensional feature. After mapping, the expression of the sample Xi in the H space is: Map all samples and get the expression in H space: Kernel methods implicitly define the mapping function The mapping of input samples to high-dimensional feature space is realized to learn the nonlinear structural information of the samples.

[0085] Calculate the sample kernel matrix K on the high-dimensional kernel feature space H. Given a sample set: {X1,X2,......,X N}, map the sample set to H space: Define an N×N kernel matrix That is, the i-th row and j-th column element of K is the mapped sample X i and X j The inner product of , according to the characteristics of the kernel function, is: where k(X i ,X j ) is the kernel function in the input space. Therefore, the kernel matrix K can be directly calculated by the kernel function of the input space: K(i,j)=k(X i ,X j ), i, j = 1, 2, ..., N, and finally the kernel matrix K of the sample in the kernel feature space H is obtained, with dimension N × N. In this way, through the implicit mapping technique, the solution of the high-dimensional kernel matrix is ​​achieved, preparing for the subsequent kernel PCA dimensionality reduction.

[0086] Perform PCA on K to extract the first K principal components UK: Input a kernel matrix K of size N×N. Center K to obtain the centralized kernel matrix M. M = K-1N×N*KK*1N×N+1N×N*K*1N×N. Calculate the eigenvalue decomposition of M: M = UΣVT, where U is a column-orthogonal matrix and Σ is a diagonal eigenvalue matrix. Select the first K largest eigenvalues ​​to construct the eigensubmatrix ΣK, and take the corresponding K columns of eigenvectors to form the submatrix UK. UK = U(:,1:K), where UK is the first K principal components of the kernel matrix M. UK reflects the main direction of variation of the sample in high-dimensional space and is used for dimensionality reduction mapping. Kernel PCA can effectively extract the principal components of the nonlinear manifold and achieve dimensionality reduction.

[0087] Construct a kernel PCA projection matrix. In the high-dimensional kernel feature space H, PCA is used to obtain the first K principal component matrices UK. UK is of size N × K, where N is the number of samples and K is the number of principal components. Define the projection matrix P from the high-dimensional space H to the low-dimensional subspace. P is of size K × N. Based on the principles of PCA, projection matrix P is the transpose of the principal component matrix UK: P = UKT, where UKT is of size K × N. Each row vector of P corresponds to a principal component direction. P projects the high-dimensional mapping samples into the low-dimensional subspace, resulting in projection matrix P, which is used for subsequent dimensionality reduction mapping calculations.

[0088] Use the kernel PCA projection matrix to reduce the dimension of the sample, and N}, mapped to high-dimensional space: The projection matrix P of kernel PCA has been obtained, with a size of K×N. For the i-th sample Xi: mapped to the high-dimensional feature space: Use the projection matrix for dimensionality reduction mapping: y i The K-dimensional feature vector of the i-th sample is projected into the low-dimensional space. Repeat the above process to perform dimensionality reduction mapping on all samples to obtain the reduced-dimensionality sample set: {y1,y2,......,y N Finally, the output is a reduced-dimensional sample set, which maps the samples from a high-dimensional space to a low-dimensional representation. This preserves key features while removing redundancy. Kernel PCA projection efficiently reduces the sample dimensionality and extracts key features.

[0089] Figure 4This is an exemplary flowchart for extracting image features according to some embodiments of this specification. Image data X is input after denoising and dimensionality reduction. An Inception-ResNet-v2 model is constructed: Convolutional layers use 3x3 and 5x5 convolution kernels to extract multi-scale features. Residual connection layers add features of different scales as residual features. Pooling layers use 3x3 max pooling and 3x3 average pooling to fuse features. Fully connected layers flatten features and output a one-dimensional feature vector. For image X, convolutional layers extract multi-scale feature maps. Residual connection layers fuse feature maps of different scales. Pooling layers compress feature dimensions. Fully connected layers generate a one-dimensional feature representation. This process is repeated for all images to obtain the feature set {y1, y2, ..., yN}. Finally, a deep learning feature representation is output as the semantic features of the image.

[0090] Figure 5 is an exemplary flow chart of extracting feature metric space according to some embodiments of this specification, wherein the input image depth feature set {X1, X2, ..., X N}, x i ∈R D , calculate the similarity Sij between samples and construct the similarity matrix S: Input image feature set {X1,X2,......,X N}, x i ∈R D , define the similarity function between samples: where ||x i -x j || is the Euclidean distance, σ is the kernel width parameter. Calculate the similarity between all sample pairs: Sij = sim(x i ,x j ), i, j = 1, 2, ..., N, construct the similarity matrix S: S = [Sij] ∈ R {N×N} , Sij represents the sample x i and x j The similarity weights between samples, Sij, satisfy the symmetry: Sij = Sji. S reflects the similarity relationship between all samples and will be used for structural metric learning to learn the distance metric between samples. The similarity matrix of the samples is constructed using the Gaussian kernel, providing structural information for subsequent metric learning.

[0091] The metric objective function is: L(A) = Σ(Sij×||Axi-Axj|| 2 ), where: Sij is the similarity weight between samples i and j, A is the metric projection matrix, size is D×d, x i and x j is the original feature vector of samples i and j, with a size of D, ||Axi-Axj|| 2 Represents xi and x j In the Euclidean distance under the projection matrix A, L(A) learns the metric by minimizing the weighted distance between samples in the projection space. Sij is used as the weight to make the distance between similar samples small and the distance between dissimilar samples large. Minimizing L(A) is equivalent to distance metric learning. Solving the optimal projection matrix A* gives a new metric space.

[0092] Given the optimized structural metric learning objective function, the projection matrix A is obtained and the objective function is defined as: L(A) = Σ(Sij×||Axi-Axj|| 2 ), initialize the projection matrix A, such as random initialization, and use an optimization algorithm to optimize the objective function: such as the gradient descent method: repeatedly calculate the gradient grad(A) of the objective function L(A), A=A-lr×grad(L), until the objective function converges, and minimize the objective function L(A) by iteratively updating A. When the optimization process converges, the optimal projection matrix A* is obtained. A* reflects the optimal projection relationship from the input space to the metric space. A* is used to map the input samples to obtain the metric space expression.

[0093] Use the learned projection matrix A to map the sample. The optimal projection matrix A* has been learned, with a size of D×d. For each sample xi, perform projection mapping: y i =A×x i , where xi is the original D-dimensional input feature, y i For the new d-dimensional feature representation, for all samples {x1,x2,.....,x n} Repeat the projection mapping to obtain the new feature expression {y1,y2,......,y N The new feature space satisfies the following properties: similar samples are mapped closer together, while dissimilar samples are further apart, reflecting the learned similarity metric between samples. Ultimately, a new metric feature representation is obtained that enhances the distinguishability between samples, facilitating sample indexing and retrieval.

[0094] Classification clustering: Perform density-based DBSCAN clustering on the metric space features to divide the image into different floating object categories. The input is the metric space feature set {y1,y2,......,y N},y i ∈R d , set the parameters of DBSCAN: ε represents the neighborhood radius of the core object, minPoints represents the minimum number of neighborhood points required for the core object. Traverse all sample points y i : If y i If the number of points in the ε neighborhood of y is greater than or equal to minPoints, it is marked as a core object and y i The points in the ε neighborhood of are marked as yi Direct density reachable objects. Mark all core objects in the sample data set. For each core object O i :Find the set of directly density-reachable objects D in its ε neighborhood i , D i The object in D is directly density-reachable with Oi. i Each object O in j : Find O j The set of directly density-reachable objects D in the ε neighborhood of j If D i and D j There are overlapping samples, then O i and O j Indirect density reachable. Connect all core objects that are directly or indirectly density reachable to form clusters. Non-core objects that do not belong to any cluster are marked as noise points. The final clustering result is: multiple clusters Ci represent different categories of images, and noise points represent abnormal samples. DBSCAN clustering outputs the following results: Multiple clusters: {C1, C2, ..., C k}Noise point set: N, where each cluster C i Represents a class of images: C i The samples in are images of this category, such as C i It can represent a type of marine floating objects. The samples in the noise point set N do not belong to any cluster. The noise points represent abnormal images: they do not conform to the main floating object categories, such as rare category images that rarely appear. The final DBSCAN clustering results reflect: main categories: one main floating object category in each cluster, abnormal samples: images marked by noise points. The results can be used for classification and anomaly detection.

[0095] Result output: Output the final floating object classification result. Input: DBSCAN clustering result, cluster set: {C1, C2, ..., C k}, noise point set: N. For each cluster C i : Statistics C i The number of images n in i , press n i Arrange all clusters in descending order. Take the first m clusters with the largest number of samples as the main category, and manually mark the category labels for these m clusters, such as C i Belongs to the "plastic bottle" class, for each cluster C iOutput classification results: category name labeli, image_idsi. Output anomaly detection results: noise_image_ids for the noise point set N. Output final output: major floating object categories, a list of images corresponding to each category, and a collection of abnormal sample image numbers. This completes clustering-based floating object classification and anomaly detection.

Claims

1. A method for automatically identifying floating objects, comprising: Collect water image datasets containing floating objects; The collected image set is preprocessed, which includes: using a filter based on the annealing algorithm to denoise the image; using the kernel PCA algorithm to reduce the dimensionality of the denoised image set; Based on the preprocessed image set, a pre-trained convolutional neural network is used to extract image features; According to the image features, the metric learning algorithm is used to extract the feature metric space; Based on the feature metric space, clustering algorithm is used to classify floating objects; The image is denoised using a filter based on an annealing algorithm, including: Get the image set to be processed {I1, I2, ...., In}, and convert each image Ii into a two-dimensional matrix A; Initialize the complex mother wavelet ψ and scaling function Constructing Hilbert complex wavelet basis at different scales s and time t; performing wavelet decomposition on matrix A using the constructed complex wavelet basis to obtain complex wavelet coefficient matrix C; Take the complex wavelet coefficient matrix C as the time-frequency plane, traverse each element in C, and calculate the corresponding energy: E(C n )=∑|C n (t,f)| 2 , where |C n (t,f)| represents the complex modulus of the wavelet coefficient corresponding to time t and frequency f in the matrix; generates energy distribution E(t,f), normalizes and color maps the energy distribution E(t,f), and generates a noise energy distribution map E_map; Slide the noise texture features on the energy distribution map E_map, set a sliding window of size w×w, slide on E_map with a step size s_img, and extract the texture features of each window position. The texture features include mean, standard deviation, gradient histogram, contrast and entropy of gray-level co-occurrence matrix; the features extracted at each position are spliced ​​into feature set F; Calculate the distance between the feature set F and each template in the preset noise template library T, match the nearest template, and output the noise type Ni; The noise template library T = {t1, t2, ...., tk} contains the standard features of k types of noise; Define the distance metric function dist(x,y)=∑i×(x i -y i ) 2 , calculate the distance dist(f i -t j ), find the template t with the smallest distance min :t min =argmindist(f i -t j ), and use the corresponding noise type as the noise type yi of fi; Vote for the noise types yi of all eigenvectors in F and output the main noise type Ni of the final image; According to the noise type Ni, select the matching wavelet basis Bi and generate the cosine annealing filter curve g(x): Where S = s max -s min +1, K=k max -k min +1; s represents the scale range of Bi, and k represents the time shift range of Bi; Set the wavelet basis storage template, which contains one of Haar, Db, sym, bior, and coif, and obtain the optimal wavelet basis Bi according to Ni; Set the scale range [smin, smax] and time shift range [kmin, kmax] of Bi, as well as the modulation factor w, to generate the filtering curve; Use the cosine annealing filter curve g(x) to perform wavelet denoising on Ii: Use Bi and g(x) to perform wavelet decomposition on Ii to obtain wavelet coefficients of each scale; multiply the wavelet coefficients with g(x) to implement filtering and remove noise components; reconstruct the modified wavelet coefficients to obtain the denoised image; Calculate the peak signal-to-noise ratio (PSNR) of the denoised image and the original image. If the PSNR is lower than the threshold, use the simulated annealing algorithm to adjust the parameters of g(x). Repeat until the PSNR meets the requirements and output the final denoised image Ii'. According to the image features, the metric learning algorithm is used to extract the feature metric space, including: According to the image features, a structural metric learning algorithm is used to calculate the similarity between image feature samples and generate a similarity graph of image features; Using the similarity graph, we can generate the metric projection matrix A of the image features by measuring the objective function: L(A)=∑(Sij×||Axi-Axj|| 2 ) Among them, Sij is the similarity weight between sample i and sample j in the similarity matrix S, Sij∈[0,1], Sij=Sji; xi and xj are the feature vectors corresponding to image feature samples i and j, xi,xj∈R D , D is the feature dimension; A is the metric projection matrix, A∈R {D×d} , d is the projection target dimension; ||Axi-Axj|| is the Euclidean distance between xi and xj under the projection matrix A; The image features are mapped according to the metric projection matrix A to obtain the feature metric space of the image features.

2. The method for automatically identifying floating objects according to claim 1, characterized in that: The kernel PCA algorithm is used to perform dimensionality reduction on the denoised image set, including: Take the denoised image set as input; The radial basis kernel function is used to map the input image set to the high-dimensional kernel feature space H, and the mapped image set is output; In the high-dimensional kernel feature space H, calculate the covariance matrix C of the mapped image set; Perform eigenvalue decomposition on the covariance matrix C and obtain the eigenvectors corresponding to the first K largest eigenvalues ​​as the principal components; The first K principal components are extracted to perform kernel feature projection on the input image set to obtain a low-dimensional representation in the high-dimensional kernel feature space H, and the low-dimensional representation is output as the image set after dimensionality reduction.

3. The method for automatically identifying floating objects according to claim 2, characterized in that: The radial basis kernel function kernel uses a multivariate Gaussian kernel.

4. The method for automatically identifying floating objects according to claim 2, characterized in that: The multivariate Gaussian kernel expression is as follows: in, x and y are input samples, both L-dimensional vectors, representing the features of the input image; ω m is the weight of the mth Gaussian kernel; G m (x,y) is the mth Gaussian kernel function, defined as: ||xy|| represents the Euclidean distance between x and y; σ m is the kernel width parameter of the mth Gaussian kernel.

5. The method for automatically identifying floating objects according to any one of claims 1 to 4, characterized in that: Extract image features, including: Input the denoised image set; Build the Inception-ResNet-v2 model, which includes convolutional layers, residual connection layers, pooling layers, and fully connected layers. Convolutional layer uses convolution kernels of different scales to extract multi-scale features from the input image and output feature maps of different scales; The residual connection layer performs residual connection on the feature maps of different scales output by the convolutional layer to obtain fused features; The pooling layer performs maximum pooling and average pooling on the fused features to obtain features with compressed feature dimensions; The fully connected layer flattens the features of the compressed feature dimension and fully connects them to obtain a one-dimensional feature vector as the image feature.

6. The method for automatically identifying floating objects according to claim 5, characterized in that: The DBSCAN clustering algorithm was used to classify floating objects.

Citation Information

Patent Citations

  • Automatic identification method for floating objects in water body

    CN112784729A

  • Method and system for analyzing magnetic resonance images

    WO2023281317A1