A target detection method under special weather conditions under visible light based on YOLOv7

By using the YOLOv7 algorithm and transfer learning techniques, a target recognition model was constructed. Causal inference was used to remove the influence of weather background, which solved the problems of accuracy and real-time performance in maritime target recognition under special weather conditions, and achieved efficient maritime target detection.

CN117315342BActive Publication Date: 2025-11-28AEROSPACE SCI & IND SHENZHEN GROUP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311220921.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-20
Publication Date
2025-11-28
Estimated Expiration
2043-09-20

AI Technical Summary

Technical Problem

Under special weather conditions in visible light, traditional target detection algorithms struggle to identify and track maritime targets. In particular, under severe weather conditions such as heavy fog and strong winds, changes in target features, noise interference, and overlapping ship identification lead to a decrease in recognition accuracy and real-time performance.

Method used

A target recognition model is constructed using the YOLOv7 algorithm. By utilizing transfer learning techniques and causal inference methods, the model is trained using source domain data. A loss function is designed to remove the influence of weather background, optimize target feature extraction, and improve recognition accuracy.

Benefits of technology

It significantly improves the accuracy of maritime target identification under special weather conditions, solves the problem of missed detection of small vessels and overlapping vessels, shortens the identification time, adapts to a wide range of weather conditions, and is applicable to the field of vehicle identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117315342B_ABST
    Figure CN117315342B_ABST
Patent Text Reader

Abstract

The application discloses a target detection method under special weather conditions under visible light based on YOLOv7, and relates to the technical field of image processing under visible light. The method constructs a target recognition model based on a YOLOv7 algorithm, collects source domain data and target domain data, constructs a training set and a test set after preprocessing, encodes information in training set images into targets and weather backgrounds respectively by using an encoder network of YOLOv7, maps the information to a feature space to obtain target feature information and background feature information, designs a loss function in the encoder network according to the feature information, optimizes and trains the target recognition model, removes the influence of the background on the target recognition result, and finally tests the model by using the test set. The technical solution in the application can improve the accuracy of the target recognition model in identifying targets under abnormal weather, solves the problem of insufficient data during training, has a wide range of applications and a short running time.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of image processing under visible light, in particular to a special weather sea target detection method based on YOLOv7 under visible light. BACKGROUND

[0002] Under special weather conditions such as heavy fog and strong wind, the appearance, size, shape and other characteristics of the sea target will be affected, which makes it difficult for traditional target detection algorithms to identify and track the target. In the prior art, special weather target recognition mainly uses traditional image processing and machine learning techniques, including template matching-based target recognition technology, feature extraction-based target recognition technology and neural network-based target recognition technology. These technologies have certain limitations in dealing with the problem of sea target recognition under complex weather conditions, specifically: 1. Under special weather conditions, the appearance, size, shape and other characteristics of the sea target may change, affecting the accuracy and real-time performance of traditional target recognition algorithms; 2. Traditional machine learning algorithms often require a large amount of labeled data for training and adjustment, but it is difficult to obtain labeled data under special weather conditions, making it difficult for traditional target recognition algorithms to effectively solve the problem of sea target recognition; 3. Under special weather conditions such as heavy fog and strong light, there are a lot of noise and light spots in the image, which will affect the appearance characteristics and contour information of the target, making it difficult for traditional target recognition algorithms to accurately identify the target; 4. Under weather conditions such as strong wind, the sea is turbulent, and the position, direction and other information of the target object will change, making it difficult for traditional target tracking algorithms to accurately track the target, affecting the real-time performance of the target recognition algorithm; 5. In traditional machine learning algorithms, different features often need to be manually extracted, which makes it difficult to extract target features under special weather conditions, affecting the accuracy of the target recognition algorithm.

[0003] In sea target detection, there is also the case of overlapping ships. The target recognition method used in the prior art will also have missed detection when identifying ships that overlap together. Furthermore, the target recognition method used in the prior art will miss small-sized ships when identifying ships, which will reduce the overall recognition accuracy. SUMMARY

[0004] The purpose of the present application is to solve the problem of target detection algorithm being difficult to identify and track the target due to special weather conditions in the prior art. The transfer learning technology is used to train the target recognition model with the information of the source domain data, so that the target recognition model can accurately identify the sea target under special weather conditions and shorten the running time of identifying the target.

[0005] The technical scheme of the present application is: a target detection method under special weather conditions under visible light based on YOLOv7 is provided, which comprises the following steps:

[0006] Step 1, constructing a target recognition model based on YOLOv7 algorithm;

[0007] Step 2, collecting source domain data for pretreatment as a training set, wherein the source domain data is an image set containing a recognized target taken in a sea area under sunny conditions;

[0008] Step 3, using the encoder network of YOLOv7 to encode the information of the images in the training set into targets and weather backgrounds respectively, and mapping the targets and weather backgrounds to obtain target feature information and background feature information respectively;

[0009] Step 4, designing a loss function according to the target feature information and the background feature information, optimizing and training the target recognition model, and removing the influence of the weather background on the target recognition result;

[0010] Step 5, obtaining a test set, and testing the trained target recognition model using the test set.

[0011] Further, the information encoding process of the training set images in the YOLOv7 encoder network in step 3 is as follows:

[0012] The encoder network of YOLOv7 identifies the images in the training set and extracts the information of the images to obtain image features, the extracted image features including targets and weather backgrounds, the target being defined as o in the YOLOv7 encoder network, o∈O, O being a set of all targets; the weather background being defined as a in the YOLOv7 encoder network, being a set of all weather backgrounds.

[0013] Further, the process of mapping the target and weather background to obtain target feature information and background feature information in step 3 is as follows:

[0014] The mapping g in YOLOv7 projects the extracted features in the image to a feature space to obtain an overall picture feature vector x, wherein the target and the background are mapped to the feature space to obtain a target feature vector φ o and a background feature vector φ a , the mapping g being denoted as g(φ a ,φ o )=x, the mapping being a reversible mapping, the inverse mapping of the target being and the inverse mapping of the background being

[0015] target feature vector φo The target feature information is included, and the representation of the target in the feature space is set as Φ O , Φ O ∈R O , R O is the real number field of O, φ o ∈Φ O , and the distribution of the target feature vector φ o is h o is the mean of the distribution, is the variance of the distribution, and e is a unit vector; the background feature vector φ a includes background feature information, and the representation of the weather background a is set as , is the real number field of O, the distribution of the background feature vector φ a is h a is the mean of the distribution, is the variance of the distribution.

[0016] Further, step 4 includes the following steps:

[0017] Design a loss function according to the target feature information and the background feature information

[0018]

[0019] Step 4.1, to fit the distribution of O features and the loss function is designed

[0020] wherein, is the data loss, is the loss function for distinguishing positive and negative samples, and λ is a hyperparameter for balancing the weights of different loss terms;

[0021] Step 4.2, to remove the causal relationship between the background and the target, a composite loss function is designed

[0022]

[0023] wherein λ rep represents a coefficient, is a constant, is a multi-label classification loss function, is a repulsion loss, and the formula is:

[0024]

[0025]

[0026] wherein the calculation formula of I is u represents the label of background feature information, v represents the label of target feature information, Y represents the feature space where the output is located, y represents the label of the output, HISC is the Hilbert Schmidt information criterion, and the specific formula is as follows:

[0027]

[0028] wherein the matrix element is K, L and H represent matrices, i is a row, and j is a column;

[0029] The encoder network converts the target feature vector φ o and the background feature vector φ a As variables in the causal relationship, the causal relationship between the background feature and the target recognition result is obtained through the causal inference method, and the influence of the causal relationship is removed, so that the target recognition model obtains a pure target feature vector x' after feature extraction;

[0030] Step 4.3, set the batch for training and learning of the target recognition model, and train and learn according to the batch to optimize the model;

[0031] The batch for training and learning is denoted as wherein n is a positive integer greater than 0, u i represents the label of background feature information, v i represents the label of target feature information, and y i represents the label of the output;

[0032] The target recognition model is trained so that it can convert the target feature vector φ o into a pure target feature vector x', and finally map to the output space to obtain the output y, y∈R k wherein k is the number of target categories, R k represents the real number field of the output, and the final output result y of the target recognition model includes the number and position information of the ship; the mapping process of the target recognition model can be represented as:

[0033] y=f(x';θ)

[0034] wherein f is the target recognition model, and θ is the parameter of the model;

[0035] The training process of the target recognition model is performed using a standard supervised learning method, which optimizes the parameters of the model by minimizing the objective function; the cross-entropy loss function is used to measure the difference between the model's prediction and the true label, and the model is trained by minimizing the cross-entropy loss, as follows:

[0036]

[0037] where N is the number of training data, y ij is the true output label of the i-th sample, f(x i ; θ) j is the probability of the j-th class predicted by the model for the i-th sample; by minimizing the cross-entropy loss function, accurate classification can be obtained; the optimized target recognition model parameter θ * :

[0038]

[0039] Further, the target recognition model testing process is as follows:

[0040] The target domain data is input into the target recognition model, and the information of the images in the target domain data is encoded into target and weather background in the target recognition model, and mapped into the feature space to obtain target feature information and background feature information, then the influence of weather background on target recognition result is removed to obtain pure target feature vector, the pure target feature vector is mapped to the output space to obtain the output, the target recognition model completes the recognition, and finally the number and position of the ships are obtained.

[0041] Further, the preprocessing in step 2 includes image cropping, scale adjustment, and image enhancement.

[0042] First, the image is cropped to remove the blank area, background area, other targets and occlusion part in the image, wherein the blank area refers to the area in the image without weather background information and target information, the background area refers to the surrounding area in the image unrelated to the weather background information and target information, the other target refers to the target unrelated to the current target in the image, and the occlusion part refers to the part of the image that occludes the target.

[0043] Second, the image is scaled and enhanced, the image size is adjusted based on the encoder network in YOLOv7, the noise in the image is reduced using denoising technology, and the brightness and contrast of the image are adjusted.

[0044] Further, the test set method in step 5 is as follows:

[0045] Select a target sea area, take pictures of ships sailing on the sea area under special weather conditions, take the image set obtained by shooting as the target domain data, preprocess the target domain data and form a training set, and the preprocessing method and step 2 are the same.

[0046] The beneficial effects of the present application are:

[0047] First, the technical solution in the present application establishes a target recognition model based on the YOLOv7 algorithm, and redesigns the loss function to change the training method of the encoder network in YOLOv7, so that after the encoder network extracts features from the image, it uses the causal inference method to remove the influence of the weather background on the sea target recognition result, thereby improving the accuracy of the target recognition model and recognizing more sea targets under special weather conditions; The technical solution in the present application can also solve the problem of missing small ships and overlapping ships. The target recognition model can remove the influence of the weather background and better learn the features of the recognized target when learning and training under the action of the designed loss function, and it is easier to distinguish ships when identifying small ships and overlapping ships. Compared with the traditional sea target recognition method, the technical solution in the present application can more accurately identify the target and has a short running time.

[0048] Second, the technical solution in the present application uses transfer learning technology to use the image set containing sea recognition targets taken under sunny conditions as a training set to train the target recognition model, so that the target recognition model can recognize sea targets under special weather conditions such as rainy and foggy days after learning and training, avoiding the drawbacks of traditional training target recognition model methods, such as: 1. Difficulty in collecting training set data. The traditional learning and training method needs to use the image set containing sea recognition targets taken under special weather conditions as a training set, but it is difficult to take pictures of sea targets under special weather conditions, and it is difficult to collect a large number of images. 2. Difficulty in labeling training set data. The traditional learning and training method needs to manually label the training set images, but it is difficult and time-consuming to label the images containing sea recognition targets taken under special weather conditions. The technical solution in the present application only needs to collect existing images containing sea recognition targets taken under sunny conditions in the database as a training set, and the images are clear and convenient for preprocessing.

[0049] Third, the technical solution in the present application can adapt to sea target recognition under various special weather conditions, and has a wider application range. This method can be applied in different fields to identify different targets, such as vehicle identification. BRIEF DESCRIPTION OF DRAWINGS

[0050] Figure 1 is a flowchart according to an embodiment of the present application;

[0051] Figure 2 is a schematic diagram of an encoding process according to an embodiment of the present application;

[0052] Figure 3 is a schematic diagram of a feature vector distribution in a feature space according to an embodiment of the present application;

[0053] Figure 4 is a comparison diagram of recognition effects of a missed detection situation according to an embodiment of the present application;

[0054] Figure 5 is a comparison diagram of recognition effects under special weather conditions according to an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the present application will be further described in detail below in combination with the drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0056] In the following description, many specific details are set forth in order to provide a thorough understanding of the present application, however, the present application can also be implemented in other ways different from those described herein, therefore, the scope of protection of the present application is not limited by the specific embodiments disclosed below.

[0057] As shown in Figure 1 , the present embodiment provides a target detection method under special weather conditions under visible light based on YOLOv7, and the steps are as follows:

[0058] Step 1, constructing a target recognition model based on YOLOv7 algorithm.

[0059] Step 2, collecting source domain data from the database for pretreatment as a training set, wherein the source domain data is an image set containing target ships photographed in the sea area under sunny conditions.

[0060] The source domain data is used to train the target recognition model, and these images are photographed in the same or similar sea area as the images to be recognized. In the present embodiment, a large number of image sets containing recognized target ships under sunny conditions and covering various scenes and background conditions in the sea area need to be collected. The existing image sets photographed in the sea area are collected through various channels, and when the number of existing image sets is not enough, the data is supplemented by combining unqualified images with generated ship images to form qualified images, such as combining sea area images without ships and ship images under sunny conditions to form images containing target ships under sunny conditions.

[0061] The source domain data is preprocessed. First, the image is cropped to remove blank areas, background areas, other targets, and occluded parts. Background areas refer to areas unrelated to the target; other targets refer to objects or objects unrelated to the current target; and occluded parts refer to portions of the image where the target is obscured. Then, the image is scaled and enhanced to allow images of different sizes to be processed by the encoder network in YOLOv7. When scaling the image, it's crucial to maintain the aspect ratio and avoid distortion. Filtering is used to reduce noise, and brightness and contrast are adjusted. Enhancement filtering is applied to improve edge sharpness and detail, making the image appear clearer.

[0062] Step 3: Input the training set obtained in Step 2 into the target recognition model, use the encoder network of YOLOv7 to encode the information of the images in the training set into the target and the weather background respectively, and map the target and the background to the feature space to obtain the target feature information and the background feature information respectively.

[0063] like Figure 2 , Figure 3 As shown, the YOLOv7 encoder network recognizes images in the training set and extracts image features from them. These extracted features include the target and the weather background. The target is defined as o in the YOLOv7 encoder network, where o ∈ O, and O is the set of all targets. The weather background is defined as a in the YOLOv7 encoder network. The image is a set of all weather backgrounds; the mapping g in YOLOv7 projects the features extracted from the image onto the feature space to obtain the overall image feature vector x, where the target and background are mapped onto the feature space respectively to obtain the target feature vector φ. o and background feature vector φ a The mapping g is denoted as g(φ) a ,φ o Since ) = x, this mapping is invertible, and the inverse mapping of the target is obtained as follows: The inverse mapping of the background is

[0064] Target feature vector φ o Includes target feature information, background feature vector φ a Includes background feature information; the target representation in the feature space is set as Φ. O , where Φ O ∈R O The representation of weather background a is set as follows: in R O and For O and real number field, where φ o ∈Φ O . The target feature vector φ o is distributed as the background feature vector φ a is distributed as h o and h a are the mean of the distribution, and are the variance of the distribution, e is the unit vector, includes the distribution of all target feature vectors, includes the distribution of all background feature vectors.

[0065] The space where the feature information is located is the feature space, and the target feature information and the background feature information are independent of each other in the feature space. The process of encoding refers to the process of finding and extracting the features in the image by the YOLOv7 encoder network, i.e., the process of finding and extracting the target and weather background in the image to the feature space.

[0066] Finally, the background feature vector φ a and the target feature vector φ o are obtained, and the feature information h a , h o , g, and

[0067] Step 4, according to the target feature information and the background feature information, design a loss function in the target recognition model Use the loss function to adjust the parameters of the target recognition model, remove the influence of the background on the target recognition result, and obtain a pure target feature vector.

[0068] The loss function is a composite loss function, including and L(θ), that is:

[0069]

[0070] Step 4.1, according to the target feature information and the background feature information, fit and O feature distribution, design a loss function

[0071]

[0072] where, is the data loss, is the loss function for distinguishing positive and negative samples, and λ is a hyperparameter for balancing the weights of different parts of the loss function. During the training process, λ is adjusted to better guide the training of the model.

[0073] Fitting refers to minimizing the error between the model's predicted values and the actual observed values through the loss function. The loss function is used to measure the difference between the target detection results and the true situation, and the model parameters are updated through backpropagation. Data is input into the model, and the gradient is calculated through the backpropagation algorithm. The gradient is used to update the weights and biases of the model, so that the model can gradually optimize the prediction results.

[0074] Step 4.2, in order to remove the causal relationship between the background and the target, a composite loss function is designed

[0075]

[0076] where λ rep is a coefficient, is a constant, is a multi-label classification loss function, is a repulsion loss, and The formula is:

[0077]

[0078]

[0079] where the formula for calculating I is u represents the label of the background feature information, v represents the label of the target feature information, Y represents the feature space where the output is located, y represents the label of the output, and HISC is the Hilbert Schmidt information criterion, which is as follows:

[0080]

[0081] where the matrix element K, L, and H represent matrices, i is the row, and j is the column.

[0082] The above loss function contains the setting of target information and weather background information. Under its action, the encoder network of YOLOv7 takes the target feature vector φ o and the background feature vector φ a as variables in the causal relationship, obtains the causal relationship between the background feature and the target recognition result through causal inference, and removes the causal influence of the background feature on the target recognition result, so that the target recognition model obtains a pure target feature vector x' after feature extraction.

[0083] Causal inference is a method for analyzing causal relationships, which can help understand how features affect the target and how to remove these effects. In the target identification task, a causal inference method is used to explore the causal relationship between features and targets and reduce or remove the effect of features on the target identification result.

[0084] In the feature space, the target features and the background features are in a separated state, and the target identification model can better learn the background features and the target features after adding the loss function mentioned above, thereby removing the background effect, and finally obtaining a more pure target feature vector x'.

[0085] Step 4.3, set the batch for training and learning of the target identification model, train and learn according to the batch to adjust the model parameters and optimize the target identification model.

[0086] The batch for training and learning is denoted as wherein n is a positive integer greater than 0, u i represents the label of the background feature information, v i represents the label of the target feature information, y i represents the output label.

[0087] The target identification model is trained and learned inside to better learn the features of the target, so that it can convert the target feature vector φ o into a pure target feature vector x', and finally map to the output space to obtain the output y, y∈R k , where k is the number of target categories, R k represents the real number field of the output, and the final output result y of the target identification model includes the number and position information of the ship. The mapping process of the target identification model can be represented as:

[0088] y=f(x';θ)

[0089] wherein f is the target identification model, and θ is the parameter of the model.

[0090] The training process of the target identification model uses a standard supervised learning method to optimize the parameters of the model by minimizing the objective function. The cross-entropy loss function is used to measure the difference between the model's prediction and the true label, and the model is trained by minimizing the cross-entropy loss to make it better perform the classification task, the formula is as follows:

[0091]

[0092] wherein N is the number of training data, y ij is the true output label of the i-th sample, f(x' i ; θ) jis the probability of the j-th class predicted by the model for the i-th sample. By minimizing the cross-entropy loss function, an accurate classification can be obtained.

[0093] During the training process, optimization algorithms such as stochastic gradient descent (SGD) are used to update the model parameters, so that the target recognition model can better adapt to new maritime target data and achieve efficient and accurate target recognition under special weather conditions.

[0094] Optimized target recognition model parameters θ * :

[0095]

[0096] Step 5, obtain the test set, and test the target recognition model completed training using the test set.

[0097] Take images in the target sea area as the target domain data, and pre-process them to form the training set, wherein the target domain data is a set of images containing target ships taken in the sea area under special weather conditions. The pre-processing method of the target domain data is the same as in step 2.

[0098] The target domain data is input into the target recognition model, and the information of the images in the target domain data is encoded into two parts of target and weather background in the target recognition model, and mapped into a feature space to obtain target feature information and background feature information. Then, the influence of the weather background on the target recognition result is removed to obtain a pure target feature vector, and the pure target feature vector is mapped to an output space to obtain an output, the target recognition model completes the recognition, and finally the number and position of the ships are obtained.

[0099] Through actual data collection, a total of 3500 pictures containing ship information were collected, including ship data under different sea areas and different shooting angles in Bohai Sea, Yellow Sea, South China Sea, etc. The collected pictures were divided into training set, validation set and test set, and the training set, validation set and test set were divided according to the ratio of 6:2:2, that is, the training part was 2100 pictures, the test part was 700 pictures, and the test set was 700 pictures. The images in the training set and the validation set were under sunny conditions, and the images in the test set were under special weather conditions. Under special weather conditions, YOLOv5, YOLOv7 and the technical scheme of the present application were used for ship recognition comparison test, and Table 1 shows the experimental results, including the accuracy and running time of the present application and the comparison algorithm:

[0100] Table 1

[0101] Algorithm Accuracy / % Single image average detection time / ms YOLOv5 71.5 39.25 YOLOv7 85.1 32.43 The technical scheme of the present application 90.6 28.75

[0102] As can be seen from the above table, the offshore target recognition algorithm implemented using the technical solution of the present application is obviously superior to the original YOLOv7 algorithm and YOLOv5 algorithm in terms of accuracy and running time. In terms of accuracy, the algorithm implemented by the technical solution of the present application can reach 90.6%, while the original YOLOv7 algorithm and YOLOv5 algorithm are 85.1% and 71.5% respectively. In terms of running time, the algorithm implemented by the technical solution of the present application only needs 28.75ms, while the original YOLOv7 algorithm and YOLOv5 algorithm are 32.43ms and 39.25ms respectively. The relevant recognition results are shown in Figure 4 , wherein Figure 4 The left side is the partial recognition result of the YOLOv7 algorithm, and the right side is the partial recognition result of the offshore target recognition algorithm implemented by the technical solution of the present application. As can be seen from Figure 4 , the original YOLOv7 algorithm has missed detection for small ships and overlapping ships in the test, and the method proposed by the technical solution of the present application has better improvement for the missed detection problem, and the recognition accuracy is obviously improved compared with the YOLOv7 algorithm.

[0103] At the same time, a foggy ship picture in a certain sea area is selected as the experimental object, and the original YOLOv7 algorithm and the method proposed by the technical solution of the present application are used to recognize the ship target respectively, and the results are as follows Figure 5 , wherein Figure 5 The upper part is the recognition result using the original YOLOv7 algorithm, and the lower part is the result of the method proposed by the technical solution of the present application. The method proposed by the technical solution of the present application obviously improves the ship recognition effect under foggy conditions.

[0104] The steps in the present application can be adjusted in sequence, combined and deleted according to actual needs.

[0105] The units in the device of the present application can be combined, divided and deleted according to actual needs.

[0106] Although the present application is disclosed in detail with reference to the accompanying drawings, it should be understood that these descriptions are only exemplary and are not intended to limit the application of the present application. The scope of protection of the present application is defined by the appended claims, and can include various modifications, improvements and equivalent schemes made to the application without departing from the scope and spirit of the present application.

Claims

1. A target detection method under special weather conditions in visible light based on YOLOv7, characterized in that, The method includes the following steps: Step 1: Construct a target recognition model based on the YOLOv7 algorithm; Step 2: Collect source domain data, preprocess it, and use it as the training set. The source domain data is a set of images of the sea area taken under clear weather conditions that contain the target to be identified. Step 3: Using the YOLOv7 encoder network, the information from the images in the training set is encoded into target and weather background respectively, and the target and weather background are mapped to obtain target feature information and background feature information respectively, including: In YOLOv7, the mapping g projects the extracted features from the image onto the feature space, resulting in the overall image feature vector x. The target and background are mapped into the feature space respectively, yielding the target feature vector φ. o and background feature vector φ a The mapping g is denoted as g(φ) a ,φ o Since ) = x, this mapping is invertible, and the inverse mapping of the target is obtained as follows: The inverse mapping of the background is Target feature vector φ o The distribution is h o The mean of the distribution. Let be the variance of the distribution, and e be a unit vector; φ be the background eigenvector. a The distribution is h a The mean of the distribution. Let be the variance of the distribution, o be the target, and a be the weather background. Step 4: Design a loss function based on target and background feature information, optimize and train the target recognition model, and remove the influence of weather background on the target recognition results, including: Design a loss function based on target and background features. Step 4.1, for fitting Based on the distribution of the O feature, design a loss function. in, For data loss, This is the loss function that distinguishes between positive and negative samples, λ is a hyperparameter used to balance the weights of different loss terms, and O is the set of all objectives. A collection of all weather backgrounds; Step 4.2: To remove the causal relationship between the background and the target, a composite loss function is designed. Where λ rep express One of the coefficients is a constant. For multi-label classification loss function, To avoid losses; Step 4.3: Set up the batch for training the target recognition model, and train the model according to the batch to optimize it; The cross-entropy loss function is used to measure the difference between the model's predictions and the true labels. The model is trained by minimizing the cross-entropy loss so that it can transform the target feature vector into a pure target feature vector x', as shown in the following formula: Where f is the target recognition model, θ is the model parameters, N is the number of training data, and y ij f(x′) is the true output label of the i-th sample. i ;θ) j It is the probability that the model predicts the j-th class for the i-th sample, and k is the number of target classes; Step 5: Obtain the test set and use it to test the trained target recognition model.

2. The target detection method under special weather conditions in visible light based on YOLOv7 as described in claim 1, characterized in that, The information encoding process of the images in the training set in the YOLOv7 encoder network in step 3 is as follows: The YOLOv7 encoder network recognizes images in the training set and extracts image features from the images. The extracted image features include targets and weather background. In the YOLOv7 encoder network, the target is defined as o, o∈O, and O is the set of all targets. The weather background is defined as 'a' in the YOLOv7 encoder network. This is a collection of all weather backgrounds.

3. The target detection method under special weather conditions in visible light based on YOLOv7 as described in claim 2, characterized in that, Step 3 also includes: Target feature vector φ o Including target feature information, the target's representation in the feature space is set as Φ. O Φ O ∈R O R O Let φ be the real number field of O. o ∈Φ O Background feature vector φ a Including background feature information, the representation of weather background 'a' is set as follows: for The real number field, 4. The target detection method under special weather conditions in visible light based on YOLOv7 as described in claim 3, characterized in that, In step 4 and The formula is: The formula for calculating I is: u represents the label of the background feature information, v represents the label of the target feature information, Y represents the feature space in which the output resides, and y represents the label of the output. HISC is the Hilbert-Schmidt Information Criterion, as detailed below: matrix elements K, L, and H represent matrices, o represents rows, and j represents columns; The encoder network will convert the target feature vector φ o and background feature vector φ a As a variable in the causal relationship, the causal relationship between background features and target recognition results is obtained through causal inference methods, and the influence of causal relationship is removed so that the target recognition model can obtain a pure target feature vector x' after feature extraction. Setting up batches for training the target recognition model, and optimizing the model through batch training, also includes: The training batch is denoted as in n is a positive integer greater than 0, u i The label representing background feature information, v i Labels representing target feature information, y i The label representing the output; Train the target recognition model so that it can identify the target feature vector φ o The vector is transformed into a pure target feature vector x', and finally mapped to the output space to obtain the output y, y∈R. k R k The real number field represents the output. The final output y of the target recognition model includes the number and position information of the ships. The target recognition model mapping process can be represented as: y = f(x′;θ) Where f is the target recognition model, and θ is the model parameters; The target recognition model is trained using standard supervised learning methods, optimizing its parameters by minimizing the objective function. The cross-entropy loss function is used to measure the difference between the model's predictions and the true labels; minimizing the cross-entropy loss function yields accurate classification. The optimized target recognition model parameters θ are then used. * :

5. The target detection method under special weather conditions in visible light based on YOLOv7 as described in claim 4, characterized in that, The target recognition model is tested as follows: The target domain data is input into the target recognition model. The image information in the target domain data is encoded into two parts, target and weather background, and mapped into the feature space to obtain target feature information and background feature information. Then, the influence of weather background on the target recognition result is removed to obtain pure target feature vector. The pure target feature vector is mapped into the output space to obtain the output. The target recognition model completes the recognition and finally obtains the number and location of ships.

6. The target detection method under special weather conditions in visible light based on YOLOv7 as described in claim 1, characterized in that, The preprocessing in step 2 includes image cropping, scaling, and image enhancement. First, the image is cropped to remove blank areas, background areas, other targets, and occluded parts. Blank areas refer to areas in the image without weather background information or target information. Background areas refer to surrounding areas in the image that are unrelated to weather background information or target information. Other targets refer to targets in the image that are unrelated to the current target. Occluded parts refer to parts in the image that obscure the target. Secondly, the image is scaled and enhanced. The image scale is adjusted based on the requirements of the encoder network in YOLOv7 for image size. Noise reduction technology is used to reduce noise in the image. The brightness and contrast of the image are also adjusted.

7. The target detection method under special weather conditions in visible light based on YOLOv7 as described in claim 1, characterized in that, The method for obtaining the test set in step 5 is as follows: Select a target sea area, take pictures of ships sailing in the sea area under special weather conditions, use the acquired image set as target domain data, preprocess the target domain data and form a training set, the preprocessing method is the same as in step 2.

Citation Information

Patent Citations

  • Target detection method in haze environment based on YOLOv3 network

    CN115984568A