A target detection method based on dynamic anchor selection

Through random Block data replacement, FPN module decomposition and reconstruction, and dynamic Anchor selection methods to optimize loss function, the problems of insufficient sample size, small target miss detection, incomplete Anchor size ratio and poor detection effects in a few categories are solved, and the accuracy and generalization performance of the detection model are improved.

CN115565022BActive Publication Date: 2025-08-29FUJIAN NEWLAND SOFTWARE ENGINEERING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210978128.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-16
Publication Date
2025-08-29
Estimated Expiration
2042-08-16

AI Technical Summary

Technical Problem

The existing target detection technology has problems such as insufficient sample size, missed detection of small targets, poor detection of blurred images, incomplete coverage of Anchor size ratio, and poor detection effect of a few categories.

Method used

Sample augmentation through random block data replacement, FPN module is built for feature decomposition and reconstruction, and a dynamic Anchor selection module is used to generate matching Anchors, and the loss function is optimized to improve the accuracy of the detection model.

Benefits of technology

It effectively improves the accuracy of object detection and enhances the generalization performance of the model, especially in small-objective and blurred image detection and a few categories of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115565022B_ABST
    Figure CN115565022B_ABST
Patent Text Reader

Abstract

The present invention provides a target detection method based on dynamic anchor selection in the field of target detection technology, comprising the following steps: Step S10, acquiring a large number of images and annotating each image to construct an image dataset; Step S20, expanding the image dataset using random block data replacement; Step S30, constructing a target detection model based on an FPN module and a dynamic anchor selection module; Step S40, training the target detection model using the image dataset; and Step S50, performing target detection using the trained target detection model. The present invention has the advantage of significantly improving the accuracy of target detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of target detection, and in particular to a target detection method based on dynamic anchor selection. Background Art

[0002] With the development of computer technology and the widespread application of computer vision principles, the research on real-time tracking and detection of targets using computer image processing technology has become increasingly popular. Dynamic real-time tracking and positioning of targets has broad application value in intelligent transportation systems, intelligent monitoring systems, military target detection, and positioning of surgical instruments in medical navigation surgery.

[0003] Building a target detection model based on images (picture information) is an effective method for target detection. By inputting the image obtained by the camera into the target detection model, the targets in the image can be detected in real time, providing detection results for subsequent downstream tasks.

[0004] However, traditional target detection still has some problems, mainly manifested in: 1. The sample size of images is small, which affects the training effect of the target detection model and thus affects the accuracy of target detection; 2. Traditional target detection models are prone to miss small targets and cannot effectively detect images with relatively blurry image quality; 3. The size ratio of the anchors generated by clustering cannot cover all size ratios, which leads to the general effect of the detected rectangular box on the target selection; 4. The detection effect of target detection on minority category images is poor.

[0005] Therefore, how to provide a target detection method based on dynamic anchor selection to improve the accuracy of target detection has become a technical problem that needs to be solved urgently. Summary of the Invention

[0006] The technical problem to be solved by the present invention is to provide a target detection method based on dynamic anchor selection to improve the accuracy of target detection.

[0007] The present invention is implemented as follows: a target detection method based on dynamic anchor selection comprises the following steps:

[0008] Step S10: acquiring a large number of images and annotating each of the images to construct an image dataset;

[0009] Step S20: performing sample expansion on the image dataset based on random block data replacement;

[0010] Step S30: constructing a target detection model based on the FPN module and the dynamic anchor selection module;

[0011] Step S40: training the target detection model using the image dataset;

[0012] Step S50: Utilize the trained target detection model to perform target detection.

[0013] Furthermore, the step S10 is specifically as follows:

[0014] A large number of images are acquired, and each of the images is labeled with objects and image categories, and an image dataset is constructed based on the labeled images.

[0015] Furthermore, the step S20 specifically includes:

[0016] Step S21: Select an image of a first scale from the image dataset as an image to be enhanced;

[0017] Step S22: randomly extracting an object from each of the images to be enhanced as an object to be enhanced;

[0018] Step S23: extracting a random block with a size equal to a second proportion of the target to be enhanced from each target to be enhanced, randomly selecting a pixel from each random block, and obtaining the RGB value pixel of the pixel;

[0019] Step S24: Randomly select one of the four values ​​(255-pixel), 0, pixel, and 255 as the RGB value of the entire random block to obtain a pure color block;

[0020] Step S25: merging each of the pure color blocks with the corresponding image to be enhanced to obtain training data;

[0021] Step S26: Update the RGB values ​​of the training data based on the RGB update formula to obtain enhanced images, and expand the samples of the image data set based on each enhanced image.

[0022] Furthermore, in step S26, the RGB update formula is specifically:

[0023] w t =0.8*Δw 待增强图像 +0.2*Δw 随机策略 +w t-1 ;

[0024] Among them, w t Indicates the RGB value updated by round t; w t-1 represents the RGB value updated in round t-1; 0.8 and 0.2 represent the weights of the image to be enhanced and the pure color block respectively; Δw 待增强图像Indicates the RGB increment calculated from the image to be enhanced; Δw 随机策略 Indicates the RGB increment calculated by the pure color Block.

[0025] Furthermore, in step S30, the FPN module is configured to perform the following steps:

[0026] Step S311, obtaining the width, height s*s and number of channels C of each image from the image dataset;

[0027] Step S312: The image is used as the original feature map F1, and is randomly decomposed into sub-feature maps F2, sub-feature maps F8, and sub-feature maps F14, which respectively represent the position, confidence, and category prediction value after decomposition;

[0028] Step S313: The FPN module directly generates sub-feature maps F6, F12, and F18 based on the original feature map F1, which respectively represent the directly generated position, confidence, and category;

[0029] Step S314: The FPN module generates a sub-feature map F3 with a channel number of 2 based on the original feature map F1, and decomposes the sub-feature map F3 into a sub-feature map F4 and a sub-feature map F5; the sum of the elements corresponding to the sub-feature map F4 and the sub-feature map F5 is 1, which is used to represent the weights of the sub-feature map F2 and the sub-feature map F6 respectively;

[0030] The FPN module generates a sub-feature map F9 with a channel number of 2 based on the original feature map F1, and decomposes the sub-feature map F9 into a sub-feature map F10 and a sub-feature map F11; the sum of the elements corresponding to the sub-feature map F10 and the sub-feature map F11 is 1, which is used to represent the weights of the sub-feature map F8 and the sub-feature map F12 respectively;

[0031] The FPN module generates a sub-feature map F15 with a channel number of 2 based on the original feature map F1, and decomposes the sub-feature map F15 into a sub-feature map F16 and a sub-feature map F17; the sum of the elements corresponding to the sub-feature map F16 and the sub-feature map F17 is 1, which is used to represent the weights of the sub-feature map F14 and the sub-feature map F18 respectively;

[0032] Step S315: Multiply the sub-feature map F2 and the sub-feature map F4 element by element, and add the sub-feature map F6 and the sub-feature map F5 element by element to obtain a sub-feature map F7 for decomposing and then fusing the position information;

[0033] Multiply the sub-feature map F8 and the sub-feature map F10 element by element, and add the sub-feature map F12 and the sub-feature map F11 element by element to obtain a sub-feature map F13 for decomposing and then fusing the confidence information;

[0034] Multiply the sub-feature graph F14 and the sub-feature graph F16 element by element, and add the sub-feature graph F18 and the sub-feature graph F17 element by element to obtain a sub-feature graph F19 for decomposing and then fusing the category information;

[0035] Step S316: Perform a concat operation on the sub-feature map F7, the sub-feature map F13, and the sub-feature map F19 to obtain a feature map F20. The feature map F20 has the same number of channels as the original feature map F1 and includes independent positions, confidence levels, and categories.

[0036] Furthermore, in step S311, the calculation formula of the channel number C is:

[0037] C = 1 + 4 + n;

[0038] Among them, 1 represents the confidence of the target, 4 represents the coordinates and width and height of the target center point, and n represents the number of target categories.

[0039] Furthermore, in step S30, the dynamic anchor selection module is configured to perform the following steps:

[0040] Step S321: Divide the images in the image dataset into 9 parts, denoted by Part_i, where i=1, 2, ..., 9;

[0041] Step S322: Anchor clustering is performed on each of the Part_i to obtain clustering results Anchors_i, where i=1, 2, ..., 9;

[0042] Step S323: Anchor clustering is performed on all images in the image dataset to obtain a clustering result Anchors_10;

[0043] Step S324: During the [1, n-20)th iteration of the dynamic anchor selection module, the size of the anchor is updated based on the randomly selected anchors_j and anchors_10:

[0044] u t =0.9*Δu Anchors_j +0.1*Δu Anchors_10 +u t-1 ;

[0045] Among them, u t Indicates the size of the Anchor updated in round t; u t-1 Indicates the size of the anchor updated in round t-1; Δu Anchors_j Indicates the size increment calculated by Anchors_j; Δu Anchors_10Indicates the size increment calculated by Anchors_10; 0.9 and 0.1 both indicate weights;

[0046] Step S325: During the [n-20, n]th iteration cycle of the dynamic anchor selection module, the size of the anchor is updated based on Anchors_10:

[0047] u t =Δu Anchors_10 +u t-1 .

[0048] Furthermore, in step S30, the loss function of the target detection model is expressed as follows:

[0049] Loss=Loss 位置-优化 +Loss 置信度 +Loss 类别-优化 ;

[0050]

[0051]

[0052]

[0053] Loss 置信度 =Loss 置信度-part1 +Loss 置信度-part2 ;

[0054]

[0055]

[0056] Loss 类别-优化 =v t *Loss 类别 ;

[0057]

[0058]

[0059] Among them, Loss represents the total loss of the loss function; Loss 位置-优化 Represents the optimized position loss function; Loss 置信度 Represents the confidence loss function; Loss 类别-优化 Represents the optimized category loss function; Loss 位置 Represents the position loss function before optimization; α1, α2, α3, and α4 all represent weight coefficients; Indicates the error caused by the category; Indicates the error caused by position; Indicates the error caused by confidence; Loss point Represents the loss of the four vertices of Anchor; x i 、y i Indicates the actual center point coordinates; Indicates the coordinates of the predicted center point; w i 、h i Indicates the actual width and height; Indicates the predicted width and height; Respectively represent the actual horizontal and vertical coordinates and predicted horizontal and vertical coordinates of the four vertices of the Anchor; Indicates the actual confidence level; represents the prediction confidence; v t Loss 类别 Weight of Loss 类别 represents the category loss function before optimization; N(c) represents the number of targets that are difficult to detect; N(whole) represents the total number of targets; σ() represents the sigmoid function; represents the detection probability of the difficult-to-detect target in round t-1; In the t-1 round, it is difficult to detect the target category c k The pursuit of harmony; Indicates that there is no error caused by confidence; class represents the category set; Indicates the actual category; Represents the predicted category.

[0060] The advantages of the present invention are:

[0061] By randomly replacing block data to expand the sample of the image dataset, random information is introduced while increasing the amount of training data, that is, more data change information is introduced, which not only reduces the cost of annotation, but also effectively improves the generalization performance of the target detection model; by decomposing and reconstructing the FPN module, that is, letting multiple networks (position, confidence and category) be responsible for different prediction parts, each doing its own job, the separation of position, confidence and category information helps to maximize the effectiveness of the model in specific fields, and finally integrate local information to achieve information fusion from local to global, thereby improving the generalization performance of the target detection model; the image is divided into multiple parts through the dynamic anchor selection module, Each part is clustered separately to generate preset anchors with more size ratios, which can cover targets with abnormal size ratios, so that the target detection model pays more attention to sample data with these abnormal size ratios during training; in addition, the clustering of all images ensures the universality of the preset anchors. By combining the two, the generalization performance of the target detection model is greatly improved; by optimizing the loss function, that is, introducing the four vertices of the anchor (target box) into the position loss function and introducing the mining coefficient of difficult-to-detect targets (difficult examples) into the category loss function, the generalization performance of the target detection model is improved, the detection performance of minority classes is improved, and ultimately the accuracy of target detection is greatly improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0063] Figure 1 This is a flow chart of a target detection method based on dynamic Anchor selection of the present invention.

[0064] Figure 2 It is a schematic diagram of the process of expanding the image dataset samples of the present invention.

[0065] Figure 3 It is an architectural diagram of the FPN module of the present invention.

[0066] Figure 4 It is a schematic diagram of the flow chart of the dynamic Anchor selection module of the present invention. DETAILED DESCRIPTION

[0067] The technical solution in the embodiments of the present application has the following overall ideas: sample expansion of the image dataset is performed by random block data replacement; the recall rate of small target detection is improved by decomposing and reconstructing the FPN module; a more matching prior anchor is generated by constructing a dynamic anchor selection module to improve the fitting efficiency of the target detection model; the detection performance of the minority class is improved by optimizing the unknown and category losses in the loss function to improve the overall generalization performance of the target detection model, thereby improving the accuracy of target detection.

[0068] Please refer to Figures 1 to 4 As shown, a preferred embodiment of the target detection method based on dynamic anchor selection of the present invention includes the following steps:

[0069] Step S10: acquiring a large number of images and annotating each of the images to construct an image dataset;

[0070] Step S20: performing sample expansion on the image dataset based on random block data replacement;

[0071] Step S30: Build a target detection model based on the FPN module and the dynamic anchor selection module. The target detection model is based on the YOLO-V3 framework, that is, the input image is first enhanced, passed through the DarkNet53 backbone network and the decomposed and reconstructed FPN module, and then passed through the detection head to output the final result.

[0072] Step S40: training the target detection model using the image dataset;

[0073] Step S50: Utilize the trained target detection model to perform target detection.

[0074] That is, to address the problem of small sample size, the present invention adopts a random block data replacement strategy to perform data enhancement; to address the problem of missed detection of small targets, the FPN module is decomposed and then reconstructed to achieve feature enhancement; to address the problem that the size ratio of the anchors generated by clustering cannot cover all size ratios, a dynamic anchor selection module is constructed to select more matching anchors; to address the problem that the detection effect of minority class detection targets is usually poor, the loss function is reconstructed to optimize the position and category losses.

[0075] The step S10 is specifically as follows:

[0076] A large number of images are acquired, and each of the images is labeled with objects and image categories, and an image dataset is constructed based on the labeled images.

[0077] The step S20 specifically includes:

[0078] Step S21: Select an image of a first scale from the image dataset as an image to be enhanced;

[0079] Step S22: randomly extracting an object from each of the images to be enhanced as an object to be enhanced;

[0080] Step S23: extracting a random block of a second proportion of the size of the target to be enhanced from each target to be enhanced, randomly selecting a pixel from each random block, and obtaining the RGB value of the pixel; the first proportion and the second proportion are preferably set at 20%;

[0081] Step S24: Randomly select one of the four values ​​(255-pixel), 0, pixel, and 255 as the RGB value of the entire random block to obtain a pure color block;

[0082] Step S25: merging each of the pure color blocks with the corresponding image to be enhanced to obtain training data;

[0083] Step S26: Update the RGB values ​​of the training data based on the RGB update formula to obtain enhanced images, and expand the samples of the image data set based on each enhanced image.

[0084] In step S26, the RGB update formula is specifically:

[0085] w t =0.8*Δw 待增强图像 +0.2*Δw 随机策略 +w t-1 ;

[0086] Among them, w t Indicates the RGB value updated by round t; w t-1 represents the RGB value updated in round t-1; 0.8 and 0.2 represent the weights of the image to be enhanced and the pure color block respectively; Δw 待增强图像 Indicates the RGB increment calculated from the image to be enhanced; Δw 随机策略 Indicates the RGB increment calculated by the pure color Block.

[0087] In step S30, the FPN module is configured to perform the following steps:

[0088] Step S311, obtaining the width, height s*s and number of channels C of each image from the image dataset;

[0089] Step S312: The image is used as the original feature map F1, and is randomly decomposed into sub-feature maps F2, sub-feature maps F8, and sub-feature maps F14, which respectively represent the position, confidence, and category prediction value after decomposition;

[0090] Step S313: The FPN module directly generates sub-feature maps F6, F12, and F18 based on the original feature map F1, which respectively represent the directly generated position, confidence, and category;

[0091] Step S314: The FPN module generates a sub-feature map F3 with a channel number of 2 based on the original feature map F1, and decomposes the sub-feature map F3 into a sub-feature map F4 and a sub-feature map F5; the sum of the elements corresponding to the sub-feature map F4 and the sub-feature map F5 is 1, which is used to represent the weights of the sub-feature map F2 and the sub-feature map F6 respectively;

[0092] The FPN module generates a sub-feature map F9 with a channel number of 2 based on the original feature map F1, and decomposes the sub-feature map F9 into a sub-feature map F10 and a sub-feature map F11; the sum of the elements corresponding to the sub-feature map F10 and the sub-feature map F11 is 1, which is used to represent the weights of the sub-feature map F8 and the sub-feature map F12 respectively;

[0093] The FPN module generates a sub-feature map F15 with a channel number of 2 based on the original feature map F1, and decomposes the sub-feature map F15 into a sub-feature map F16 and a sub-feature map F17; the sum of the elements corresponding to the sub-feature map F16 and the sub-feature map F17 is 1, which is used to represent the weights of the sub-feature map F14 and the sub-feature map F18 respectively;

[0094] Step S315: Multiply the sub-feature graph F2 and the sub-feature graph F4 element by element, and add the sub-feature graph F6 and the sub-feature graph F5 element by element to obtain a sub-feature graph F7, which is used to decompose and then fuse the position information. The additional network gives more information to the position.

[0095] The sub-feature map F8 and the sub-feature map F10 are multiplied element by element, and the sub-feature map F12 and the sub-feature map F11 are multiplied element by element to obtain the sub-feature map F13, which is used to decompose and then fuse the confidence information. The additional network gives more information to the confidence.

[0096] The sub-feature graph F14 and the sub-feature graph F16 are multiplied element by element, and the sub-feature graph F18 and the sub-feature graph F17 are multiplied element by element to obtain the sub-feature graph F19, which is used to decompose and then fuse the information of the category. The additional network gives the category more information;

[0097] Step S316: Perform a concat operation on the sub-feature map F7, the sub-feature map F13, and the sub-feature map F19 to obtain a feature map F20. The feature map F20 has the same number of channels as the original feature map F1, and contains independent positions, confidence levels, and categories, and has better representation capabilities.

[0098] Since the FPN module of YOLO-V3 outputs the target's position and category through a unified network, but in fact, the optimization directions of the position and category parameters are not consistent, so after the original FPN output results, a decomposition and reconstruction module is constructed to decompose the position and category modules, perform feature fusion separately, and then splice and reconstruct them.

[0099] In step S311, the calculation formula of the channel number C is:

[0100] C = 1 + 4 + n;

[0101] Among them, 1 represents the confidence of the target, 4 represents the coordinates and width and height of the target center point, and n represents the number of target categories.

[0102] In step S30, the dynamic anchor selection module is used to perform the following steps:

[0103] Step S321: Divide the images in the image dataset into 9 parts, denoted by Part_i, where i=1, 2, ..., 9;

[0104] Step S322: Anchor clustering is performed on each of the Part_i to obtain clustering results Anchors_i, where i=1, 2, ..., 9;

[0105] Step S323: Anchor clustering is performed on all images in the image dataset to obtain a clustering result Anchors_10;

[0106] Step S324: During the [1, n-20)th iteration of the dynamic anchor selection module, the size of the anchor is updated based on the randomly selected anchors_j and anchors_10:

[0107] u t =0.9*Δu Anchors_j +0.1*Δu Anchors_10 +u t-1 ; That is, the bias term of fitting Anchors;

[0108] Among them, u t Indicates the size of the Anchor updated in round t; u t-1 Indicates the size of the anchor updated in round t-1; Δu Anchors_jIndicates the size increment calculated by Anchors_j; Δu Anchors_10 Indicates the size increment calculated by Anchors_10; 0.9 and 0.1 both indicate weights;

[0109] Step S325: During the [n-20, n]th iteration of the dynamic anchor selection module, the size of the anchor is updated based on Anchors_10 to ensure that the parameter update direction remains unchanged:

[0110] u t =Δu Anchors_10 +u t-1 .

[0111] Since YOLO-V3 accelerates model training by clustering preset anchors, the model ensures that the error range of detected targets is not too large by fitting the deviation between the target and the anchor. This method can effectively and accurately predict most targets of normal size to a certain extent. However, in the actual detection process, there will still be targets of a small number of proportional sizes. Due to the small size of these targets, the clustering results cannot include this information. To solve this problem, a dynamic anchor selection module is constructed.

[0112] In step S30, the loss function of the target detection model is:

[0113] Loss=Loss 位置-优化 +Loss 置信度 +Loss 类别-优化 ;

[0114]

[0115]

[0116]

[0117] Loss 置信度 =Loss 置信度-part1 +Loss 置信度-part2 ;

[0118]

[0119]

[0120] Loss 类别-优化 =v t *Loss 类别 ;

[0121]

[0122]

[0123] Among them, Loss represents the total loss of the loss function; Loss 位置-优化 Represents the optimized position loss function; Loss 置信度 Represents the confidence loss function; Loss 类别-优化 Represents the optimized category loss function; Loss 位置 Represents the position loss function before optimization; α1, α2, α3, and α4 all represent weight coefficients; Indicates the error caused by the category; Indicates the error caused by position; Indicates the error caused by confidence; Loss point Represents the loss of the four vertices of the Anchor. Since the position loss is determined by the center coordinates and width and height, the center point coordinates are a comprehensive expression of the four coordinates of the rectangle, so part of the loss of each point is missing, so Loss needs to be added. point ;x i 、y i Indicates the actual center point coordinates; Indicates the coordinates of the predicted center point; w i 、h i Indicates the actual width and height; Indicates the predicted width and height;

[0124] Respectively represent the actual horizontal and vertical coordinates and predicted horizontal and vertical coordinates of the four vertices of the Anchor; Indicates the actual confidence level; represents the prediction confidence; v t Loss 类别 Weight of Loss 类别 represents the category loss function before optimization; N(c) represents the number of targets that are difficult to detect (difficult examples), that is, samples with low detection accuracy during the detection process; N(whole) represents the total number of targets; σ() represents the sigmoid function; represents the detection probability of the difficult-to-detect target in round t-1; In the t-1 round, it is difficult to detect the target category c k The pursuit of harmony; Indicates that there is no error caused by confidence; class represents the category set; Indicates the actual category; Represents the predicted category.

[0125] In summary, the advantages of the present invention are:

[0126] By randomly replacing block data to expand the sample of the image dataset, random information is introduced while increasing the amount of training data, that is, more data change information is introduced, which not only reduces the cost of annotation, but also effectively improves the generalization performance of the target detection model; by decomposing and reconstructing the FPN module, that is, letting multiple networks (position, confidence and category) be responsible for different prediction parts, each doing its own job, the separation of position, confidence and category information helps to maximize the effectiveness of the model in specific fields, and finally integrate local information to achieve information fusion from local to global, thereby improving the generalization performance of the target detection model; the image is divided into multiple parts through the dynamic anchor selection module, Each part is clustered separately to generate preset anchors with more size ratios, which can cover targets with abnormal size ratios, so that the target detection model pays more attention to sample data with these abnormal size ratios during training; in addition, the clustering of all images ensures the universality of the preset anchors. By combining the two, the generalization performance of the target detection model is greatly improved; by optimizing the loss function, that is, introducing the four vertices of the anchor (target box) into the position loss function and introducing the mining coefficient of difficult-to-detect targets (difficult examples) into the category loss function, the generalization performance of the target detection model is improved, the detection performance of minority classes is improved, and ultimately the accuracy of target detection is greatly improved.

[0127] Although the specific embodiments of the present invention are described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A target detection method based on dynamic anchor selection, characterized by: The steps include: Step S10: acquiring a large number of images and annotating each of the images to construct an image dataset; Step S20: performing sample expansion on the image dataset based on random block data replacement; Step S30: constructing a target detection model based on the FPN module and the dynamic anchor selection module; Step S40: training the target detection model using the image dataset; Step S50: Detecting a target using the trained target detection model; The step S20 specifically includes: Step S21: Select an image of a first scale from the image dataset as an image to be enhanced; Step S22: randomly extracting an object from each of the images to be enhanced as an object to be enhanced; Step S23: extracting a random block with a size equal to a second proportion of the target to be enhanced from each target to be enhanced, randomly selecting a pixel from each random block, and obtaining the RGB value pixel of the pixel; Step S24: Randomly select one of the four values ​​(255-pixel), 0, pixel, and 255 as the RGB value of the entire random block to obtain a pure color block; Step S25: merging each of the pure color blocks with the corresponding image to be enhanced to obtain training data; Step S26: Update the RGB values ​​of the training data based on the RGB update formula to obtain enhanced images, and expand the samples of the image data set based on each enhanced image.

2. The object detection method based on dynamic anchor selection according to claim 1, characterized in that: The step S10 is specifically as follows: A large number of images are acquired, and each of the images is labeled with objects and image categories, and an image dataset is constructed based on the labeled images.

3. The object detection method based on dynamic anchor selection according to claim 1, characterized in that: In step S26, the RGB update formula is specifically: In t =0.8*Δw 待增强图像 +0.2*Δw 随机策略 +in t-1 ; Among them, w t Indicates the RGB value updated by round t; w t-1 represents the RGB value updated in round t-1; 0.8 and 0.2 represent the weights of the image to be enhanced and the pure color block respectively; Δw 待增强图像 Indicates the RGB increment calculated from the image to be enhanced; Δw 随机策略 Indicates the RGB increment calculated by the pure color Block.

4. The object detection method based on dynamic anchor selection according to claim 1, wherein: In step S30, the FPN module is configured to perform the following steps: Step S311, obtaining the width, height s*s and number of channels C of each image from the image dataset; Step S312: The image is used as the original feature map F1, and is randomly decomposed into sub-feature maps F2, sub-feature maps F8, and sub-feature maps F14, which respectively represent the position, confidence, and category prediction value after decomposition; Step S313: The FPN module directly generates sub-feature maps F6, F12, and F18 based on the original feature map F1, which respectively represent the directly generated position, confidence, and category; Step S314: The FPN module generates a sub-feature map F3 with a channel number of 2 based on the original feature map F1, and decomposes the sub-feature map F3 into a sub-feature map F4 and a sub-feature map F5; the sum of the elements corresponding to the sub-feature map F4 and the sub-feature map F5 is 1, which is used to represent the weights of the sub-feature map F2 and the sub-feature map F6 respectively; The FPN module generates a sub-feature map F9 with a channel number of 2 based on the original feature map F1, and decomposes the sub-feature map F9 into a sub-feature map F10 and a sub-feature map F11; the sum of the elements corresponding to the sub-feature map F10 and the sub-feature map F11 is 1, which is used to represent the weights of the sub-feature map F8 and the sub-feature map F12 respectively; The FPN module generates a sub-feature map F15 with a channel number of 2 based on the original feature map F1, and decomposes the sub-feature map F15 into a sub-feature map F16 and a sub-feature map F17; the sum of the elements corresponding to the sub-feature map F16 and the sub-feature map F17 is 1, which is used to represent the weights of the sub-feature map F14 and the sub-feature map F18 respectively; Step S315: Multiply the sub-feature map F2 and the sub-feature map F4 element by element, and add the sub-feature map F6 and the sub-feature map F5 element by element to obtain a sub-feature map F7 for decomposing and then fusing the position information; Multiply the sub-feature map F8 and the sub-feature map F10 element by element, and add the sub-feature map F12 and the sub-feature map F11 element by element to obtain a sub-feature map F13 for decomposing and then fusing the confidence information; Multiply the sub-feature graph F14 and the sub-feature graph F16 element by element, and add the sub-feature graph F18 and the sub-feature graph F17 element by element to obtain a sub-feature graph F19 for decomposing and then fusing the category information; Step S316: Perform a concat operation on the sub-feature map F7, the sub-feature map F13, and the sub-feature map F19 to obtain a feature map F20. The feature map F20 has the same number of channels as the original feature map F1 and includes independent positions, confidence levels, and categories.

5. The target detection method based on dynamic anchor selection according to claim 4, characterized in that: In step S311, the calculation formula of the channel number C is: C = 1 + 4 + n; Among them, 1 represents the confidence of the target, 4 represents the coordinates and width and height of the target center point, and n represents the number of target categories.

6. The object detection method based on dynamic anchor selection according to claim 1, characterized in that: In step S30, the dynamic anchor selection module is used to perform the following steps: Step S321: Divide the images in the image dataset into 9 parts, denoted by Part_i, where i=1, 2, ..., 9; Step S322: Anchor clustering is performed on each of the Part_i to obtain clustering results Anchors_i, where i=1, 2, ..., 9; Step S323: Anchor clustering is performed on all images in the image dataset to obtain a clustering result Anchors_10; Step S324: During the [1, n-20)th iteration of the dynamic anchor selection module, the size of the anchor is updated based on the randomly selected anchors_j and anchors_10: u t =0.9*Δu Anchors_j +0.1*Δu Anchors_10 +u t-1 ; Among them, u t Indicates the size of the Anchor updated in round t; u t-1 Indicates the size of the anchor updated in round t-1; Δu Anchors_j Indicates the size increment calculated by Anchors_j; Δu Anchors_10 Indicates the size increment calculated by Anchors_10; Both 0.9 and 0.1 represent weights; Step S325: During the [n-20, n]th iteration cycle of the dynamic anchor selection module, the size of the anchor is updated based on Anchors_10: u t =Δu Anchors_10 +u t-1 。 7. The object detection method based on dynamic anchor selection according to claim 1, characterized in that: In step S30, the loss function of the target detection model is: Loss=Loss 位置-优化 +Loss 置信度 +Loss 类别-优化 ; Loss 置信度 =Loss 置信度-part1 +Loss 置信度-part2 ; Loss 类别-优化 =v t *Loss 类别 ; Among them, Loss represents the total loss of the loss function; Loss 位置-优化 Represents the optimized position loss function; Loss 置信度 Represents the confidence loss function; Loss 类别-优化 Represents the optimized category loss function; Loss 位置 Represents the position loss function before optimization; α1, α2, α3, and α4 all represent weight coefficients; Indicates the error caused by the category; Indicates the error caused by position; Indicates the error caused by confidence; Loss point Represents the loss of the four vertices of Anchor; x i 、y i Indicates the actual center point coordinates; Indicates the coordinates of the predicted center point; w i 、h i Indicates the actual width and height; Indicates the predicted width and height; Respectively represent the actual horizontal and vertical coordinates and predicted horizontal and vertical coordinates of the four vertices of the Anchor; Indicates the actual confidence level; represents the prediction confidence; v t Loss 类别 Weight of Loss 类别 represents the category loss function before optimization; N(c) represents the number of targets that are difficult to detect; N(whole) represents the total number of targets; σ() represents the sigmoid function; represents the detection probability of the difficult-to-detect target in round t-1; In the t-1 round, it is difficult to detect the target category c k The sum of Indicates that there is no error caused by confidence; class represents the category set; P i j Indicates the actual category; Represents the predicted category.

Citation Information

Patent Citations

  • Strong weather target identification method based on deep convolutional neural network

    CN113469278A

  • Remote sensing image ship detection method and device based on attention model

    CN114677596A