Navigation oil spill detection method and system based on reinforcement learning and improved bat algorithm

By combining reinforcement learning with an improved bat algorithm, the problem of radar images being susceptible to interference in marine oil spill detection was solved. This enabled adaptive and accurate extraction of oil spill areas, improving the robustness and accuracy of detection and supporting rapid monitoring and emergency response to marine oil spills.

CN121708285BActive Publication Date: 2026-05-15SHENZHEN INST OF GUANGDONG OCEAN UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610215846.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-02-14
Publication Date
2026-05-15
Estimated Expiration
2046-02-14

AI Technical Summary

Technical Problem

Existing technologies for marine oil spill detection suffer from problems such as radar images being susceptible to interference, difficulty in threshold optimization, and insufficient segmentation accuracy. Traditional algorithms have weak anti-interference capabilities and struggle to achieve both high grayscale adaptability and spatial continuity.

Method used

A method based on reinforcement learning and an improved bat algorithm is adopted, combining autoencoders, Q-learning, and the improved bat algorithm. Through non-uniform initialization, random perturbation iterative update, and multi-constraint fitness function design, adaptive and accurate extraction of oil spill areas is achieved.

Benefits of technology

The algorithm's global exploration and local convergence capabilities have been improved, enabling adaptive and accurate extraction of oil spill areas under complex interference. This solves the technical pain points of traditional algorithms in oil spill segmentation, which are characterized by weak robustness and insufficient accuracy, and provides reliable technical support for rapid monitoring and emergency response to marine oil spills.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121708285B_ABST
    Figure CN121708285B_ABST
Patent Text Reader

Abstract

The application provides a marine oil spill detection method and system based on reinforcement learning and an improved bat algorithm, and relates to the technical field of target detection.The technical points of the application include: preprocessing the collected radar image;generating a pseudo label for the preprocessed image using a K-means clustering algorithm;extracting features of the preprocessed image using a self-encoder;classifying the preprocessed image using reinforcement learning, and extracting a region with an oil spill category in the classification result as an interesting region, thereby obtaining an interesting image;obtaining an optimal segmentation threshold value using an improved bat algorithm, and segmenting the interesting image using the optimal segmentation threshold value to obtain a segmented image based on the optimal segmentation threshold value, thereby realizing oil spill detection.The application solves the technical pain points of weak robustness and insufficient precision of traditional algorithms in oil spill segmentation, and provides reliable technical support for rapid monitoring and emergency response of marine oil spills.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of target detection technology, specifically to a method and system for detecting marine oil spills based on reinforcement learning and an improved bat algorithm. Background Technology

[0002] Frequent marine oil spills not only cause irreversible damage to the marine ecological environment but also seriously threaten shipping safety and coastal economic development. Therefore, achieving rapid and accurate detection of oil spills has significant practical and engineering value. Radar remote sensing technology, with its advantages of all-weather, all-day operation and strong penetration, has become the core means of marine oil spill monitoring. However, radar images are easily affected by interference factors such as sea clutter, noise, and ship hulls, often masking the grayscale differences between the oil spill area and the background, posing a significant challenge to the accurate identification and segmentation of oil slicks.

[0003] Traditional oil spill detection methods often rely on manual threshold selection or single feature classification, which suffers from problems such as strong subjectivity, weak anti-interference ability, and poor generalization performance. Although existing intelligent algorithms have improved detection efficiency to some extent, they still face bottlenecks such as threshold optimization easily getting trapped in local optima, too many invalid solutions at low thresholds, and segmentation results that are difficult to balance high grayscale adaptability and spatial continuity. Summary of the Invention

[0004] In view of the above problems, this invention proposes a method and system for detecting marine oil spills based on reinforcement learning and an improved bat algorithm.

[0005] According to one aspect of the present invention, a method for detecting marine oil spills based on reinforcement learning and an improved bat algorithm is proposed, the method comprising:

[0006] S1. Preprocess the acquired radar images;

[0007] S2. Use the K-means clustering algorithm to generate pseudo-labels for the preprocessed image; the pseudo-labels for each pixel in the preprocessed image include background, suspected oil spill, and oil spill.

[0008] S3. Use an autoencoder to extract features from the preprocessed image;

[0009] S4. Reinforcement learning is used to classify the preprocessed image, and the region classified as oil spill in the classification result is extracted as the region of interest, thereby obtaining the image of interest; wherein, in reinforcement learning, the features extracted by the autoencoder are used as the state, and the reward value is calculated based on the pseudo label;

[0010] S5. The optimal segmentation threshold is obtained by using the improved bat algorithm, and the interest image is segmented using the optimal segmentation threshold to obtain a segmented image based on the optimal segmentation threshold, thereby realizing oil spill detection.

[0011] Furthermore, the preprocessing described in S1 includes: coordinate transformation, detection and suppression of co-frequency interference, speckle noise filtering, grayscale correction, and contrast enhancement.

[0012] Furthermore, in S3, after using an autoencoder to extract features from the preprocessed image and obtain the corresponding high-dimensional feature vector, the principal component analysis algorithm is used to reduce the dimensionality of the high-dimensional feature vector to obtain a three-dimensional feature vector.

[0013] Furthermore, the specific steps of S4 include: discretizing the three-dimensional feature vector into a certain number of states through K-means clustering; the state of each pixel in the image is determined by the pseudo-label to which the feature extracted by its corresponding autoencoder belongs; the action space is defined as {1,2,3}, corresponding to the three categories of oil spill, background, and suspected oil spill, respectively; the agent's action selection is the final classification result of the pixel; and the reward value... The calculation formula is:

[0014] ;

[0015] In the formula, As a reward for classification accuracy, if action a matches the pseudo-label, a positive reward is given; otherwise, a penalty is given. q is the neighborhood consistency weight adjustment coefficient. This represents the number of pixels in the current pixel's 8-neighborhood that have been classified as action 'a'. is the neighborhood consistency coefficient.

[0016] Furthermore, in the improved bat algorithm described in S5, a normally distributed random perturbation is introduced into the speed update formula for individual bats during the global search phase. The speed update formula is then:

[0017] ;

[0018] In the formula, This represents the speed of the i-th bat in the t-th iteration; This represents the position of the i-th bat in the t-th iteration; This represents the frequency of the i-th bat; This is the globally optimal threshold at the t-th iteration; ~N(0,1) represents a random variable. It follows a normal distribution with a mean of 0 and a variance of 1; k is the random disturbance intensity adjustment coefficient; , These represent the upper and lower limits of the search space, respectively.

[0019] Furthermore, in the improved bat algorithm described in S5, the iteration step size in the local search phase decreases with the number of iterations t, and the position update formula is:

[0020] ;

[0021] In the formula, S represents the iteration step size. l is the step size decay rate adjustment coefficient. , Let δ represent the upper and lower bounds of the search space, respectively; T represents the maximum number of iterations; δ~N(0,1) represents the random variable. It follows a normal distribution with a mean of 0 and a variance of 1; This is the globally optimal threshold at the t-th iteration.

[0022] Furthermore, in the improved bat algorithm described in S5, the fitness function is calculated using the following formula:

[0023] ;

[0024] In the formula, To avoid the minimum value where the denominator is 0; Indicates the variance between Otsu classes; This is the threshold preference adjustment coefficient. This is the adjustment coefficient for the proportion of constraint intensity in the foreground, where the foreground refers to the oil spill area and the suspected oil spill area; , indicating a high threshold penalty term, The effective pixel average; , indicating a foreground ratio penalty item, Where N is the number of foreground pixels and N is the total number of effective pixels; It is a dynamic weighting factor used to strengthen the weights of high threshold preference and foreground ratio constraints in the fitness function.

[0025] Furthermore, the formula for calculating the dynamic weighting factor is as follows:

[0026] ;

[0027] In the formula, c is the initial weight adjustment coefficient, and d is the weight growth rate adjustment coefficient.

[0028] According to another aspect of the present invention, a marine oil spill detection system based on reinforcement learning and an improved bat algorithm is proposed. The system is used to implement the aforementioned marine oil spill detection method based on reinforcement learning and an improved bat algorithm; the system includes:

[0029] The data preprocessing module is configured to preprocess the acquired radar images;

[0030] The pseudo-label generation module is configured to use the K-means clustering algorithm to generate pseudo-labels for the preprocessed image; the pseudo-labels for each pixel in the preprocessed image include background, suspected oil spill, and oil spill.

[0031] The feature extraction module is configured to extract features from the preprocessed image using an autoencoder;

[0032] The region of interest extraction module is configured to use reinforcement learning to classify the preprocessed image and extract the region of interest that is classified as oil spill in the classification result, thereby obtaining the region of interest; wherein, in the reinforcement learning, the features extracted by the autoencoder are used as the state, and the reward value is calculated based on the pseudo label.

[0033] The optimal segmentation module is configured to obtain an optimal segmentation threshold using an improved bat algorithm, and to segment the image of interest using the optimal segmentation threshold to obtain a segmented image based on the optimal segmentation threshold, thereby realizing oil spill detection.

[0034] The beneficial technical effects of this invention are:

[0035] This invention combines the grayscale features of oil spill areas in radar images with segmentation requirements, proposing a marine oil spill detection method and system based on reinforcement learning and an improved bat algorithm. It integrates autoencoders, Q-learning reinforcement learning, and the improved bat algorithm to enhance marine radar oil spill detection. Through non-uniform initialization, random perturbation iterative updates, and multi-constraint fitness function design, it achieves adaptive and accurate extraction of oil spill areas, providing technical support for marine oil spill emergency response and pollution control. This invention focuses on the high grayscale range of oil spill areas to reduce invalid searches; it introduces a global update with random perturbation and a local optimization mechanism with adaptive decay step size to improve the algorithm's global exploration and local convergence capabilities; it constructs a multi-constraint fitness function that integrates Otsu's inter-class variance, a high threshold penalty term, and a foreground proportion penalty term to enhance adaptability to the grayscale characteristics and spatial distribution of oil spill areas; ultimately, it achieves adaptive and accurate extraction of oil spill areas under complex interference, solving the technical pain points of weak robustness and insufficient accuracy in traditional algorithms for oil spill segmentation, and providing reliable technical support for rapid monitoring and emergency response to marine oil spills. Attached Figure Description

[0036] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. Several embodiments of the invention are illustrated in the drawings by way of example and not limitation, wherein:

[0037] Figure 1 This is a flowchart of a marine oil spill detection method based on reinforcement learning and an improved bat algorithm, as described in an embodiment of the present invention.

[0038] Figure 2 This is an example of a preprocessed image in an embodiment of the present invention;

[0039] Figure 3This is an example of an image after generating pseudo-labels using the K-means clustering algorithm on a preprocessed image in an embodiment of the present invention;

[0040] Figure 4 This is an example of an image obtained by classifying a preprocessed image using reinforcement learning in an embodiment of the present invention;

[0041] Figure 5 This is an example of a ROI mask obtained after deleting spots and filling holes in an embodiment of the present invention;

[0042] Figure 6 This is an example of an interest image obtained by performing a dot product between the ROI mask and the preprocessed image in an embodiment of the present invention;

[0043] Figure 7 This is an example of using the optimal threshold to perform threshold segmentation on the interest image to obtain the final segmented image in an embodiment of the present invention. Detailed Implementation

[0044] The principles and spirit of the invention will now be described with reference to several exemplary embodiments. It should be understood that these embodiments are given merely to enable those skilled in the art to better understand and implement the invention, and are not intended to limit the scope of the invention in any way. Rather, these embodiments are provided to make this disclosure more thorough and complete, and to fully convey the scope of this disclosure to those skilled in the art.

[0045] To address the technical challenges of threshold optimization and insufficient segmentation accuracy in radar image oil spill detection caused by complex marine environments (such as sea clutter interference, high-intensity ship noise, and grayscale confusion between oil spill and background), this invention proposes an intelligent oil spill detection method and system that integrates an autoencoder, Q-learning reinforcement learning, and an improved bat algorithm. Traditional bat algorithms suffer from drawbacks in the oil spill segmentation threshold optimization process, including poor adaptability of the initialization strategy (easily generating a large number of invalid low-threshold solutions), tendency to get trapped in local optima during iterative updates, and difficulty in balancing the high grayscale features and spatial continuity of the oil spill area in the fitness function. These shortcomings lead to problems such as background misjudgment, fragmentation of the oil slick area, and low boundary fit in the segmentation results. This invention focuses on the high grayscale range of the oil spill area to reduce invalid searches; it introduces a global update with random perturbation and a local optimization mechanism with adaptive decay step size to improve the algorithm's global exploration and local convergence capabilities; it constructs a multi-constraint fitness function that integrates Otsu inter-class variance, high threshold penalty term and foreground proportion penalty term to enhance the adaptability to the grayscale characteristics and spatial distribution of the oil spill area; and finally achieves adaptive and accurate extraction of the oil spill area under complex interference.

[0046] This invention proposes a method for detecting marine oil spills based on reinforcement learning and an improved bat algorithm, such as... Figure 1 As shown, the method includes:

[0047] S1. Preprocess the acquired radar images;

[0048] S2. Use the K-means clustering algorithm to generate pseudo-labels for the preprocessed image; the pseudo-labels for each pixel in the preprocessed image include background, suspected oil spill, and oil spill.

[0049] S3. Use an autoencoder to extract features from the preprocessed image;

[0050] S4. Reinforcement learning is used to classify the preprocessed image, and the region classified as oil spill in the classification result is extracted as the region of interest, thereby obtaining the image of interest; wherein, in reinforcement learning, the features extracted by the autoencoder are used as the state, and the reward value is calculated based on the pseudo label;

[0051] S5. The optimal segmentation threshold is obtained by using the improved bat algorithm, and the interest image is segmented using the optimal segmentation threshold to obtain a segmented image based on the optimal segmentation threshold, thereby realizing oil spill detection.

[0052] First, in S1, the acquired radar images are preprocessed.

[0053] According to an embodiment of the present invention, the preprocessing includes: coordinate transformation, detection and suppression of co-frequency interference, speckle noise filtering, grayscale correction, and contrast enhancement. Specifically, firstly, the radar data in the original polar coordinate system is transformed to the Cartesian coordinate system to adapt to the conventional image processing flow; then, a convolution kernel is used to perform convolution operations on the image to initially enhance edge features and suppress some noise interference; based on this, a grayscale threshold of 150 is set to extract possible co-frequency interference regions in the image, and mean filtering is used to smooth and remove them; to further eliminate speckle noise, a grayscale threshold of 120 is used to screen bright pixels in the entire image, and bright connected regions with a pixel area of ​​less than 200 in the upper 1 / 3 of the image are identified as typical speckle noise, and noise suppression is completed by 20×20 window mid-range filtering; subsequently, the grayscale distribution of the entire image is adjusted as a whole through a grayscale adjustment matrix to optimize image contrast and visual effect; finally, local contrast enhancement processing is performed on the roughly rectangular area where the oil film target is located to further enhance the oil film features and improve its distinction from the surrounding background. Figure 2 The preprocessed image is shown.

[0054] Then, in S2, the K-means clustering algorithm is used to generate pseudo-labels for the preprocessed image.

[0055] According to an embodiment of the present invention, in the absence of real labeled data, a K-means clustering algorithm is used to generate pseudo-labels. Specifically, this includes: randomly selecting k sample points (pixels) from the sample space (image pixel matrix) as initial cluster centers; calculating the distance from each sample to each cluster center (usually using Euclidean distance) and assigning it to the nearest cluster; for each cluster, calculating the mean of the samples it contains and updating the cluster centers accordingly; repeating the above steps until the cluster center positions are stable or a preset maximum number of iterations is reached. The core objective of the K-means clustering algorithm is to achieve optimal data partitioning by minimizing the sum of squared errors (SSE) between sample points and their respective cluster centers.

[0056] The K-means clustering algorithm is used to perform three-class classification on the preprocessed image to generate pseudo-labels. This includes: assuming that the gray value of the pixel is used as the feature, running K-means to obtain three clusters; manually or automatically assigning a semantic name to each cluster, for example, the highest gray value in the cluster center corresponds to the background, the middle value corresponds to suspected oil spill, and the lowest value corresponds to oil spill; in this way, each pixel is assigned a pseudo-label. Figure 3 The image shows the three-classified images, where light blue corresponds to oil spill, dark blue corresponds to the background, and yellow corresponds to suspected oil spill.

[0057] Then, in S3, an autoencoder is used to extract features from the preprocessed image.

[0058] According to an embodiment of the present invention, 1000 5×5 pixel image patch samples are randomly selected from the preprocessed image as training samples for the autoencoder. Each image patch, with its center pixel as a reference, contains local spatial information within the neighborhood of that pixel. This sampling method can preserve the local spatial features of pixels.

[0059] An autoencoder consists of two parts: an encoder and a decoder. The encoder maps a high-dimensional input x to a low-dimensional hidden layer feature h.

[0060] ;

[0061] In the formula, x is a vectorized image patch; The encoder weight matrix enables compression from a 25-dimensional input to 8-dimensional features; It is the bias vector; It is the sigmoid activation function.

[0062] The decoder reconstructs the low-dimensional hidden layer features h back into the original input space. :

[0063] ;

[0064] In the formula, This is the decoder weight matrix; This is the decoder bias.

[0065] The training objective of an autoencoder is to optimize network parameters by minimizing the mean squared error (MSE) between the input and the reconstructed output. Its loss function... Defined as:

[0066] ;

[0067] In the formula, For the m-th input image patch; The corresponding reconstruction result is given; M is the number of training samples, which is set to 1000 in this embodiment.

[0068] After the autoencoder is trained, for each pixel in the image, its 5×5 neighborhood is extracted to form an image patch, which is then input into the trained autoencoder to obtain the corresponding 8-dimensional feature vector. Finally, a feature matrix with the same size as the input image is generated, where each pixel corresponds to an 8-dimensional feature representation.

[0069] Furthermore, the principal component analysis (PCA) algorithm is used to reduce the dimensionality of the feature matrix, compressing the 8-dimensional features into 3 dimensions to obtain a three-dimensional feature vector, which provides a feature basis for the automatic extraction of oil spill targets.

[0070] Then, in S4, reinforcement learning is used to classify the preprocessed image and extract the region classified as oil spill from the classification results as the region of interest, thereby obtaining the image of interest; wherein, in reinforcement learning, the features extracted by the autoencoder are used as the state, and the reward value is calculated based on the pseudo label.

[0071] According to an embodiment of the present invention, in image segmentation tasks, the Q-learning reinforcement learning algorithm achieves pixel-level classification by constructing a state-action value mapping. First, a two-dimensional Gaussian filter is used to smooth the image to reduce noise. Then, the feature matrix (three-dimensional feature vector) after PCA dimensionality reduction is discretized again into a certain number (e.g., 50) of states using K-Means clustering. The state of each pixel is determined by the pseudo-label of its K-Means clustering. The action space is defined as {1,2,3}, corresponding to the three categories of oil spill, background, and suspected oil spill, respectively. The agent's action selection is the final classification result of the pixel. Based on the state and action space, a Q-table initialized to all zeros is constructed. Q(s, a) represents the value estimate of an agent performing action a in state s, i.e., the cumulative discounted reward brought by the action.

[0072] The core of the Q-learning training process is to iteratively update the Q-table based on the Bellman equation. Each iteration follows the following steps: First, a pixel (x, y) is randomly selected from the image to simulate the agent's random exploration behavior in the environment. Then, a single round of training is executed, sequentially performing state acquisition and action selection based on the ε-greedy policy for each pixel.

[0073] ;

[0074] In the formula, ε is the exploration rate; U({1,2,3}) represents the random selection of actions 1 to 3; This indicates selecting the action with the highest value in the current state. ; The numbers are uniformly distributed random numbers; This indicates that when the agent is in state s, it performs an action. The obtained Q value.

[0075] After action selection, the reward value is calculated by comprehensively considering the accuracy of pixel classification and neighborhood consistency. :

[0076] ;

[0077] In the formula, As a reward for classification accuracy, if action a matches the pseudo-label generated by K-Means clustering, a positive reward is given; otherwise, a penalty is given. q is the neighborhood consistency weight adjustment coefficient, which is set to 0.3 in this embodiment. This represents the number of pixels in the current pixel's 8-neighborhood that have been classified as action 'a'. The neighborhood consistency coefficient ensures the spatial continuity of the segmentation results and avoids fragmentation.

[0078] Then, perform the Q-value update using the following formula:

[0079] ;

[0080] In the formula, α is the learning rate, which controls the update magnitude of each Q value; γ is the discount factor, which measures the weight of future rewards. The next state obtained after performing action a; This represents the updated Q value; For the next state Find the optimal Q value for all possible actions.

[0081] Finally, through iterative optimization, the Q-table converges to a stable state. At this point, the optimal action for each state is the optimal classification decision for that pixel, thus achieving unsupervised automatic extraction of oil spill areas from radar images. The classification results are as follows: Figure 4 As shown.

[0082] Further, regions classified as "oil spill" in the classification results are extracted as regions of interest (ROIs). These ROIs are then extracted, spots are removed, and holes are filled to obtain the ROI mask, as shown below. Figure 5 As shown; then, the ROI mask is multiplied by the preprocessed image to obtain the interest image, as shown. Figure 6 As shown.

[0083] Then, in S5, the improved bat algorithm is used to obtain the optimal segmentation threshold, and the interest image is segmented using the optimal segmentation threshold to obtain a segmented image based on the optimal segmentation threshold, thereby realizing oil spill detection.

[0084] According to an embodiment of the present invention, the bat algorithm is a metaheuristic optimization algorithm based on swarm intelligence, which simulates the echolocation (biosonar) behavior of micro-bats during foraging. Micro-bats possess an amazing ability: they fly in the dark, perceiving their environment by emitting high-frequency sound wave pulses and listening to the echoes reflected from surrounding objects (such as obstacles or prey); they can autonomously adjust the frequency of the emitted pulses according to the distance to their prey. Wavelength, loudness (Volume) and Pulse Emission Rate Typically, when searching for prey, the impulse loudness is high and the impulse rate is low; as they approach prey, the loudness decreases and the impulse rate increases to achieve precise localization. To translate this natural behavior into a computational model, the bat algorithm makes the following idealized assumptions: all bats use echolocation to perceive distance and can somehow distinguish prey (optimal solution) from background obstacles (non-optimal areas); bats move at a certain speed from a certain location... During random flight, bats automatically adjust the frequency (or wavelength) and loudness of their emitted pulses based on their proximity to the current optimal solution. Assuming the loudness can vary from a large positive value to a minimum, when a bat spots prey, its loudness decreases while its pulse emission rate increases. This adjustment of pulse emission rate and loudness is essentially a mechanism for local searching near the optimal solution. When all bats converge towards the optimal position, it's equivalent to shifting from global exploration to local development.

[0085] In the traditional bat algorithm, 1) parameter - frequency of emitted pulses: used to control the step size range of bat position updates, the frequency of the i-th bat. Randomly generated, the formula is:

[0086] ;

[0087] In the formula, , These are the upper and lower limits of the frequency. ~U(0,1) is a uniformly distributed random number, ensuring that the frequency fluctuates randomly within the effective range.

[0088] 2) Parameters - Loudness and Impulse Emission Rate: Loudness is used to characterize the reliability of the solution, and impulse emission rate is used to characterize the probability of the bat's vocalization. The iterative update formulas for both are as follows:

[0089] ;

[0090] In the formula, Let be the loudness of the i-th bat in the t-th iteration; The loudness of the previous iteration; This is the loudness attenuation coefficient;

[0091] ;

[0092] In the formula, Let be the pulse emission rate of the i-th bat in the t-th iteration; γ is the pulse emission rate growth coefficient. This represents the initial pulse emission rate.

[0093] The traditional bat algorithm has a single position update rule and is prone to getting trapped in local optima. The embodiments of the present invention introduce improved strategies in the global search and local search stages respectively.

[0094] 1) Global Position Update: A normally distributed random perturbation is introduced into the velocity update formula to break the local optimum trap and improve search diversity. The velocity update formula is as follows:

[0095] ;

[0096] ;

[0097] In the formula, This represents the speed of the i-th bat in the t-th iteration; This represents the position of the i-th bat in the t-th iteration; This is the globally optimal threshold at the t-th iteration; ~N(0,1) represents a random variable. It follows a normal distribution with a mean of 0 and a variance of 1; k is the random disturbance intensity adjustment coefficient, which is set to 0.01 in this embodiment; , These represent the upper and lower limits of the search space, respectively.

[0098] 2) Local Fine-grained Search: Traditional bat algorithm uses a fixed step size. This embodiment of the invention designs a step size that decreases with the number of iterations t. In the early stage of iteration, a large step size is used for global exploration, and in the later stage, a small step size is used for fine-grained optimization.

[0099] ;

[0100] ;

[0101] In the formula, S is the iteration step size; δ~N(0,1) represents the random variable. It follows a normal distribution with a mean of 0 and a variance of 1; l is the step size decay rate adjustment coefficient, which is set to 0.2 in this embodiment; T represents the maximum number of iterations.

[0102] Traditional bat algorithms use only a single metric as the fitness function, failing to balance the high threshold preference and foreground proportion constraints in oil spill segmentation. This invention proposes a fitness function that integrates multiple constraints. The goal is to minimize the fitness value.

[0103] ;

[0104] In the formula, To avoid the minimum value where the denominator is 0; Indicates the variance between Otsu classes; This is the threshold preference adjustment coefficient. This embodiment sets the foreground proportion constraint strength adjustment coefficient. It is 0.3. The value is 0.2, where "potential" refers to the oil spill area and suspected oil spill area; improvement items , indicating a high threshold penalty term, Effective pixel mean; Improvement item Forward ratio penalty item, N is the number of foreground pixels, and N is the total number of effective pixels. "Effective pixels" refers to pixels that contain valid information after preprocessing to remove invalid background from the image. This is a dynamic weighting factor used to reinforce the high-threshold preference and foreground ratio constraints in the fitness function. It increases linearly with the number of iterations, as shown in the formula:

[0105] ;

[0106] In the formula, c is the initial weight adjustment coefficient, and d is the weight growth rate adjustment coefficient. In this embodiment, c is set to 0.004 and d is set to 0.5.

[0107] After obtaining the optimal threshold using the improved bat algorithm, the interest image is segmented using the optimal threshold. The segmented image is shown below. Figure 7 As shown.

[0108] Further processing following S5 includes fusing the segmented image based on the optimal segmentation threshold into the preprocessed image and converting the result back to polar coordinates.

[0109] This invention also proposes a marine oil spill detection system based on reinforcement learning and an improved bat algorithm, used to implement the marine oil spill detection method based on reinforcement learning and an improved bat algorithm described in the above embodiments; the system includes:

[0110] The data preprocessing module is configured to preprocess the acquired radar images;

[0111] The pseudo-label generation module is configured to use the K-means clustering algorithm to generate pseudo-labels for the preprocessed image; the pseudo-labels for each pixel in the preprocessed image include background, suspected oil spill, and oil spill.

[0112] The feature extraction module is configured to extract features from the preprocessed image using an autoencoder;

[0113] The region of interest extraction module is configured to use reinforcement learning to classify the preprocessed image and extract the region of interest that is classified as oil spill in the classification result, thereby obtaining the region of interest; wherein, in the reinforcement learning, the features extracted by the autoencoder are used as the state, and the reward value is calculated based on the pseudo label.

[0114] The optimal segmentation module is configured to obtain an optimal segmentation threshold using an improved bat algorithm, and to segment the image of interest using the optimal segmentation threshold to obtain a segmented image based on the optimal segmentation threshold, thereby realizing oil spill detection.

[0115] The functionality of the marine oil spill detection system based on reinforcement learning and improved bat algorithm described in this embodiment of the invention can be explained by the aforementioned marine oil spill detection method based on reinforcement learning and improved bat algorithm. Therefore, for the parts not described in detail in the system embodiment, please refer to the above method embodiment, and they will not be repeated here.

[0116] While the spirit and principles of the invention have been described with reference to several specific embodiments, it should be understood that the invention is not limited to the disclosed specific embodiments, and the division of aspects does not imply that features in these aspects cannot be combined for benefit; such division is merely for ease of description. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims

1. A marine oil spill detection method based on reinforcement learning and an improved bat algorithm, characterized in that, include: S1. Preprocess the acquired radar images; S2. Use the K-means clustering algorithm to generate pseudo-labels for the preprocessed image; The pseudo-labels for each pixel in the preprocessed image include background, suspected oil spill, and oil spill. S3. Use an autoencoder to extract features from the preprocessed image; S4. Reinforcement learning is used to classify the preprocessed image, and the region classified as oil spill in the classification result is extracted as the region of interest, thereby obtaining the image of interest; wherein, in reinforcement learning, the features extracted by the autoencoder are used as the state, and the reward value is calculated based on the pseudo label; S5. The improved bat algorithm is used to obtain the optimal segmentation threshold, and the interest image is segmented using the optimal segmentation threshold to obtain a segmented image based on the optimal segmentation threshold, thereby achieving oil spill detection. In the improved bat algorithm, a normally distributed random perturbation is introduced into the speed update formula of the individual bats during the global search phase. The speed update formula is then: ; In the formula, This represents the speed of the i-th bat in the t-th iteration; This represents the position of the i-th bat in the t-th iteration; This represents the frequency of the i-th bat; This is the globally optimal threshold at the t-th iteration; ~N(0,1) represents a random variable. It follows a normal distribution with a mean of 0 and a variance of 1; k is the random disturbance intensity adjustment coefficient; , These represent the upper and lower limits of the search space, respectively. In the improved bat algorithm, the iteration step size in the local search phase decreases with the number of iterations t, and the position update formula is: ; In the formula, S represents the iteration step size. l is the step size decay rate adjustment coefficient. , Let δ represent the upper and lower bounds of the search space, respectively; T represents the maximum number of iterations; δ~N(0,1) represents the random variable. It follows a normal distribution with a mean of 0 and a variance of 1; This is the globally optimal threshold at the t-th iteration.

2. The marine oil spill detection method based on reinforcement learning and improved bat algorithm according to claim 1, characterized in that, The preprocessing described in S1 includes: coordinate transformation, detection and suppression of co-frequency interference, speckle noise filtering, grayscale correction, and contrast enhancement.

3. The marine oil spill detection method based on reinforcement learning and improved bat algorithm according to claim 1, characterized in that, In S3, after using an autoencoder to extract features from the preprocessed image and obtain the corresponding high-dimensional feature vector, the principal component analysis algorithm is used to reduce the dimensionality of the high-dimensional feature vector to obtain a three-dimensional feature vector.

4. The marine oil spill detection method based on reinforcement learning and improved bat algorithm according to claim 3, characterized in that, The specific steps of S4 include: discretizing the three-dimensional feature vector into a certain number of states using K-means clustering; the state of each pixel in the image is determined by the pseudo-label to which the feature extracted by its corresponding autoencoder belongs; the action space is defined as {1,2,3}, corresponding to the three categories of oil spill, background, and suspected oil spill, respectively; the agent's action selection is the final classification result of the pixel; and the reward value... The calculation formula is: ; In the formula, As a reward for classification accuracy, if action a matches the pseudo-label, a positive reward is given; otherwise, a penalty is given. q is the neighborhood consistency weight adjustment coefficient. This represents the number of pixels in the current pixel's 8-neighborhood that have been classified as action 'a'. is the neighborhood consistency coefficient.

5. The marine oil spill detection method based on reinforcement learning and improved bat algorithm according to claim 1, characterized in that, In the improved bat algorithm described in S5, the fitness function is calculated using the following formula: ; In the formula, ϵ represents the minimum value to avoid a denominator of 0; Indicates the variance between Otsu classes; This is the threshold preference adjustment coefficient. This is the adjustment coefficient for the proportion of constraint intensity in the foreground, where the foreground refers to the oil spill area and the suspected oil spill area; , indicating a high threshold penalty term, The effective pixel average; , indicating a foreground ratio penalty item, Where N is the number of foreground pixels and N is the total number of effective pixels; It is a dynamic weighting factor used to strengthen the weights of high threshold preference and foreground ratio constraints in the fitness function.

6. The marine oil spill detection method based on reinforcement learning and improved bat algorithm according to claim 5, characterized in that, The formula for calculating the dynamic weighting factor is as follows: ; In the formula, c is the initial weight adjustment coefficient, and d is the weight growth rate adjustment coefficient.

7. A marine oil spill detection system based on reinforcement learning and an improved bat algorithm, characterized in that, The system is used to implement the marine oil spill detection method based on reinforcement learning and improved bat algorithm as described in any one of claims 1-6; the system comprises: The data preprocessing module is configured to preprocess the acquired radar images; The pseudo-label generation module is configured to use the K-means clustering algorithm to generate pseudo-labels for the preprocessed image; the pseudo-labels for each pixel in the preprocessed image include background, suspected oil spill, and oil spill. The feature extraction module is configured to extract features from the preprocessed image using an autoencoder; The region of interest extraction module is configured to use reinforcement learning to classify the preprocessed image and extract the region of interest that is classified as oil spill in the classification result, thereby obtaining the region of interest; wherein, in the reinforcement learning, the features extracted by the autoencoder are used as the state, and the reward value is calculated based on the pseudo label. The optimal segmentation module is configured to obtain an optimal segmentation threshold using an improved bat algorithm, and to segment the image of interest using the optimal segmentation threshold to obtain a segmented image based on the optimal segmentation threshold, thereby realizing oil spill detection.