An unmanned aerial vehicle micro-target detection method based on dynamic loss scheduling
Patent Information
- Application Number
- CN202610884231.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-18
- Publication Date
- 2026-08-28
AI Technical Summary
上述方法能够在一定程度上改善小目标表征,但在无人机航拍场景中仍存在误报增加、精细定位不足和训练稳定性不足等问题
1. 通过 SIL 惩罚项将预测框与真实框的宽高对数比例误差、真实框尺寸归一化中心偏差共同映射为动态惩罚系数,使微小目标中的尺度误差和中心偏移能够获得更强的回归反馈;
Smart Images

Figure CN122657761A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of target detection and computer vision technology, and in particular to a method for detecting small targets in unmanned aerial vehicles based on dynamic loss scheduling. Background Technology
[0002] Drone aerial images are characterized by high shooting angles, small target scales, complex background textures, occlusion, and large scale variations. In detection scenarios such as pedestrians, non-motorized vehicles, and small vehicles, the target occupies a small pixel area in the image, and even slight deviations in the bounding box width, height, and center position can affect the detection results. General target detection methods suffer from technical problems such as missed detections, false detections, and unstable localization.
[0003] Existing small target detection methods typically include increasing input resolution, adding shallow high-resolution feature branches, expanding the small target detection head, introducing attention or feature fusion modules, and improving bounding box regression loss and sample allocation strategies. While these methods can improve the representation of small targets to some extent, they still suffer from problems such as increased false alarms, insufficient fine-grained localization, and inadequate training stability in UAV aerial photography scenarios.
[0004] Specifically, while shallow high-resolution features enhance the texture information of small targets, they also amplify high-frequency background interference such as leaf gaps, road textures, roof edges, and shadow reflections, causing background areas to be misidentified as targets. Traditional IoU, GIoU, DIoU, CIoU, or static weighted loss functions are mainly designed for targets of normal scale and do not adequately address single-pixel-level center offsets and width / height deviations of small targets.
[0005] Furthermore, under limited hardware resources such as consumer-grade graphics cards or embedded GPUs, high-resolution aerial image training typically uses small batches, and fluctuations in the distribution of small batch samples can amplify gradient oscillations. In mixed-precision training environments, when the normalized width and height of small targets are involved in squaring, division, or exponential operations, there is a risk of half-precision underflow, division-to-zero anomalies, or numerical divergence, which can cause non-numerical or convergence anomalies in the training process.
[0006] Therefore, a training method for detecting small targets on UAVs is needed. This method should enhance target representation by utilizing high-resolution features, while simultaneously constraining the scale bias of small targets, differences in training stages, and numerical risks associated with mixed accuracy. This will improve detection accuracy, training stability, and practical deployment feasibility. Summary of the Invention
[0007] To address the aforementioned technical problems, this invention provides a method for detecting small targets on unmanned aerial vehicles (UAVs) based on dynamic loss scheduling. This method does not rely on simply adding a detection head or simply superimposing existing loss terms. Instead, it uses the logarithmic scale invariance penalty (SIL) as the main constraint. Through staged dynamic loss scheduling (DLS), it collaboratively designs SIL, Inner-IoU, momentum smoothing focusing, and a mixed-precision numerical anti-collapse mechanism to achieve stable and high-precision detection of small targets captured by UAVs.
[0008] This invention is achieved using the following technical solution: A method for detecting small targets on a UAV based on dynamic loss scheduling includes the following steps: Step S1: Obtain the drone aerial image dataset, and divide the images and annotations into training and validation sets to construct a data input format suitable for training the target detection model; Step S2: A shallow high-resolution feature branch is introduced into the feature extraction and detection head structure of the basic target detection network YOLOv8n. The fine-grained representation capability of small targets is enhanced by extracting P2 scale features, and the edge information of discrete pixels is preserved by using nearest neighbor upsampling. Step S3: Construct a log-scale invariant penalty term SIL in the bounding box regression loss. The dynamic penalty coefficient is generated by the logarithmic distance between the predicted box and the true box and the normalized distance of the center point, so as to enhance the model's sensitivity to small target scale deviations and positional deviations. Step S4: Construct the Inner-IoU metric in the bounding box regression loss. By shrinking the predicted box and the ground truth box inward by a preset ratio, the intersection-union ratio is recalculated to amplify the localization difference caused by the single-pixel offset of the small target. Step S5: Introduce a momentum smoothing focusing mechanism based on the historical IoU mean in the bounding box regression loss, perform an exponential moving average on the IoU loss of this batch, and generate dynamic non-monotonic focusing coefficients to reduce gradient oscillations under mini-batch training conditions. Step S6: Based on the number of training steps, perform phased dynamic loss scheduling on the SIL penalty term and the Inner-IoU metric term, enhance global structure alignment in the early stage of training, and enhance fine regression of small targets in the middle and late stages of training to form a composite bounding box regression loss; Step S7: During mixed-precision training, perform floating-point upscaling, denominator lower bound truncation, and exponent upper bound circuit breaking on key calculations of bounding box width, height, and center coordinates to avoid numerical underflow, division by zero anomalies, and exponent explosion in regression calculations for small targets. Step S8: Use the network and loss function constructed in steps S2 to S7 to train and validate the UAV aerial images, and output the small target detection results.
[0009] Furthermore, step S2 reduces the loss of detail smoothing caused by bilinear interpolation by preserving the P2 feature layer and employing nearest-neighbor upsampling.
[0010] Furthermore, the SIL penalty term in step S3 amplifies the small target width and height deviations through a logarithmic function, and strengthens the position deviation penalty through the center point normalized distance.
[0011] Furthermore, the scaling ratio of the indentation auxiliary box in step S4 is preferably 0.8.
[0012] Furthermore, the momentum coefficient in step S5 is preferably 0.01.
[0013] Furthermore, the dynamic loss scheduling in step S6 is switched in three stages according to the training life cycle: in the early stage, the focus is on structural stability alignment; in the middle stage, a balanced transition is carried out; and in the later stage, the focus is on fine alignment of small targets.
[0014] Furthermore, step S7 includes: performing FP32 upscaling on the critical width and height operations, truncating the denominator involved in the division operation to a minimum value of 1×10^-4, and performing circuit breaking on the exponent penalty term to a maximum value of 5.0.
[0015] The beneficial effects of this invention are as follows: 1. By using the SIL penalty term, the logarithmic ratio error of the width and height between the predicted box and the ground truth box, as well as the normalized center deviation of the ground truth box size, are mapped together into a dynamic penalty coefficient, so that the scale error and center offset in small targets can obtain stronger regression feedback. 2. By using dynamic loss scheduling DLS, SIL is prioritized to maintain structural stability in the early stages of training, while Inner-IoU fine-tuning weights are gradually increased in the later stages of training to avoid training mutual exclusion caused by static superposition of highly sensitive loss terms. 3. By introducing shallow P2 high-resolution features and combining them with nearest-neighbor upsampling, edge details and skeleton information of small targets are effectively preserved; 4. Enhance the model's sensitivity to small target scale errors and positional deviations by using a SIL penalty term; 5. By amplifying the regression differences caused by single-pixel shifts of tiny targets through Inner-IoU, the ability to achieve fine localization in later stages is improved; 6. Improve training stability by reducing gradient oscillations caused by mini-batch training through momentum smoothing and focusing mechanisms; 7. The numerical anti-collapse pipeline addresses the issues of underflow and NaN (non-numerical) collapse that easily occur in the regression calculation of small targets under half-precision training; 8. It can still achieve high detection accuracy and stable training results under complex backgrounds and consumer-grade hardware constraints.
[0016] Furthermore, this invention does not simply piece together existing detection models into modules, but rather establishes a collaborative solution mechanism around four core challenges in UAV small target detection: The first type of contradiction is the conflict between "high-resolution shallow detail enhancement" and "increased false positives due to background noise". To address this issue, this invention, on the one hand, preserves and utilizes the P2 high-resolution features, enabling the detection head to perceive the contours and texture details of small targets; on the other hand, it strengthens structural alignment in the early and middle stages of training through the SIL penalty term, preventing the model from blindly identifying high-frequency background textures as targets due to shallow texture enhancement.
[0017] The second type of contradiction is the conflict between "the need for stable global alignment in the early stages of training" and "the need to enhance the awareness of minimal offsets in the later stages of training." To address this issue, this invention employs Dynamic Loss Scheduling (DLS), which switches between global constraints and fine-grained constraints in stages according to the training lifecycle, avoiding target conflicts caused by static weighting.
[0018] The third type of contradiction is the conflict between "mini-batch training oscillations" and "highly sensitive regression loss gradients being prone to fluctuations." To address this issue, this invention introduces a historical mean cache and momentum smoothing focusing mechanism within the bounding box loss. By using an exponential moving average to form a stable reference, the gradient contribution of the current batch is dynamically adjusted relative to historical statistics, thereby improving training stability.
[0019] The fourth type of contradiction is the conflict between "saving resources with mixed precision" and "insufficient stability of numerical calculations for small targets". To address this issue, this invention establishes a low-level numerical protection mechanism that combines floating-point incrementing, denominator truncation, and exponent circuit breaking, enabling the proposed loss design to operate stably in real-world engineering environments.
[0020] Furthermore, the technical solution of this invention has strong transferability. Although this embodiment is mainly aimed at the target detection task of VisDrone 2019 UAV aerial photography, the proposed dynamic loss scheduling mechanism, shrinkage auxiliary box measurement mechanism, and numerical anti-collapse pipeline can also be extended to other scenarios with dense distribution of small targets, such as high-altitude remote sensing target detection, low-altitude traffic perception, port vessel monitoring, power line inspection, and urban security patrol, etc., and therefore has high promotion and application value.
[0021] Furthermore, this invention also possesses software implementation compatibility. The method can be embedded in a single-stage detection framework based on PyTorch, or it can be transferred to other detection models with multi-scale feature pyramids and bounding box regression branches. For different base networks, as long as shallow feature utilization, bounding box regression loss construction, and training lifecycle scheduling interfaces exist, the core technical solution of this invention can be reused. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings will be briefly described below.
[0023] Figure 1 This is an overall flowchart of the UAV small target detection method based on dynamic loss scheduling in an embodiment of the present invention; Figure 2 This is a schematic diagram of the improved YOLOv8 detection network and SIL-DLS training supervision structure in an embodiment of the present invention; Figure 3 This is a schematic diagram of the composite loss structure of the SIL penalty term, Inner-IoU, and momentum smoothing focusing mechanism in an embodiment of the present invention; Figure 4 This is a schematic diagram of the three-stage weight switching of the dynamic loss scheduling DLS in an embodiment of the present invention; Figure 5 This is a schematic diagram of a numerical anti-collapse pipeline under mixed-precision training in an embodiment of the present invention; Figure 6 This is a general representation of the ablation experiment results under different experimental configurations in the embodiments of the present invention; Figure 7 This is a comparison chart of the detection effects of different experimental configurations in a typical UAV aerial photography scenario in an embodiment of the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention.
[0025] This invention proposes a method for detecting small targets on unmanned aerial vehicles (UAVs) based on dynamic loss scheduling, primarily targeting the detection of pedestrians, vehicles, and other small targets in the VisDrone2019 UAV aerial photography dataset. In this embodiment, P2 shallow high-resolution features serve as an optional embedding carrier for the target detection network. SIL logarithmic scale penalty, DLS dynamic loss scheduling, and numerical anti-collapse pipeline constitute the core bounding box regression training mechanism of this invention. Because these targets are extremely small in size, have complex backgrounds, and are easily affected by texture noise in images, traditional general-purpose target detection methods suffer from shortcomings in accuracy and stability. This embodiment improves the performance of small target detection through a joint design of "shallow high-resolution feature enhancement + composite bounding box regression loss + dynamic scheduling + numerical anti-collapse."
[0026] As shown in Figure 1, the method of the present invention includes the following steps, wherein S1, S2 and S8 are used to illustrate typical training carriers and engineering scenarios, and S3 to S7 are used to illustrate the SIL-DLS composite bounding box regression training mechanism and its numerical stability implementation: S1: Acquire drone aerial images and their target annotation information, and organize the data into a dataset format suitable for target detection training. In this embodiment, the VisDrone2019 target detection dataset is used, which includes 10 categories: pedestrian, person, bicycle, car, van, truck, tricycle, awning-tricycle, bus, and motor.
[0027] In this embodiment, the original dataset includes a training set, a validation set, and a test / development set. The images are aerial photographs taken by drones at different altitudes, from different perspectives, and in different urban scenes. The targets in the images exhibit characteristics such as small size, multiple occlusions, complex backgrounds, and uneven class distribution. In particular, there are many pedestrian and person targets, but their average size is small. They are affected by tree shadows, building facade textures, road markings, and reflections from vehicle roofs. Therefore, these images can serve as typical data scenarios for verifying the effectiveness of the technical solution of this invention.
[0028] To facilitate training, the original labeled data needs to be organized into a unified object detection format. In one implementation, the label file corresponding to each image is saved as a text file, and each object record includes a category number, normalized coordinates of the bounding box center point, and normalized coordinates of width and height. Simultaneously, the training set path, validation set path, and category names are specified through a data configuration file, enabling the training framework to automatically load the data.
[0029] Regarding training parameter settings, this embodiment preferably uses an input size of 640, a training cycle of 150 rounds, a batch size of 4, automatic mixed precision training, an initial learning rate of 0.01, a momentum of 0.937, and a weight decay of 0.0005, while maintaining conventional object detection data augmentation strategies, including random scaling, translation, color dithering, and horizontal flipping. Since the dataset is from drone aerial photography, an input size that is too small will lead to the loss of information about small targets, while an input size that is too large will increase memory usage. Therefore, an input size of 640 strikes a balance between accuracy and computational resources.
[0030] S2: Constructing an improved object detection network structure. In this embodiment, YOLOv8n is used as the base network, and a high-resolution P2 feature layer is introduced to preserve small object edges and texture details. Nearest neighbor interpolation is used during the feature pyramid upsampling process to avoid the smoothing effect of bilinear interpolation on fine-grained textures. The P2 features can be input to the detection head to form a four-head detection structure, or they can be fed back to the P3, P4, and P5 features through a bottom-up enhancement path to form a three-head fusion detection structure.
[0031] More specifically, in one four-head implementation, the four scale feature maps (P2, P3, P4, and P5) output by the backbone network participate in detection, allowing the shallowest layer's 4x downsampled features to participate in the small target detection task. This approach helps enhance the representation of extremely small targets, but it also amplifies background noise. To further improve this issue, in another fusion implementation, the fine-grained features of P2 are first concatenated and fused with the features of P3, and then fed back to P4 and P5 step by step through a bottom-up path, enabling the deep detection head to absorb shallow detail information while maintaining semantic representation capabilities. Compared to the four-head output method, this fusion structure can reduce false positives and improve the purity of detection results in some experiments.
[0032] In terms of feature upsampling, this embodiment replaces bilinear interpolation with nearest-neighbor interpolation. The reason is that bilinear interpolation smooths out single-pixel-level texture changes, which can cause shape blurring for extremely small target edges, leading to a decay of the originally finite edge structure. Nearest-neighbor interpolation, on the other hand, preserves pixel-level abrupt changes, helping to maintain the skeleton of small target contours.
[0033] In terms of the detection head structure, this embodiment employs a decoupled head design, allowing the classification branch and the regression branch to learn target category information and bounding box localization information, respectively. For UAV small target tasks, the classification branch focuses more on the existence of the target and its category classification, while the regression branch relies more on shallow textures and fine positional relationships. The decoupled design helps reduce gradient interference between the two types of tasks.
[0034] In a more specific network implementation, the backbone network first outputs multi-scale features P2, P3, P4, and P5; then, it forms a feature pyramid through upsampling and cross-layer concatenation; finally, it generates detection feature maps that can be used by the classification and regression branches through a convolution and feature fusion module. If a four-head detection structure is used, P2 participates in target prediction; if a three-head fusion structure is used, P2 serves as a source of shallow details and participates in prediction after enhancing P3, P4, and P5 through the fusion path. Both implementations can be considered optional variations of this invention.
[0035] S3: Construct the SIL penalty term. For the predicted and ground truth bounding boxes in the foreground samples, first calculate the logarithmic scale shape distance of the width and height: ; Then calculate the normalized distance to the center point: ; The epsilon is preferably set to 1×10^-4. Then, the SIL penalty coefficient is constructed: ; To prevent excessively large exponent values from causing training instability, an upper bound circuit breaker is applied to the penalty coefficient in this embodiment: ; S4: Construct the Inner-IoU metric. Set the shrinkage ratio to 0.8. Shrink the predicted and ground truth bounding boxes inwards from their center points to obtain shrunken predicted and ground truth bounding boxes. Then recalculate the intersection-union ratio (IoU) and define the shrinkage loss as: ; Because the size of tiny targets is small, a single pixel offset will cause greater IoU fluctuations on the indentation box, so this factor is beneficial for improving the fine localization capability in the later stages of training.
[0036] In this embodiment, 0.8 is chosen as the shrinkage ratio to achieve a balance between fine sensitivity and numerical stability. If the shrinkage ratio is too large, the difference between the shrunken box and the original box will be small, making it difficult to demonstrate the effect of "amplifying micro-offsets"; if the shrinkage ratio is too small, the shrunken box will shrink too much, resulting in large fluctuations in the early stages of training because the predicted boxes are not yet stable. Therefore, in the preferred embodiment, Inner-IoU is mainly introduced in the later stages of training, rather than being fully enabled at the beginning of training.
[0037] S5: Construct a momentum smoothing focusing mechanism. Register the historical IoU mean cache variable `iou_mean` in the bounding box loss module, and perform exponential moving average updates on the IoU loss for the current batch: ; The momentum coefficient m is preferably 0.01. Then, a focusing coefficient is constructed based on the ratio of the IoU loss of this batch to the historical mean, so that the model neither overemphasizes outlier samples nor ignores moderately difficult samples, thereby mitigating the drastic gradient fluctuations caused by small batch sizes.
[0038] In one implementation, the ratio of the current batch's IoU loss to the historical mean is denoted as beta, and a focusing coefficient r is generated using a non-monotonic function, allowing overly easy samples, moderately difficult samples, and extremely difficult samples to have different adjustment ranges. Unlike traditional fixed-weight regression loss, this scheme can use the historical mean to form a dynamic reference system, preventing the overall gradient direction from becoming unstable due to an overly difficult batch or an abnormal label distribution.
[0039] Furthermore, since the batch size is preferably 4 in the training environment targeted by this embodiment, and the statistical fluctuations of samples in a single batch are relatively large, the historical mean buffer variable is preferably registered as a buffer that does not participate in backpropagation, so as to ensure that the variable is updated smoothly and gradually during the training process without being disturbed by gradient propagation. This implementation can be accomplished in the underlying code by registering a cache variable.
[0040] In a preferred implementation, the initial value of the historical mean cache variable can be set to 1.0, and the initial value of the training step count variable can be set to 0.0. The former is used to provide a stable reference for the IoU loss in the early stages of training when sufficient statistics have not yet been obtained, while the latter is used to automatically switch the loss weights according to the training progress during each forward propagation. This avoids the need to build an additional complex external scheduler and reduces the complexity of the engineering implementation.
[0041] S6: Construct a Dynamic Loss Scheduling (DLS). In this embodiment, by registering a step count variable `step_count` in the bounding box loss module, the training process is divided into three stages according to the number of training steps: Phase 1: During the first 50% of the training lifecycle, set w_iou=1.0, w_sil=0.5, and w_inner=0.0 to ensure stable structural alignment and suppress shallow false alarms. Phase 2: During the middle 30% of the training lifecycle, set w_iou=1.0, w_sil=0.3, and w_inner=0.3 to gradually introduce fine regression with small targets while ensuring overall stability; Phase 3: 20% of the training lifecycle, set w_iou=1.0, w_sil=0.1, w_inner=0.5 to reduce the global traction strength of SIL and highlight the role of Inner-IoU in fine localization of small targets.
[0042] The final bounding box regression loss can be expressed as: ; Where r is the dynamic focusing coefficient generated by the momentum smoothing focusing mechanism.
[0043] In one specific implementation, if the training batch size is 4, the average number of training steps per epoch is approximately 1618, and the total number of training epochs is 150, then the total number of training steps is approximately 242,700. Based on this, the threshold for the first stage can be set to 121,350 steps, and the threshold for the second stage to 194,160 steps. That is to say: 1. When the number of training steps is less than 121350, the first-stage loss weights are used; 2. When the number of training steps is greater than or equal to 121350 and less than 194160, the second-stage loss weights are used; 3. When the number of training steps is greater than or equal to 194160, the third-stage loss weight is used.
[0044] The core idea of the above scheduling method is to first solve the problem of "rough alignment of target positions" in the early stage of training, solve the problem of "balancing coarse and fine" in the middle stage of training, and solve the problem of "fine-tuning with minimal offsets" in the later stage of training. Compared with static fixed combination of multiple losses, this scheduling method can reduce early mutual exclusion and late internal friction between loss terms.
[0045] S7: Construct a numerical anti-collapse pipeline. Because under mixed-precision training conditions, the normalized width and height of small targets are prone to falling below the FP16 representation limit in squaring and division operations, this embodiment performs the following processing on key variables: 1. Calculate the width, height, and center point of the predicted bounding box and the ground truth bounding box, and then use float() to increase the size to FP32; 2. Truncate the width and height involved in the division operation using the clamp(min=1×10^-4) method; 3. Apply a clamp (max=5.0) circuit breaker to the exponent result in the SIL penalty term.
[0046] By using the above methods, NaN (non-numerical) crashes caused by underflow, division by zero, and exponential explosion can be effectively avoided in mixed-precision training.
[0047] More specifically, when the normalized width of certain extremely small targets in a UAV image is approximately 0.005, its squared magnitude can be as low as 2.5 × 10^-5. In a half-precision floating-point environment, this value is close to or even below the effective range that can be stably represented. If it continues to participate in denominator operations, there is a risk of hardware rounding, division by zero, or amplification of errors. Therefore, the numerical protection in this embodiment is not a general empirical technique, but a necessary engineering measure designed for the characteristics of the bounding box computational magnitude in scenarios with tiny targets.
[0048] Furthermore, in this embodiment, when calculating the width and height of the predicted and ground truth bounding boxes, the coordinate tensor is first converted to FP32, and then the width-to-height difference and clamp operations are performed. This ensures that subsequent logarithmic operations and center distance normalization calculations are performed within a relatively stable numerical range. For the exponential penalty term, an upper bound circuit breaker is used to ensure that even if some outlier samples produce large deviations, they will not cause abnormal gradient effects on the entire batch of training.
[0049] In engineering implementation, the numerical anti-collapse pipeline can be placed inside the forward propagation function of the bounding box loss module. That is, immediately after extracting the coordinates of the predicted and true bounding boxes, the width-to-height difference and center point are adjusted and truncated before proceeding with subsequent calculations of IoU, SIL, and Inner-IoU. This arrangement ensures that all highly sensitive calculations are stabilized before entering the critical formulas, thereby improving the protection effect.
[0050] S8: Perform training and validation. In this embodiment, the preferred training data input size is 640, the preferred batch size is 4, the preferred number of training rounds is 150, and automatic mixed precision training is enabled. Experimental results show that, compared with the original YOLOv8n baseline, the method of this invention can achieve higher accuracy and mAP50 in the small target detection task, while the training process is more stable.
[0051] In a set of typical experiments, the baseline was set to the original YOLOv8n; the first set of comparative experiments introduced only the P2 shallow detection structure; the second set of comparative experiments statically superimposed SIL penalty on the P2 structure; the third set of comparative experiments introduced momentum smoothing WIoU after repairing numerical stability; the fourth set of comparative experiments statically fused multiple losses after repairing numerical stability; and the final experiment simultaneously employed P2 feature enhancement, numerical anti-collapse pipeline, and dynamic loss scheduling.
[0052] Experimental phenomena show that: 1. When only P2 high-resolution features are introduced, although the model has a stronger ability to perceive shallow details, the number of false alarms increases, indicating that shallow detail enhancement must be used in conjunction with a more reasonable loss constraint mechanism. 2. When a highly sensitive penalty term is statically superimposed in the early stages of training, there is a risk of training divergence or even collapse due to the instability of half-precision values and the mutual exclusion of losses. 3. When the momentum smoothing and focusing mechanism is added, the stability of mini-batch training is improved, and the fluctuation of the training curve is reduced; 4. When dynamic loss scheduling is used instead of static fixed weight combination, the model can continue to improve the fine localization capability of small targets in the later stage on the basis of stable convergence in the early stage, and finally obtain better accuracy and average precision.
[0053] Furthermore, the ablation experiment in this embodiment includes the following comparative settings: 1. Baseline: Uses the original YOLOv8n; 2. Exp 1: Only introduce the P2 shallow high-resolution detection structure; 3. Exp 2: Static superposition of SIL penalty terms based on the P2 structure; 4. Exp 3: Introduce momentum smoothing WIoU after fixing numerical stability; 5. Exp 4: Static fusion of multivariate losses after fixing numerical stability; 6. Final: A combined scheme of P2 feature enhancement, numerical anti-collapse pipeline and dynamic loss scheduling is adopted.
[0054] Experimental results show that while introducing P2 shallow features alone can enhance the representation of small targets, it will increase background false alarms; statically stacking higher-order loss terms will cause mutual interference during training and generate the risk of numerical collapse; by adopting the dynamic loss scheduling and anti-collapse pipeline of the present invention, high performance in detecting small targets can be achieved while maintaining training stability.
[0055] In a preferred embodiment, the final model achieves improved accuracy and mAP50 on the VisDrone2019 validation set compared to the baseline model, and the training process can stably complete 150 epochs without exhibiting early NaN (non-numerical) anomalies, mid-training loss explosions, or late-stage accuracy regressions. This demonstrates that the present invention not only proposes multiple joint loss designs at the technical solution level but also verifies its feasibility and effectiveness in a real-world engineering environment.
[0056] Furthermore, the various technical modules of this invention are not isolated from each other, but rather have a close synergistic relationship. The P2 high-resolution feature provides richer, finer-grained visual information for small targets; the SIL penalty term suppresses the false positive risk caused by shallow augmentation in the early and middle stages of training; Inner-IoU further amplifies subtle offset errors in the later stages of training; the momentum smoothing mechanism provides a stable reference for mini-batch training; and the numerical anti-collapse pipeline ensures that the aforementioned highly sensitive loss design can be realistically implemented in mixed-precision environments. It is precisely because of the combined effect of these modules that this invention differs from existing methods that only make single-point improvements.
[0057] To further illustrate the scope of application of the present invention, several alternative embodiments are given below: Example 1: At the network structure level, P2 features can be obtained using either a detection head approach or a fusion enhancement approach. The detection head approach emphasizes the perception of extremely small targets, while the fusion enhancement approach emphasizes the suppression of false alarms and the balance of detection accuracy.
[0058] Example 2: At the loss scheduling level, the three-stage weight switching can be defined according to the number of training steps, training epochs, or the performance inflection point of the validation set; as long as the scheduling principle of bias towards global structure alignment in the early stage, balanced transition in the middle stage, and bias towards fine-grained regression in the later stage is met, it should be regarded as an equivalent variation of the present invention.
[0059] Example 3: At the level of the inner shrinking auxiliary frame, the scaling ratio can be adaptively set according to the target size distribution, such as 0.7, 0.75, 0.8 or 0.85, etc.; as long as the idea of amplifying the positioning deviation of a small target through the inner shrinking frame is adopted, it can fall within the protection scope of this invention.
[0060] Example 4: In terms of numerical crash prevention, the minimum cutoff value and the maximum circuit breaker value can be appropriately adjusted according to the training framework and data distribution. For example, the lower bound of the denominator can be set to a value between 1×10^-5 and 1×10^-3, and the upper bound of the exponent can be set to a value between 3.0 and 8.0. As long as the bottom-line protection concept for the risk of mixed precision underflow is adopted, it can be regarded as the equivalent technical means of the present invention.
[0061] Example 5: At the training environment level, this invention is applicable to both consumer-grade laptop GPU environments and workstation GPU, edge server, or cloud training environments. Under conditions of sufficient resources, the input resolution or batch size can be appropriately increased; under conditions of limited resources, the engineering advantages of the momentum smoothing and numerical anti-crash mechanisms of this invention are more evident.
[0062] This invention can be adapted and extended to different application scenarios. For example, in port vessel monitoring, the method can be applied to the detection of small vessels, buoys, and operational targets at sea; in power line inspection, it can be applied to the detection of insulator defects, foreign object attachment points, or small equipment at long distances; and in urban security, it can be applied to the detection of pedestrians, bicycles, electric vehicles, and illegally parked vehicles from a high-altitude perspective. For different target categories and imaging resolutions, the basic technical concept of this invention can be reused simply by adjusting the data configuration, the number of detection categories, and the training step threshold accordingly.
[0063] In another embodiment, the method of the present invention can also be packaged as a software program product, which is stored in a computer-readable storage medium and, when run on a processor, executes the various steps of the above-described UAV micro-target detection method. The computer-readable storage medium can be a hard disk, solid-state drive, read-only memory, random access memory, flash memory, or other media capable of storing program code.
[0064] Furthermore, the apparatus for executing the method of the present invention may include at least one processor, at least one memory, and a communication interface. The memory stores program instructions executable by the processor. When these program instructions are executed, the processor performs steps such as data reading, model building, loss scheduling, numerical stability processing, model training, and object detection inference. The aforementioned apparatus, system, and program product forms can all be considered as corresponding implementations of the method of the present invention in engineering applications.
[0065] In summary, the UAV micro-target detection method based on dynamic loss scheduling proposed in this invention not only provides a systematic solution to the core problems of "insufficient target representation, inaccurate positioning, unstable training, and insufficient numerical stability" of UAV micro-targets, but also achieves stable detection results under limited hardware conditions, thus having practical value.
[0066] It should be noted that the values of training rounds, scheduling threshold, shrinkage ratio, momentum coefficient, input size, and loss weight in this invention can be appropriately adjusted according to the specific dataset size, hardware environment, and target distribution, and should not be construed as limiting the scope of protection of this invention. Any application of the combined approach described in this invention, which uses SIL logarithmic scale invariance penalty as its core, combined with dynamic loss scheduling, fine-grained shrinkage auxiliary box measurement, momentum smoothing focusing, and numerical anti-collapse mechanisms, should be considered to fall within the scope of protection of this invention.
[0067] For the sake of simplicity, the foregoing embodiments are described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the order of the described actions. Without departing from the spirit and scope of the present invention, some steps may be performed in other orders or in parallel.
[0068] The above embodiments describe the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments, and all modifications and variations made by those skilled in the art without departing from the spirit and scope of the present invention should fall within the protection scope of the appended claims.
Claims
1. A method for detecting small targets using a UAV based on dynamic loss scheduling, characterized in that, The process includes the following steps: Step S1, acquiring a dataset of drone aerial images and constructing a target detection training data format; Step S2, inputting the training data into a target detection network with a bounding box regression branch; Step S3, constructing a SIL log-scale invariant penalty term in the bounding box regression loss, wherein the SIL log-scale invariant penalty term generates a joint penalty based on the difference in the logarithmic ratio of the width and height of the predicted box and the ground truth box, as well as the normalized distance of the center point; Step S4, constructing an Inner-IoU indentation auxiliary box metric; Step S5, introducing a momentum smoothing focusing mechanism based on the historical IoU mean; Step S6, performing phased dynamic loss scheduling on the SIL penalty term and the Inner-IoU metric term based on the number of training steps; Step S7, performing floating-point promotion, denominator lower bound truncation, and exponent upper bound circuit breaking in mixed-precision training; Step S8, training the model using the target detection network, the composite bounding box regression loss, and the numerical stability pipeline, and outputting the drone small target detection results.
2. The UAV small target detection method based on dynamic loss scheduling as described in claim 1, characterized in that, The target detection network in step S2 is a single-stage target detection network based on YOLOv8, and a P2 shallow high-resolution feature branch is introduced into the target detection network. Nearest neighbor upsampling is used to preserve the edge information of small targets. The P2 shallow high-resolution feature branch serves as the network embedding carrier for the SIL-DLS composite bounding box regression training mechanism.
3. The UAV small target detection method based on dynamic loss scheduling as described in claim 1, characterized in that, Step S1 includes: selecting a drone aerial target detection dataset containing categories such as pedestrians, vehicles, bicycles, tricycles, buses, and trucks; organizing image files, label files, and data configuration files into a target detection training format; setting the input size, number of training rounds, batch size, and data augmentation parameters according to training requirements; and inputting the processed data into the target detection training framework.
4. The UAV small target detection method based on dynamic loss scheduling as described in claim 1, characterized in that, In step S3, let the width and height of the predicted box be w_p and h_p, the width and height of the true box be w_g and h_g, the center point of the predicted box be (cx_p, cy_p), the center point of the true box be (cx_g, cy_g), and the log-scale shape distance, the center point normalized distance, and the SIL penalty coefficient be as follows; ; ; ; Here, epsilon is a stabilizing term to prevent the denominator from being zero, and alpha is a scale balance factor.
5. The UAV small target detection method based on dynamic loss scheduling as described in claim 1, characterized in that, Step S4 includes: setting the shrinkage ratio as ratio, constructing a shrinkage prediction box based on the center point of the prediction box, and constructing a shrinkage real box based on the center point of the ground box; the coordinates of the shrinkage prediction box and the shrinkage loss are shown below respectively. ; ; ; The shrinkage ratio is preferably 0.
8.
6. The UAV small target detection method based on dynamic loss scheduling as described in claim 1, characterized in that, Step S5 includes: registering the historical IoU mean cache variable IoU_mean in the bounding box loss module; performing an exponential moving average update on the current batch IoU loss; generating a dynamic focusing coefficient based on the ratio of the current batch IoU loss to the historical mean to suppress the impact of abnormal batches on training stability; the exponential moving average update is shown below; ; Where m is the momentum coefficient.
7. The UAV small target detection method based on dynamic loss scheduling as described in claim 1, characterized in that, Step S6 includes: setting the weight of the basic IoU regression term to 1.0, the weight of the SIL penalty term to 0.5, and the weight of the Inner-IoU term to 0 during the first 50% of training; setting the weight of the basic IoU regression term to 1.0, the weight of the SIL penalty term to 0.3, and the weight of the Inner-IoU term to 0.3 during the 50% to 80% of training; and setting the weight of the basic IoU regression term to 1.0, the weight of the SIL penalty term to 0.1, and the weight of the Inner-IoU term to 0.5 during the last 20% of training; the total regression loss after dynamic scheduling is shown below; ; Where w_iou(t), w_sil(t), and w_inner(t) are dynamic weights that change with the number of training steps, and r is the dynamic focusing coefficient generated by the momentum smoothing focusing mechanism.
8. The UAV small target detection method based on dynamic loss scheduling as described in claim 1, characterized in that, Step S7 includes: performing float() to increase the calculated width, height, and center point coordinates of the predicted and ground truth bounding boxes to 32-bit floating-point precision; applying a lower bound (clamp(min=1×10^-4)) to the width and height quantities involved in the division operation; applying an upper bound (clamp(max=5.0)) to the exponent calculation result in the SIL penalty term; and using the above numerical stability pipeline to avoid underflow, division by zero, and non-numerical anomalies caused by the excessively small squares of the width and height of small targets under half-precision training.
9. A method for detecting small targets in a UAV based on dynamic loss scheduling as described in claim 6 or 7, characterized in that, The dynamic focusing coefficient is generated by the ratio of the current batch IoU loss to the historical average IoU, as shown below; ; Among them, delta is a stable term to prevent the denominator from being zero. The bounding box loss module is integrated into the BboxLoss or equivalent bounding box regression loss module of the object detection framework. The historical mean cache variable and training step count variable are registered inside the module, so that the loss scheduling and momentum smoothing process are automatically executed during training.