Target detection method and device, equipment, storage medium and product

By using an image processing module in the target neural network model to remove mist interference, improve image clarity, the problem of target detection accuracy in bad weather is solved, and higher detection accuracy and system reliability are achieved.

CN119251462APending Publication Date: 2025-01-03CHANGSUO SOFTWARE TECH SHANGHAI CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411163893.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-22
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Under harsh weather conditions such as haze, image quality declines, resulting in the inability of target detection algorithm to accurately identify and locate targets, resulting in mis-checking or missed inspections, affecting the reliability and safety of autonomous driving and video surveillance systems.

Method used

Using a target neural network model including backbone network, neck network and head network, the image processing module removes mist interference, improves image clarity, and uses feature extraction module, neck network and head network to detect the target to determine the target Location and type.

Benefits of technology

It improves the accuracy and robustness of target detection, can effectively identify and locate targets in harsh environments, reduce false detection and missed detection rates, and enhances the reliability and safety of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119251462A_ABST
    Figure CN119251462A_ABST
Patent Text Reader

Abstract

The invention provides a target detection method and device, equipment, a storage medium and a product. The method comprises the steps that a target neural network model used for target detection and a to-be-detected image are acquired, the target neural network model comprises a backbone network, a neck network and a head network, and the backbone network comprises an image processing module and a feature extraction module; inputting the to-be-detected image into an image processing module, and removing fog in the image to obtain a first image corresponding to the to-be-detected image; target detection is carried out on the first image through a feature extraction module, a neck network and a head network in a backbone network in the target neural network model, a target detection result is obtained, and the target detection result comprises the position and the type of a target in the to-be-detected image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a target detection method, device, equipment, storage medium and product. Background Art

[0002] In the application of autonomous driving or outdoor video surveillance, target detection is one of the key technologies, which is responsible for identifying targets in images or videos and determining their locations. The target detection algorithm can identify and locate various entities or objects in the image, such as people, vehicles, animals, etc. The identified object will be marked by a rectangular box surrounding the target, which is defined by its x, y coordinates and width and height in the image. The result of target detection directly determines whether the corresponding autonomous driving or outdoor video surveillance system can respond to the information in the image. Therefore, the accuracy of the target detection result directly affects the reliability and safety of the system.

[0003] However, in weather conditions with reduced visibility such as haze, the acquired images have problems such as low contrast, blurred details, and color distortion, which will seriously affect the visibility and recognizability of the targets in the image. Existing target detection technologies are not optimized for adverse weather conditions, so the performance under these conditions is unstable. Due to the degradation of image quality, traditional target detection algorithms are likely to be unable to accurately identify and locate targets, resulting in false detection or missed detection of targets. The accuracy of target detection in adverse environments is low. Summary of the invention

[0004] The embodiments of the present application provide a target detection method, apparatus, device, storage medium and product, which can improve the accuracy of target detection.

[0005] In a first aspect, the present application provides a target detection method, comprising:

[0006] Acquire a target neural network model for target detection and an image to be detected, wherein the target neural network model includes a backbone network, a neck network, and a head network, the backbone network includes an image processing module, and the number of neural network layers of the image processing module is less than a preset number of layers;

[0007] Inputting the image to be detected into the image processing module, removing fog in the image, and obtaining a first image corresponding to the image to be detected;

[0008] The first image is subjected to target detection through the feature extraction module of the backbone network, the neck network and the head network in the target neural network model to obtain a target detection result, wherein the target detection result includes the position and type of the target in the image to be detected.

[0009] In some possible implementations, before acquiring the target neural network model for target detection and the image to be detected, the method further includes:

[0010] Acquire a training sample set; the training sample set includes a plurality of training samples, each of the training samples includes a sample image and a labeling file corresponding to the sample image, the labeling file includes a target label in the sample image, and the target label includes a target type label and identification box information;

[0011] For each training sample, perform the following steps:

[0012] Inputting the sample image into the target neural network model to determine the predicted detection result of the target in the sample image, wherein the predicted detection result includes a predicted identification box and a target prediction type;

[0013] Determining the loss function value of the target neural network model according to the predicted detection results of each of the training samples and the corresponding target labels;

[0014] When the loss function value of the target neural network model does not satisfy the preset training stop condition, the model parameters of the target neural network model are adjusted, and the sample image is input into the target neural network model to determine the prediction result of the image annotation.

[0015] When the loss function value of the target neural network model meets the preset training stop condition, the training is stopped to obtain the trained target neural network model.

[0016] In some possible implementations, determining the loss function value of the target neural network model according to the predicted detection results of each of the training samples and the corresponding annotation files includes:

[0017] Determining a first intersection-over-union ratio corresponding to the predicted identification based on a positional relationship between a position of the predicted identification frame and a position of the identification frame information;

[0018] Determining position offset information between the predicted identification frame and the identification frame information based on the position of the predicted identification frame and the position of the identification frame information;

[0019] Determining relative contour information between the predicted identification frame and the identification frame information according to size information of the predicted identification frame and the identification frame information;

[0020] Determine a loss value according to the first intersection-over-union ratio, the position offset information and the relative contour information;

[0021] Determining an adjustment range corresponding to the first intersection-and-combination ratio according to a preset attention factor;

[0022] The loss function value of the target neural network model is determined based on the first intersection-over-union ratio, the loss value and the adjustment amplitude.

[0023] In some possible implementations, determining the loss value according to the first intersection-over-union ratio, the position offset information, and the relative contour information includes:

[0024] The loss value is determined by the following formula:

[0025]

[0026] Among them, L CIoU represents the loss value, IoU represents the first intersection-over-union ratio, d is the distance between the reference point of the predicted identification box and the reference point of the identification box information, and c is the distance between the predicted box and the diagonal of the minimum circumscribed rectangle of the real box. represents the position offset information, α is the weight parameter, v represents the relative contour information.

[0027] In some possible implementations, determining the first intersection-and-union ratio corresponding to the predicted identifier based on the positional relationship between the position of the predicted identifier frame and the position of the identifier frame information includes:

[0028] Calculating the area of ​​an overlapping region between the predicted identification frame and the identification frame information according to the positional relationship between the predicted identification frame and the identification frame information to obtain a first area;

[0029] Subtract the area of ​​the overlapping area from the sum of the areas of the predicted identification frame and the identification frame information to obtain a second area;

[0030] The ratio of the first area to the second area is calculated to obtain a first intersection-and-union ratio.

[0031] In some possible implementations, the preset attention factor includes a first attention factor and a second attention factor, the first attention factor is smaller than the second attention factor, and determining the adjustment amplitude corresponding to the first intersection-and-union ratio according to the preset attention factor includes:

[0032] When the first intersection-and-union ratio is less than the first focus factor, determining the adjustment amplitude corresponding to the intersection-and-union ratio as a first preset value;

[0033] When the first intersection-and-union ratio is greater than the second focus factor, the adjustment amplitude corresponding to the intersection-and-union ratio is determined to be a second preset value, and the first preset value is less than the second preset value;

[0034] When the first IoU is greater than the first focus factor and less than the second focus factor, an adjustment amplitude corresponding to the first IoU is determined according to a difference between the first focus factor and the second focus factor and the first IoU.

[0035] In some possible implementations, obtaining a training sample set includes:

[0036] Obtaining an initial sample image and a labeling file corresponding to the initial sample image;

[0037] Performing data expansion on the initial sample image to obtain a plurality of derivative sample images corresponding to the initial sample image;

[0038] Constructing training samples based on the initial sample image and the corresponding annotation file, and the derived image and the corresponding annotation file respectively;

[0039] A training sample set is constructed according to the training samples.

[0040] In some possible implementations, the data expansion of the initial sample image includes at least one of flipping the initial sample image, performing color space transformation on the initial sample image, and adding noise to the initial sample image.

[0041] In some possible implementations, after acquiring the target neural network model for target detection and the image to be detected, the method further includes:

[0042] De-noising the image to be detected and enhancing the contrast of the image to be detected;

[0043] Calculating the ratio of the aspect ratio of the image to be detected to the target aspect ratio to obtain a scaling ratio;

[0044] Scaling the image to be detected according to the scaling ratio;

[0045] The step of inputting the image to be detected into the image processing module, removing fog from the image, and obtaining a first image corresponding to the image to be detected includes:

[0046] The image to be detected after the scaling is input into the image processing module, fog in the image is removed, and a first image corresponding to the image to be detected is obtained.

[0047] In a second aspect, the present application provides a target detection device, the device comprising:

[0048] An acquisition module, used to acquire a target neural network model for target detection and an image to be detected, wherein the target neural network model includes a backbone network, a neck network and a head network, the backbone network includes an image processing module, and the number of neural network layers of the image processing module is less than a preset number of layers;

[0049] A removal module, used for inputting the image to be detected into the image processing module, removing fog from the image, and obtaining a first image corresponding to the image to be detected;

[0050] A detection module is used to perform target detection on the first image through the feature extraction module of the backbone network, the neck network and the head network in the target neural network model to obtain a target detection result, wherein the target detection result includes the position and type of the target in the image to be detected.

[0051] In a third aspect, the present application provides a target detection device, comprising: a processor, and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the target detection method as described above.

[0052] In a fourth aspect, the present application provides a computer-readable storage medium having computer program instructions stored thereon, and the computer program instructions, when executed by a processor, implement the target detection method as described above.

[0053] In a fifth aspect, the present application provides a computer program product, and when the instructions in the computer program product are executed by a processor of an electronic device, the electronic device performs the target detection method as described above.

[0054] The target detection method, device, equipment, storage medium and product provided in the embodiments of the present application perform target detection on the image to be detected by using a target neural network model including a backbone network, a neck network and a head network. First, the image processing module in the backbone network is used to remove or reduce the fog interference in the image to obtain a clear image, and then target detection is performed on this image to determine the target classification and position information corresponding to each target contained in the image to be detected. The solution provided in the embodiments of the present application improves the clarity of the image to be detected by using the first neural network, so that the feature extraction module of the backbone network, the neck network and the head network in the subsequent target neural network model can accurately identify and locate the target, thereby improving the accuracy of target detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The present application can be better understood from the following description of the specific embodiments of the present application in conjunction with the accompanying drawings, in which:

[0056] Other features, objects and advantages of the present application will become more apparent by reading the following detailed description of non-limiting embodiments with reference to the accompanying drawings, in which the same or similar reference numerals represent the same or similar features.

[0057] Figure 1 is a flow chart of a target detection method provided by an embodiment of the present application;

[0058] Figure 2 is a flow chart of a target neural network model training process provided by an embodiment of the present application;

[0059] Figure 3 is a hierarchical schematic diagram of a target neural network model provided by an embodiment of the present application;

[0060] Figure 4 is a schematic diagram of the structure of a target detection device provided by an embodiment of the present application;

[0061] Figure 5 It is a schematic diagram of the hardware structure of the target detection device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0062] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0063] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0064] In order to solve the problems of the prior art, the embodiments of the present application provide a target detection method, device, equipment, storage medium and product. The target detection method provided by the embodiments of the present application is first introduced below.

[0065] Figure 1 FIG. 1 is a flow chart of a target detection method provided by an embodiment of the present application. Figure 1 As shown, the method includes the following steps S101 to S103.

[0066] Step S101: Obtain a target neural network model for target detection and an image to be detected, wherein the target neural network model includes a backbone network, a neck network and a head network, and the backbone network includes an image processing module and a feature extraction module.

[0067] In this embodiment, the target neural network model consists of three parts: a backbone network, a neck network, and a head network. Among them, the backbone network is the basic part of the entire neural network model, responsible for extracting image features. The backbone network is composed of multiple network layers, among which the image processing module is the starting part of the entire network, which is responsible for receiving the input image and performing defogging. In order to process quickly, the number of neural network layers of the image processing module is small, less than the preset number of layers. The feature extraction module is used to extract the features of the image. The neck network is located between the backbone network and the head network, and is used to further process and integrate the features extracted from the backbone network. The head network predicts the location and type of the target based on the processed feature map.

[0068] The images to be detected can be original images input to the target neural network model, and these images contain target objects to be detected.

[0069] In a specific implementation, the trained target neural network model and the image to be detected can be obtained from a preset database.

[0070] Step S102: input the above-mentioned image to be detected into the above-mentioned image processing module, remove fog in the image, and obtain a first image corresponding to the above-mentioned image to be detected.

[0071] In the specific implementation, the image to be detected is first sent to the image processing module of the target neural network model, and the image processing module processes the input image to remove the fog in the image to enhance the clarity and quality of the image. The image output by the image processing module is used as the first image, which is an image after defogging, and its quality is more suitable for subsequent target detection tasks.

[0072] Step S103: Perform target detection on the first image through the feature extraction network, neck network and head network in the backbone network in the target neural network model to obtain a target detection result, which includes the position and type of the target in the image to be detected.

[0073] In the specific implementation, the neck network receives the first image as input, and the neck network further processes and integrates feature information based on the features extracted by the backbone network. Then the output of the neck network is used as the input of the head network, and the head network is responsible for performing the final target detection operation to obtain the target detection result.

[0074] As another example, the output of the head network includes the location and type of objects found in the image to be detected. The location is usually represented as a bounding box, and the type is a label describing the object class or class probability.

[0075] The target detection method provided by the embodiment of the present application performs target detection on the image to be detected by using a target neural network model including a backbone network, a neck network and a head network. First, the image processing module in the backbone network is used to remove or reduce the fog interference in the image to obtain a clear image, and then target detection is performed on this image to determine the target classification and position information corresponding to each target contained in the image to be detected. Since the use of the first neural network improves the clarity of the image to be detected, the feature extraction network, neck network and head network in the backbone network in the subsequent target neural network model can accurately identify and locate the target, which can improve the accuracy of target detection.

[0076] In order to obtain a target neural network model that can accurately detect targets, in some embodiments, reference Figure 2 Before the above S101, the above method may further include steps S001 to S006:

[0077] Step S001: Obtain a training sample set; the training sample set includes multiple training samples, each of which includes a sample image and a labeling file corresponding to the sample image, the labeling file includes a target label in the sample image, and the target label includes a target type label and identification box information.

[0078] In the specific implementation, various sample images are collected in advance, and annotations are performed on the basis of the sample images to mark the positions of various objects in the sample images and the corresponding type labels to obtain annotation files. The sample images and the corresponding annotation files are combined into training samples. Multiple training samples are then combined into a training sample set. When needed, the training sample set is loaded and obtained.

[0079] As another example, a labeling box may be used to mark the position of each object in the sample image as identification box information.

[0080] For each training sample, the following steps S002 to S006 are performed respectively:

[0081] Step S002: Input the sample image into the target neural network model to determine the predicted detection result of the target in the sample image, where the predicted detection result includes a predicted identification box and a target prediction type.

[0082] In the specific implementation, the sample image in the training sample is input into the target neural network model. The neural network model generates the predicted target box and target type, and obtains the predicted detection result of the target in the sample image.

[0083] Step S003: Determine the loss function value of the target neural network model according to the predicted detection results of each of the training samples and the corresponding target labels.

[0084] In the specific implementation, based on the pre-selected loss function, the loss function value of the target neural network model is calculated according to the predicted results of the neural network model and the real annotations in the annotation file. The loss function value usually includes the error of the target box position and the classification error of the target type.

[0085] Step S004: Determine whether the loss function value of the target neural network model meets the preset training stop condition.

[0086] In the specific implementation, it is determined whether the current loss function value meets the preset training stop condition. This condition can be that the loss function reaches a sufficiently small threshold, or that training is stopped after a certain number of iterations, or based on other evaluation indicators of related tasks. If yes, execute S006, if not, execute S005.

[0087] Step S005: When the loss function value of the target neural network model does not satisfy the preset training stop condition, adjust the model parameters of the target neural network model, return to the step of inputting the sample image into the target neural network model, and determine the prediction result of the image annotation.

[0088] In a specific implementation, when the loss function value of the target neural network model does not meet the preset training stop condition, the parameters of the neural network model are adjusted through the back propagation algorithm to reduce the value of the loss function. After updating the parameters, the step of inputting the sample image into the target neural network model to determine the prediction result of the image annotation is returned. A new round of training is carried out again to continuously optimize the prediction ability of the model.

[0089] Step S006: When the loss function value of the target neural network model satisfies the preset training stop condition, stop the training to obtain the trained target neural network model.

[0090] In the specific implementation, if the loss function value meets the preset training stop condition, the training process is stopped and the current target neural network model is used as the trained target neural network model. The model has undergone multiple rounds of iterative training and can accurately predict the location and type of the target.

[0091] The above implementation method provided in the embodiment of the present application obtains a training sample set and uses the training sample set to train the target neural network model. During the training process, the loss function value of the above target neural network model is determined. When the loss function value of the above target neural network model does not meet the preset training stop condition, the model parameters of the above target neural network model are adjusted, so as to continuously iterate and optimize the target neural network model, thereby obtaining a trained target neural network model that can accurately detect targets.

[0092] In order to obtain an accurate loss function value, in some embodiments, the above S003 may include steps A1 to F1:

[0093] Step A1: based on the positional relationship between the position of the predicted identification frame and the position of the identification frame information, determine a first intersection-over-union ratio corresponding to the predicted identification.

[0094] In the specific implementation, first, the location information and category label of each predicted target box are obtained from the target neural network model. The location information of the corresponding target box in the annotated data is obtained. The intersection area and union area between each predicted box and its corresponding annotated box are calculated. Then, the first intersection-over-union ratio is calculated using the intersection area and union area, which indicates the degree of overlap between the predicted box and the true annotated box.

[0095] Step B1: Based on the position of the predicted identification frame and the position of the identification frame information, determine the position offset information between the predicted identification frame and the identification frame information.

[0096] In a specific implementation, the center coordinates of the predicted box and the center coordinates of the labeled box can be used to calculate the position offset between them to obtain the position offset information between the predicted identification box and the identification box information. This offset information can help evaluate the accuracy of the model prediction position.

[0097] As another example, the Euclidean distance or other metrics are usually used to calculate the spatial distance between the center points of the prediction box and the annotation box.

[0098] Step C1: Determine the relative contour information between the predicted identification frame and the identification frame information according to the size information of the predicted identification frame and the identification frame information.

[0099] In a specific implementation, the sizes of the predicted box and the labeled box are compared, for example, the width and height are compared, and the relative difference or ratio between the width and height of the predicted box and the width and height of the labeled box is calculated to obtain the relative contour information between the predicted identification box and the identification box information. The relative contour information can help evaluate the size accuracy predicted by the model.

[0100] Step D1: Determine the loss value according to the first intersection-over-union ratio, the position offset information and the relative contour information.

[0101] In a specific implementation, weighted averaging or other methods can be used to integrate these different types of information into a comprehensive metric value. Thus, the first intersection-and-union ratio calculated in step A1 is combined with the position offset information and relative contour information obtained in steps B1 and C1 to obtain a loss value. The loss value is an intersection-and-union ratio that comprehensively considers position accuracy and size accuracy.

[0102] Step E1: determining an adjustment range corresponding to the first intersection-over-combination ratio according to a preset focus factor.

[0103] In the specific implementation, a focus factor is pre-set to adjust the impact of the first intersection-and-union ratio on the final result. This focus factor can be set according to the specific application scenario or task requirements. The adjustment range corresponding to the first intersection-and-union ratio is calculated based on this focus factor, and the size of the adjustment range directly affects the weight of the first intersection-and-union ratio in the loss function.

[0104] Step F1: Determine the loss function value of the target neural network model based on the first intersection-over-union ratio, the loss value and the adjustment amplitude.

[0105] In a specific implementation, the first intersection-and-union ratio calculated in step A1, the loss value calculated in step D1, and the adjustment amplitude determined in step E1 are combined, and the value of the loss function is calculated by weighted sum or other preset functions to determine the loss function value of the target neural network model.

[0106] The above implementation method provided by the embodiment of the present application first determines the first intersection-and-union ratio based on the positional relationship between the position of the predicted identification box and the position of the identification box information. Then, the position offset information and relative contour information of the identification box are used to determine the loss value in combination with the first intersection-and-union ratio. The adjustment amplitude corresponding to the above first intersection-and-union ratio is also determined according to the preset attention factor, and finally the loss function value of the above target neural network model is determined based on the above first intersection-and-union ratio, the loss value and the above adjustment amplitude. Thereby, an accurate loss function value is obtained.

[0107] In order to obtain an accurate loss value, in some embodiments, the above D1 may include:

[0108] The loss value is determined by the following formula:

[0109]

[0110] Among them, L CIoU represents CIoU loss, IoU represents the first intersection-over-union ratio, d represents the distance between the predicted box and the diagonal of the minimum circumscribed rectangle of the true box, and c represents the distance between the predicted box and the diagonal of the minimum circumscribed rectangle of the true box. represents the position offset information, α is the weight parameter, v represents the relative contour information.

[0111] The above implementation method provided in the embodiment of the present application uses the relative contour information v to calculate the weight parameter α, and uses the distance between the reference point of the predicted identification box and the reference point of the identification box information and the distance between the predicted box and the diagonal of the minimum circumscribed rectangle of the real box to calculate the position offset information, and finally relies on the above data to calculate the loss.

[0112] In order to obtain an accurate first intersection-over-union ratio, in some implementations, the above A1 may include steps A2 to C2:

[0113] Step A2: According to the positional relationship between the predicted identification frame and the identification frame information, the area of ​​the overlapping region between the predicted identification frame and the identification frame information is calculated to obtain a first area.

[0114] In a specific implementation, the prediction box output by the model is obtained, which contains the coordinates of the four vertices or the center point coordinates plus the width and height information. Then the upper left corner and lower right corner coordinates of the prediction box and the annotation box are determined, and the intersection area is determined, wherein the upper left corner coordinate of the intersection area is the maximum value of the upper left corner coordinates of the prediction box and the annotation box, and the lower right corner coordinate is the minimum value of the lower right corner coordinates of the prediction box and the annotation box. The width and height of the rectangle are calculated using the upper left corner and lower right corner coordinates of the intersection area, and then the first area is calculated by multiplying the width by the height.

[0115] Step B2: subtract the area of ​​the overlapping area from the sum of the areas of the predicted identification box and the identification box information to obtain a second area.

[0116] In a specific implementation, after obtaining the area of ​​the intersection region calculated in step A1, the second area can be obtained by subtracting the area of ​​the intersection region from the sum of the areas of the prediction box and the annotation box.

[0117] Step C2: Calculate the ratio of the first area to the second area to obtain a first intersection-and-union ratio.

[0118] In a specific implementation, the first area calculated in step A1 is divided by the second area calculated in step B1, and the obtained ratio is the first intersection-over-union ratio, which is used to evaluate the degree of overlap between the prediction box and the annotation box.

[0119] In the above implementation provided by the embodiment of the present application, the first area representing the area of ​​the overlapping region and the second area composed of the two identification frames are calculated respectively according to the positional relationship between the above predicted identification frame and the identification frame information. The ratio of the above first area to the above second area is calculated to obtain the first intersection-and-union ratio. An accurate first intersection-and-union ratio can be obtained.

[0120] In order to obtain an adjustment amplitude that accurately corresponds to the first intersection-over-combination ratio, in some implementations, the preset attention factor includes a first attention factor and a second attention factor, the first attention factor is smaller than the second attention factor, and the above E1 may include steps A3 to C3:

[0121] Step A3: when the first intersection-and-union ratio is smaller than the first focus factor, the adjustment range corresponding to the intersection-and-union ratio is determined as a first preset value.

[0122] In a specific implementation, after the first intersection-and-union ratio is calculated in step C1, if the first intersection-and-union ratio is smaller than the first focus factor, the adjustment amplitude is determined to be a first preset value.

[0123] Step B3: when the first intersection-and-union ratio is greater than the second focus factor, the adjustment amplitude corresponding to the intersection-and-union ratio is determined as a second preset value, and the first preset value is smaller than the second preset value.

[0124] In a specific implementation, if the first intersection-and-combination ratio is greater than the second focus factor, a corresponding adjustment is performed, and the adjustment amplitude corresponding to the above intersection-and-combination ratio is determined as the second preset value. Otherwise, proceed to the next step. The first preset value is less than the second preset value.

[0125] Step C3: when the first intersection-and-intersection ratio is greater than the first concern factor and less than the second concern factor, determining an adjustment range corresponding to the first intersection-and-intersection ratio according to a difference between the first concern factor and the second concern factor and the first intersection-and-intersection ratio.

[0126] In a specific implementation, if the first intersection-and-union ratio is between the first focus factor and the second focus factor, the difference between the first focus factor and the second focus factor is calculated, and the adjustment range corresponding to the intersection-and-union ratio is determined according to the difference and the specific value of the first intersection-and-union ratio.

[0127] In the above implementation mode provided in the embodiment of the present application, the preset attention factor is divided into a first attention factor and a second attention factor, and the first intersection-and-union ratio is compared with the first attention factor and the second attention factor. According to the size relationship between the first intersection-and-union ratio and the first attention factor and the second attention factor, the adjustment amplitude corresponding to the first intersection-and-union ratio is determined accordingly, so as to obtain the adjustment amplitude that accurately corresponds to the first intersection-and-union ratio.

[0128] For the purpose of model training, in some implementations, the above S001 may include steps A4 to D4:

[0129] Step A4: Obtain an initial sample image and a labeling file corresponding to the initial sample image.

[0130] In a specific implementation, an initial sample image is read from a specified path or database, and the path or database location of the corresponding annotation file is determined according to the file name or identifier of the initial sample image, and the annotation file is loaded. The annotation file is an image containing target category and location information.

[0131] Step B4: performing data expansion on the initial sample image to obtain a plurality of derivative sample images corresponding to the initial sample image.

[0132] In the specific implementation, appropriate data augmentation methods are selected according to specific tasks and application scenarios, such as rotation, scaling, translation, mirroring, etc. It is also possible to combine the data augmentation functions provided by the preset image processing library or deep learning framework. The selected data augmentation method is applied to each initial sample image to generate multiple derivative sample images.

[0133] Step C4: construct training samples based on the initial sample image and the corresponding annotation file, and the derived image and the corresponding annotation file respectively.

[0134] In the specific implementation, each initial sample image and its corresponding annotation file are used as part of the training sample. At the same time, each derived sample image and its corresponding original annotation file are used as additional training samples. In this way, multiple training samples are constructed.

[0135] Step D4: Construct a training sample set based on the above training samples.

[0136] In the above implementation provided by the embodiment of the present application, after obtaining the initial sample image and its corresponding annotation file, data expansion is performed on the initial sample image, and then the initial sample image and the corresponding annotation file, as well as the derived image and the corresponding annotation file are respectively combined to obtain training samples and form a training sample set. In this way, more training samples are obtained to improve the effect of model training.

[0137] In some implementations, the data expansion of the initial sample image may include at least one of flipping the initial sample image, performing a color space transformation on the initial sample image, and adding noise to the initial sample image.

[0138] In order to make the subsequent model processing results more accurate, in some embodiments, after the above S101, the above method may further include steps A5 to C5:

[0139] Step A5: reducing noise on the image to be detected and enhancing the contrast of the image to be detected.

[0140] In the specific implementation, common image processing techniques such as Gaussian filtering, median filtering or wavelet transform are used to reduce noise on the image to be detected. Then, histogram equalization, contrast stretching or adaptive contrast enhancement are used to enhance the contrast of the image to be detected.

[0141] Step B5: Calculate the ratio of the aspect ratio of the image to be detected to the target aspect ratio to obtain a scaling ratio.

[0142] In a specific implementation, the aspect ratio that the image to be detected should achieve is determined according to a predefined target, and the corresponding zoom ratio of the image is calculated according to the current size of the image to be detected and the aspect ratio of the target.

[0143] Step C5: scaling the image to be detected according to the scaling ratio.

[0144] In a specific implementation, the image to be detected is scaled according to the scaling ratio calculated in step B5.

[0145] The above S102 includes:

[0146] The image to be detected after the scaling is input into the image processing module to remove fog in the image, thereby obtaining a first image corresponding to the image to be detected.

[0147] In the above implementation provided by the embodiment of the present application, after the image to be detected is acquired, the image to be detected is firstly subjected to noise reduction and the contrast of the image to be detected is enhanced, and then the image to be detected is scaled, and in a subsequent step, the image to be detected after the scaling is input into the above image processing module to remove fog in the image. By pre-processing the image to be detected, the subsequent model processing results can be made more accurate.

[0148] In one embodiment of the present application, after acquiring the input image to be detected, image preprocessing is performed to reduce noise, enhance contrast, and proportionally scale the input image to a size of 640*640.

[0149] The processed image is input into the pre-built single recognition (You Only Look Once, YOLO) embedded with a lightweight dehazing network and an integrated deblurring network (All-in-One Dehazing Network, AOD-Net), specifically the YOLOv8 target detection algorithm model, to obtain the target classification and location information in the image to be identified. Among them, the YOLOv8 target detection algorithm model embedded with the lightweight dehazing network AOD-Net is obtained based on the labeled sample image and neural network model training. In addition, the dehazing network can also use the Taylor formula to expand the multi-branch (MB-TaylorFormer) module, the gated differentiable image processing (Gated Differentiable Image Processing, GDIP) module, etc. to achieve the dehazing effect.

[0150] The above target detection algorithm model uses the linear interval mapping intersection-over-union (Focaler-CIou) loss during training. Specifically, in the process of calculating the Focaler-CIou loss, first calculate:

[0151]

[0152] Among them, B represents the predicted annotation box, B gt represents the true annotation box, and IoU is the first intersection over union ratio. At the same time, calculate:

[0153]

[0154] Among them, w and h represent the width and height of the predicted annotation box respectively, w gt and h gt Represent the width and height of the real annotation box respectively. The trade-off parameter α can be calculated based on v and IoU:

[0155]

[0156] The loss is then calculated based on the above information:

[0157]

[0158] Among them, c is the distance between the diagonal of the minimum circumscribed rectangle of the predicted box and the real box, and d is the distance between the center points of the predicted box and the real box.

[0159] After the loss value is obtained, the original IoU loss is reconstructed through linear interval mapping to achieve the purpose of focusing on difficult and easy samples. In the specific calculation process, first calculate:

[0160]

[0161] Among them, [d,u]∈[0,1], by adjusting the values ​​of d and u, IoU can focus more on different regression samples.

[0162] The final Focaler-CIou loss is:

[0163] L Focaler-CIoU =L CIoU +IoU-IoU Focaler

[0164] This loss function is used to train the model.

[0165] YOLO usually adopts the Backbone-Neck-Head network structure. The backbone network is mainly responsible for extracting high-level features from the input image, usually including multiple convolutional layers and pooling layers, to build a deep feature extractor; the neck network is usually used to further integrate and adjust the features extracted by the backbone network, which is conducive to the fusion of features at different levels and thus improve the network's perception of the target; the head network usually includes a bounding box regression layer and a classification layer to perform the final regression prediction, and then obtain the final target detection result.

[0166] In the fields of autonomous driving and video surveillance, the accuracy of target detection results directly affects the reliability and safety of the system. Usually, images acquired in hazy weather have problems such as low contrast, blurred details, and color distortion, which seriously affect the visibility and recognizability of targets in the image, resulting in false detection or missed detection of targets. The YOLOv8 target detection algorithm embedded with the lightweight defogging network AOD-Net can effectively improve these problems. AOD-Net removes or reduces interference such as fog in the image, that is, a lightweight CNN is used to directly generate a defogged image, and then V8 is used for target detection, which greatly improves the final target detection effect and robust performance.

[0167] The specific method includes using the lightweight defogging network AOD-Net as the 0th layer of the Backbone part of the improved network, removing or reducing interference such as fog in the image through AOD-Net, that is, directly generating a defogged image through a lightweight CNN, and then performing target detection through V8. The first layer of the improved network is the 0th layer of the original YOLOv8, and the structure of YOLOv8 is continued to be used by analogy. In addition, the YOLOv8 target detection algorithm embedded in the defogging network AOD-Net uses the Focaler-CIou loss during the training process. CIou introduces the aspect ratio of the box, which is suitable for complex scenes that need to consider overlapping areas, shapes and center point positions. The Focaler-IoU method reconstructs the original IoU loss through linear interval mapping to achieve the purpose of focusing on difficult and easy samples. We enabled the above two mechanisms during the training process of the model, which accelerated the convergence of the model training process, and finally improved the detection effect of the model in haze weather scenes.

[0168] For details, please refer to Figure 3 The input of the model is a 640*640 color image, which is first processed by the 301 backbone network. AOD-Net in the 301 backbone network is a lightweight defogging network. AOD-Net removes or reduces interference such as fog in the image, that is, a defogged image is directly generated, and then passes through the C2f module and the SPPF module. The C2f module contains skip layer connections and additional split operations. Then it is handed over to the 302 neck network to fuse the results of different layers. Finally, the decoupling and head in the 303 head network are used to separate the regression branch from the prediction branch, and the detection result of the model is output. The detection result includes the category and location information of the target.

[0169] AOD-Net is used to remove or reduce interference such as fog in the image, that is, a lightweight CNN is used to directly generate a defogged image, and then target detection is performed. Therefore, the YOLOv8 target detection algorithm embedded in the lightweight defogging network AOD-Net has improved the detection effect of images in hazy weather scenes.

[0170] The training process of the YOLOv8 target detection algorithm embedded in the lightweight defogging network AOD-Net uses the Focaler-CIou loss. When training a new model, two loss mechanisms are used to calculate the regression loss of the bounding box at the same time to accelerate the convergence of the model. The evaluation indicators for judging whether the model converges are loss, accuracy, recall rate, and average detection accuracy.

[0171] Based on the target detection method provided in the above embodiment, the present application also provides a specific implementation of the target detection device. Please refer to the following embodiment.

[0172] See first Figure 4 The target detection device 400 provided in the embodiment of the present application includes the following modules:

[0173] The acquisition module 401 is used to acquire a target neural network model for target detection and an image to be detected, wherein the target neural network model includes a backbone network, a neck network and a head network, and the backbone network includes an image processing module. The number of neural network layers of the image processing module is less than a preset number of layers.

[0174] The removal module 402 is used to input the above-mentioned image to be detected into the above-mentioned image processing module, remove the fog in the image, and obtain the first image corresponding to the above-mentioned image to be detected.

[0175] The detection module 403 is used to perform target detection on the above-mentioned first image through the feature extraction module of the backbone network, the neck network and the head network in the above-mentioned target neural network model to obtain the target detection result, and the above-mentioned target detection result includes the position and type of the target in the above-mentioned image to be detected.

[0176] The embodiment of the present application performs target detection on the image to be detected by using a target neural network model including a backbone network, a neck network and a head network. First, the image processing module in the backbone network is used to remove or reduce the fog interference in the image to obtain a clear image, and then target detection is performed on this image to determine the target classification and position information corresponding to each target contained in the image to be detected. Since the use of the first neural network improves the clarity of the image to be detected, the feature extraction module of the backbone network, the neck network and the head network in the subsequent target neural network model can accurately identify and locate the target, which can improve the accuracy of target detection.

[0177] As an implementation of the present application, the target detection device 400 may further include:

[0178] The acquisition module is used to acquire a training sample set; the training sample set includes multiple training samples, each of which includes a sample image and a labeling file corresponding to the sample image, the labeling file includes a target label in the sample image, and the target label includes a target type label and identification box information.

[0179] The determination module is used to input the above sample image into the target neural network model to determine the predicted detection result of the target in the sample image, and the above predicted detection result includes a predicted identification box and a target prediction type.

[0180] The determination module is also used to determine the loss function value of the above-mentioned target neural network model based on the above-mentioned prediction detection results of each of the above-mentioned training samples and the corresponding target labels.

[0181] The adjustment module is used to adjust the model parameters of the target neural network model when the loss function value of the target neural network model does not meet the preset training stop condition, and return to the step of inputting the sample image into the target neural network model to determine the prediction result of the image annotation.

[0182] The stop module is used to stop training when the loss function value of the target neural network model meets the preset training stop condition to obtain the trained target neural network model.

[0183] The above implementation method provided in the embodiment of the present application obtains a training sample set and uses the training sample set to train the target neural network model. During the training process, the loss function value of the above target neural network model is determined. When the loss function value of the above target neural network model does not meet the preset training stop condition, the model parameters of the above target neural network model are adjusted, so as to continuously iterate and optimize the target neural network model, thereby obtaining the trained target neural network model.

[0184] As an implementation of the present application, the determination module may include:

[0185] The determination unit is used to determine a first intersection-and-union ratio corresponding to the predicted identification based on a positional relationship between a position of the predicted identification frame and a position of the identification frame information.

[0186] The determination unit is further used to determine the position offset information between the predicted identification frame and the identification frame information based on the position of the predicted identification frame and the position of the identification frame information.

[0187] The determination unit is further used to determine the relative contour information between the predicted identification frame and the identification frame information according to the size information of the predicted identification frame and the identification frame information.

[0188] The determination unit is further used to determine the loss value according to the first intersection-over-union ratio, the position offset information and the relative contour information.

[0189] The determination unit is further used to determine the adjustment range corresponding to the first intersection-and-combination ratio according to a preset focus factor.

[0190] The determination unit is also used to determine the loss function value of the target neural network model based on the first intersection-and-union ratio, the loss value and the adjustment amplitude.

[0191] The above implementation method provided by the embodiment of the present application first determines the first intersection-and-union ratio based on the positional relationship between the position of the predicted identification box and the position of the identification box information. Then, the position offset information and relative contour information of the identification box are used to determine the loss value in combination with the first intersection-and-union ratio. The adjustment amplitude corresponding to the above first intersection-and-union ratio is also determined according to the preset attention factor, and finally the loss function value of the above target neural network model is determined based on the above first intersection-and-union ratio, the loss value and the above adjustment amplitude. Thereby, an accurate loss function value is obtained.

[0192] As an implementation of the present application, the determining unit may include:

[0193] Determine the subunits for determining the loss using the following formula:

[0194]

[0195] Among them, L CIoU represents CIoU loss, IoU represents the first intersection-over-union ratio, d represents the distance between the reference point of the predicted identification box and the reference point of the identification box information, and c represents the distance between the predicted box and the diagonal of the minimum circumscribed rectangle of the true box. represents the position offset information, α is the weight parameter, v represents the relative contour information.

[0196] The above implementation provided by the embodiment of the present application uses the relative contour information v to calculate the weight parameter α, and uses the distance between the reference point of the predicted identification box and the reference point of the identification box information and the distance between the predicted box and the diagonal of the minimum circumscribed rectangle of the real box to calculate the position offset information, and finally relies on the above data to calculate the loss value. An accurate loss value can be obtained.

[0197] As an implementation of the present application, the determining unit may include:

[0198] The calculation subunit is used to calculate the area of ​​the overlapping region between the predicted identification frame and the identification frame information according to the positional relationship between the predicted identification frame and the identification frame information to obtain a first area.

[0199] The subtraction subunit is used to subtract the area of ​​the overlapping area from the sum of the areas of the predicted identification box and the identification box information to obtain a second area.

[0200] The calculation subunit is further used to calculate the ratio of the first area to the second area to obtain a first intersection-and-union ratio.

[0201] In the above implementation provided by the embodiment of the present application, the first area representing the area of ​​the overlapping region and the second area composed of the two identification frames are calculated respectively according to the positional relationship between the above predicted identification frame and the identification frame information. The ratio of the above first area to the above second area is calculated to obtain the first intersection-and-union ratio. An accurate first intersection-and-union ratio can be obtained.

[0202] As an implementation of the present application, the determining unit may include:

[0203] The determination subunit is used to determine the adjustment amplitude corresponding to the above-mentioned intersection-and-union ratio as a first preset value when the above-mentioned first intersection-and-union ratio is smaller than the above-mentioned first focus factor.

[0204] The determination subunit is further configured to determine the adjustment amplitude corresponding to the above-mentioned intersection-and-union ratio as a second preset value when the above-mentioned first intersection-and-union ratio is greater than the above-mentioned second focus factor, and the above-mentioned first preset value is less than the second preset value.

[0205] The determination subunit is further used to determine the adjustment amplitude corresponding to the first intersection-and-union ratio according to the difference between the first focus factor and the second focus factor and the first intersection-and-union ratio when the first intersection-and-union ratio is greater than the first focus factor and less than the second focus factor.

[0206] In the above implementation mode provided in the embodiment of the present application, the preset attention factor is divided into a first attention factor and a second attention factor, and the first intersection-and-union ratio is compared with the first attention factor and the second attention factor. According to the size relationship between the first intersection-and-union ratio and the first attention factor and the second attention factor, the adjustment amplitude corresponding to the first intersection-and-union ratio is determined accordingly, so as to obtain the adjustment amplitude that accurately corresponds to the first intersection-and-union ratio.

[0207] The various modules in the target detection device provided in the embodiment of the present application can implement the various steps in the above-mentioned target detection method and achieve the corresponding effects. For the sake of concise description, they will not be repeated here.

[0208] Figure 5 A schematic diagram of the structure of the target detection hardware provided in an embodiment of the present application is shown.

[0209] The target detection device may include a processor 501 and a memory 502 storing computer program instructions.

[0210] Specifically, the processor 501 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0211] The memory 502 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 502 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 502 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 502 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 502 is a non-volatile solid-state memory.

[0212] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the target detection method according to any one embodiment of the present disclosure.

[0213] The processor 501 implements any one of the target detection methods in the above embodiments by reading and executing computer program instructions stored in the memory 502 .

[0214] In one example, the target detection device may further include a communication interface 503 and a bus 510. Figure 5 As shown, the processor 501, the memory 502, and the communication interface 503 are connected via a bus 510 and communicate with each other.

[0215] The communication interface 503 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0216] Bus 510 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 510 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.

[0217] In addition, in combination with the target detection method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any target detection method in the above embodiment is implemented.

[0218] An embodiment of the present application also provides a computer program product, including a computer program, which implements any one of the target detection methods in the above embodiments when the computer program is processed and executed.

[0219] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0220] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0221] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0222] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0223] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A target detection method, characterized in that: include: Acquire a target neural network model for target detection and an image to be detected, wherein the target neural network model includes a backbone network, a neck network, and a head network, the backbone network includes an image processing module, and the number of neural network layers of the image processing module is less than a preset number of layers; Inputting the image to be detected into the image processing module, removing fog in the image, and obtaining a first image corresponding to the image to be detected; The first image is subjected to target detection through the feature extraction module of the backbone network, the neck network and the head network in the target neural network model to obtain a target detection result, wherein the target detection result includes the position and type of the target in the image to be detected.

2. The target detection method according to claim 1, characterized in that: Before acquiring the target neural network model for target detection and the image to be detected, the method further includes: Acquire a training sample set; the training sample set includes a plurality of training samples, each of the training samples includes a sample image and a labeling file corresponding to the sample image, the labeling file includes a target label in the sample image, and the target label includes a target type label and identification box information; For each training sample, perform the following steps: Inputting the sample image into the target neural network model to determine the predicted detection result of the target in the sample image, wherein the predicted detection result includes a predicted identification box and a target prediction type; Determining the loss function value of the target neural network model according to the predicted detection results of each of the training samples and the corresponding target labels; When the loss function value of the target neural network model does not satisfy the preset training stop condition, the model parameters of the target neural network model are adjusted, and the sample image is input into the target neural network model to determine the prediction result of the image annotation. When the loss function value of the target neural network model meets the preset training stop condition, the training is stopped to obtain the trained target neural network model.

3. The target detection method according to claim 2, characterized in that: Determining the loss function value of the target neural network model according to the predicted detection results of each of the training samples and the corresponding annotation files includes: Determining a first intersection-over-union ratio corresponding to the predicted identification based on a positional relationship between a position of the predicted identification frame and a position of the identification frame information; Determining position offset information between the predicted identification frame and the identification frame information based on the position of the predicted identification frame and the position of the identification frame information; Determining relative contour information between the predicted identification frame and the identification frame information according to size information of the predicted identification frame and the identification frame information; Determine a loss value according to the first intersection-over-union ratio, the position offset information and the relative contour information; Determining an adjustment range corresponding to the first intersection-and-combination ratio according to a preset attention factor; The loss function value of the target neural network model is determined based on the first intersection-over-union ratio, the loss value and the adjustment amplitude.

4. The target detection method according to claim 3, characterized in that: The determining of the loss value according to the first intersection-over-union ratio, the position offset information and the relative contour information comprises: The loss value is determined by the following formula: Among them, L CIoU represents the loss value, IoU represents the first intersection-over-union ratio, d is the distance between the reference point of the predicted identification box and the reference point of the identification box information, and c is the distance between the predicted box and the diagonal of the minimum circumscribed rectangle of the real box. represents the position offset information, α is the weight parameter, v represents the relative contour information.

5. The target detection method according to claim 3, characterized in that: The determining, based on the positional relationship between the position of the predicted identification frame and the position of the identification frame information, a first intersection-over-union ratio corresponding to the predicted identification includes: Calculating the area of ​​an overlapping region between the predicted identification frame and the identification frame information according to the positional relationship between the predicted identification frame and the identification frame information to obtain a first area; Subtract the area of ​​the overlapping area from the sum of the areas of the predicted identification frame and the identification frame information to obtain a second area; The ratio of the first area to the second area is calculated to obtain a first intersection-and-union ratio.

6. The target detection method according to claim 3, characterized in that: The preset attention factor includes a first attention factor and a second attention factor, the first attention factor is smaller than the second attention factor, and the determining the adjustment range corresponding to the first intersection-and-joint ratio according to the preset attention factor includes: When the first intersection-and-union ratio is less than the first focus factor, determining the adjustment amplitude corresponding to the intersection-and-union ratio as a first preset value; When the first intersection-and-union ratio is greater than the second focus factor, the adjustment amplitude corresponding to the intersection-and-union ratio is determined to be a second preset value, and the first preset value is less than the second preset value; When the first IoU is greater than the first focus factor and less than the second focus factor, an adjustment amplitude corresponding to the first IoU is determined according to a difference between the first focus factor and the second focus factor and the first IoU.

7. A target detection device, characterized in that: The device comprises: An acquisition module, used to acquire a target neural network model for target detection and an image to be detected, wherein the target neural network model includes a backbone network, a neck network and a head network, the backbone network includes an image processing module, and the number of neural network layers of the image processing module is less than a preset number of layers; A removal module, used for inputting the image to be detected into the image processing module, removing fog from the image, and obtaining a first image corresponding to the image to be detected; A detection module is used to perform target detection on the first image through the feature extraction module of the backbone network, the neck network and the head network in the target neural network model to obtain a target detection result, wherein the target detection result includes the position and type of the target in the image to be detected.

8. A target detection device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the target detection method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the target detection method according to any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the target detection method as described in any one of claims 1 to 6.