PaddleDetection for Small-Object UAV Detection & Tracking: Complete Implementation Guide (2026)

Key Takeaways: This guide builds a complete small-object UAV detection and tracking pipeline on PaddleDetection’s native capabilities—from PP-YOLOE-SOD detection output to stable tracking and precise aiming. It’s specifically optimized for distant small-target drone scenarios. The core logic: detection guarantees small-target recall, tracking guarantees ID continuity, post-processing eliminates aiming jitter, and motion prediction compensates system latency. At Aomway, we apply exactly these principles when developing aerial perception systems.

1. Overall Technical Pipeline and Solution Selection

1.1 End-to-End Architecture

Video Capture → PP-YOLOE-SOD Detection → Multi-Object Tracker (OC-SORT/ByteTrack) → Single-Target Lock & Trajectory Smoothing → Motion Prediction & Aiming Calculation → Gimbal/Actuator Control

1.2 Tracker Algorithm Selection (for Distant Small-Object UAVs)

Small targets are characterized by tiny pixel footprint, extremely weak appearance features, fluctuating detection confidence, and high motion speed. Comparison of three mainstream approaches:

Algorithm Core Principle Small-Target Fit Inference Speed Recommendation Key Advantages
OC-SORT SDE decoupled mode: observation + Kalman filter + motion consistency matching Excellent Fast ★★★★★ Fewest ID switches under high-speed motion and brief occlusion; relies on motion features rather than appearance features
ByteTrack SDE decoupled mode: two-stage matching of high/low score detection boxes Good Very fast ★★★★☆ Fully utilizes low-confidence small-target boxes; extremely lightweight; highest frame rate
DeepSORT SDE decoupled mode: ReID appearance features + cascade matching Poor Slow ★☆☆☆☆ Small targets lack usable appearance features; ReID completely fails and adds latency

Conclusion: choose OC-SORT first—natively supported by PaddleDetection 2.9, with far better tracking continuity for fast-maneuvering small targets than other options. If maximum frame rate is the priority, ByteTrack is an option. DeepSORT is not recommended—distant UAVs have almost no distinguishable appearance features, making the ReID module pure redundancy.

2. PaddleDetection Native Tracking Integration Steps

2.1 Export the PP-YOLOE-SOD Inference Model

Export trained weights to standard inference format for direct use by the tracking module:

python tools/export_model.py \
    -c configs/smalldet/ppyoloe_crn_s_36e_640_sod_coco.yml \
    -o weights=output/ppyoloe_sod_uav/best_model.pdparams \
    --output_dir=output_inference

After export, the output_inference/ directory contains model.pdmodel, model.pdiparams, and other inference files.

2.2 Write a Tracking Config Adapted for Small Targets

Create a dedicated config under configs/mot/ocsort/, replace the detector, and optimize tracking parameters:

# configs/mot/ocsort/ocsort_ppyoloe_sod_uav.yml
_BASE_: [
  '../../datasets/mot.yml',
  '../../runtime.yml',
  '../_base_/optimizer_30e.yml',
  '../_base_/ocsort_reader.yml',
]

# Detector config: replace with your PP-YOLOE-SOD model
detector:
  name: YOLODetector
  model_dir: output_inference/ppyoloe_crn_s_36e_640_sod_coco
  device: GPU
  threshold: 0.2        # lower detection threshold for small targets to guarantee recall
  nms_threshold: 0.4    # lower NMS threshold to avoid merging dense small targets

# OC-SORT tracker (specifically optimized for UAV small targets)
tracker:
  type: OCSORTTracker
  det_thresh: 0.2       # detection confidence gate matching small-target low scores
  max_age: 60           # keep track for 60 frames after loss (~2s @30fps) for brief occlusion
  min_hits: 2           # generate track after 2 consecutive hits for fast-appearing targets
  iou_threshold: 0.3    # lower IoU match threshold—small target boxes are naturally small
  delta_t: 2            # Kalman prediction step for high-speed maneuvers
  inertia: 0.2          # motion inertia coefficient retaining motion trend
  min_box_area: 20      # filter noise boxes with pixel area < 20

2.3 Run Tracking Inference

Offline video tracking

python tools/mot/mot_infer.py \
    -c configs/mot/ocsort/ocsort_ppyoloe_sod_uav.yml \
    --video_file=test_uav.mp4 \
    --output_dir=output_track \
    --save_mot_txts

Output includes an ID-annotated visualization video plus per-frame result text in the format frame_no,ID,x1,y1,w,h,confidence,-1,-1,-1—directly usable for aiming calculation.

Real-time camera stream tracking

python tools/mot/mot_infer.py \
    -c configs/mot/ocsort/ocsort_ppyoloe_sod_uav.yml \
    --camera_id=0 \
    --output_dir=output_track

3. Specialized Optimization for Distant Small-Object UAV Tracking

3.1 Detection-Side Collaborative Optimization (Foundation of Tracking Performance)

Tracking’s ceiling is set by detection. Small-target scenarios require adjusted inference parameters that cooperate with the tracker:

  1. Low threshold + high resolution combo: lower detection threshold to 0.15–0.25, keep inference resolution consistent with training (1024×1024 or higher); never reduce resolution for speed.
  2. Sliding-window inference is a must: if training used large-image tiling, inference must enable sliding window too, otherwise distant small targets in large images will be missed entirely.
# Sliding window + tracking integrated inference
python deploy/python/slide_infer.py \
  --model_dir=output_inference/ppyoloe_sod_uav \
  --video_file=test.mp4 \
  --slide_size=1024 \
  --overlap_ratio=0.3 \
  --tracker=ocsort \
  --track_thresh=0.2
  1. Filter invalid detections: add size and aspect-ratio rules to filter false-positive boxes that clearly don’t match UAV shape, reducing tracker load.

3.2 Deep Tracker Parameter Tuning

Core principle: weaken appearance dependence, strengthen motion model, relax matching conditions, extend survival time.

Parameter Generic Default UAV-Optimized Rationale
det_thresh 0.5 0.2 Recall more low-confidence small targets; temporal consistency filters false positives
max_age 30 60 Don’t destroy tracks immediately during brief occlusion/frame drops
min_hits 3 2 Rapidly capture fast-intruding targets
iou_threshold 0.5 0.3 Small target boxes have naturally low IoU; relax match threshold
min_box_area 100 20 Keep very distant targets with tiny pixel areas

3.3 Trajectory Smoothing and Motion Model Optimization

1. Kalman filter parameter adaptation
Small-target detection is noisy—adjust Kalman noise weights to reduce single-frame detection jitter impact:

tracker:
  type: OCSORTTracker
  process_noise_scale: 0.05    # process noise coefficient, controls prediction confidence
  measurement_noise_scale: 2.0 # measurement noise; raising it reduces single-frame detection weight

2. EMA secondary smoothing (mandatory for aiming)
Tracker output coordinates still jitter frame-to-frame; you must apply exponential moving average smoothing before aiming. This is the key to eliminating aiming-point drift:

class EMASmoother:
    def __init__(self, alpha=0.3):
        self.alpha = alpha  # smoothing factor: smaller = smoother but higher latency
        self.smoothed_x = None
        self.smoothed_y = None

    def update(self, x, y):
        if self.smoothed_x is None:
            self.smoothed_x, self.smoothed_y = x, y
        else:
            self.smoothed_x = self.alpha * x + (1 - self.alpha) * self.smoothed_x
            self.smoothed_y = self.alpha * y + (1 - self.alpha) * self.smoothed_y
        return self.smoothed_x, self.smoothed_y

Recommended alpha: 0.2–0.4, balancing smoothness and response speed.

3.4 ROI-Focused Tracking (Advanced Technique: Speed + Accuracy Boost)

After a target is stably tracked for 10 consecutive frames, stop full-frame detection and crop a local ROI around the target for detection instead:

  • Benefits: small target’s share in ROI rises 3–5×, signal-to-noise ratio improves significantly, detection accuracy rises; inference region shrinks, speed improves 2–4×; background interference excluded, false positives plummet.
  • Implementation logic: a. tracker outputs target center coordinates; b. crop an ROI centered on the target with 4× target box width/height; c. run detection only on the ROI next frame; d. map ROI detection coordinates back to the full image and update the tracker.
  • Failure protection: if no target is detected in the ROI for 3 consecutive frames, automatically fall back to full-frame detection to recover a lost target.

4. Core Aiming System Implementation

4.1 Aim Point Calculation

  1. Basic aim point: geometric center of the target detection box
aim_x = (x1 + x2) / 2
aim_y = (y1 + y2) / 2
  1. Advanced aim point: for UAV shape, aim at the fuselage center of gravity. Without keypoint annotations, take the box center offset 10% upward (drone nose usually points up).

4.2 Motion Lead Prediction (Compensating System Latency)

Vision systems have inherent latency (capture + inference + transmission + gimbal response, totaling ~50–200ms). A high-speed UAV moves noticeably within that delay window, so lead prediction is required.

Option 1: Constant-velocity linear prediction (simple and reliable—first choice)

Compute target velocity from history, multiply by total system delay, output predicted aim point:

class MotionPredictor:
    def __init__(self, system_delay_ms=100, history_len=5):
        self.delay_s = system_delay_ms / 1000.0
        self.history = []
        self.history_len = history_len

    def update(self, x, y, timestamp):
        self.history.append((x, y, timestamp))
        if len(self.history) > self.history_len:
            self.history.pop(0)

        if len(self.history) < 2:
            return x, y

        x0, y0, t0 = self.history[0]
        x1, y1, t1 = self.history[-1]
        dt = t1 - t0
        if dt <= 0:
            return x, y

        vx = (x1 - x0) / dt
        vy = (y1 - y0) / dt

        # predict target position at the delayed moment
        pred_x = x1 + vx * self.delay_s
        pred_y = y1 + vy * self.delay_s
        return pred_x, pred_y
  • system_delay_ms must be calibrated to your actual system—start from 50ms and tune incrementally.
  • Works for constant-velocity cruising; error grows slightly during maneuvers.

Option 2: Kalman state prediction (more accurate)

Directly reuse the tracker’s internal Kalman filter state with zero extra computation and higher accuracy:

# Extract Kalman prediction for a specific ID from the OC-SORT tracker
track = tracker.trackers[target_id]
pred_state = track.kf.predict()
pred_x, pred_y = pred_state[0][0], pred_state[1][0]

4.3 Single-Target Lock Logic

In multi-target scenarios, implement a stable lock mechanism to avoid frequent target switching:

  1. Initial lock: prefer the target closest to frame center, confidence > 0.3, and size within UAV range.
  2. Lock retention: as long as the locked target’s ID exists, it keeps top priority—no switching even if a closer target appears.
  3. Loss re-acquisition: after the locked target is lost beyond max_age frames, release the lock and re-select the optimal target.

4.4 Gimbal Control Closed Loop (Real-World Deployment)

Aiming output must convert to gimbal control commands—the core is pixel-to-angle conversion and closed-loop control:

  1. Angular resolution calibration: via camera intrinsics or practical calibration, determine degrees-per-pixel for horizontal/vertical.
  2. PID closed-loop control: feed target-vs-frame-center error into a PID controller to output gimbal speed:
# Simplified PID control logic
error_x = aim_x - frame_width / 2
error_y = aim_y - frame_height / 2

# dead zone: no output for errors under 5 pixels to avoid gimbal jitter
if abs(error_x) < 5: error_x = 0
if abs(error_y) < 5: error_y = 0

pwm_x = Kp * error_x + Ki * integral_x + Kd * (error_x - last_error_x)
pwm_y = Kp * error_y + Ki * integral_y + Kd * (error_y - last_error_y)
  1. Parameter tuning: tune P first for response, add D to suppress oscillation, then I to eliminate steady-state error.

5. Engineering Deployment and Performance Reference

5.1 RTX PRO 5000 Performance Reference

Solution Input Resolution Inference Mode Frame Rate End-to-End Latency
PP-YOLOE-SOD-S + OC-SORT 1024×1024 FP32 ~85 FPS ~12ms
PP-YOLOE-SOD-S + OC-SORT 1024×1024 TensorRT FP16 ~160 FPS ~6ms
PP-YOLOE-SOD-S + OC-SORT + ROI 1024×1024 FP16 ~300+ FPS ~3ms

5.2 Deployment Optimization Tips

  1. TensorRT acceleration: export ONNX then convert to TensorRT FP16—nearly 2× speedup with negligible accuracy loss.
  2. Multi-threaded pipeline: run capture, inference, tracking, and control in parallel threads with queue-based data passing to further reduce end-to-end latency.
  3. Edge porting: for embedded deployment, convert the model to RKNN format for RK3588; rewrite the tracker in C++. At 1024 resolution, 15–20 FPS is achievable.

6. Common Problem Troubleshooting

  1. Frequent target loss / many ID switches: first lower detection threshold, raise inference resolution, enable sliding window, increase max_age.
  2. Violent aim-point jitter: add EMA smoothing, increase Kalman measurement noise coefficient, reduce smoothing factor alpha.
  3. False tracking of birds / cloud interference: raise min_hits, add target size/aspect-ratio filtering, add negative samples to detection training, enable ROI focusing.
  4. Can’t keep up with high-speed maneuvering targets: increase prediction delay, lower IoU match threshold, reduce Kalman process noise.

If you have any questions about this topic, feel free to contact us at [email protected]

Have questions about this article? Feel free to contact us at [email protected] — we’re happy to help!

Frequently Asked Questions

Q1: Why is OC-SORT recommended over DeepSORT for small UAV targets?
Distant UAVs occupy tiny pixel areas with almost no distinguishable appearance features—DeepSORT’s ReID appearance module fails completely and adds latency. OC-SORT relies on motion features (observation-centric update with Kalman filtering and motion consistency matching), making it far more robust for fast-maneuvering small targets, and it’s natively supported by PaddleDetection 2.9.

Q2: What are the key tracker parameters for small-target UAV tracking?
The core settings: det_thresh 0.2 (recall more low-confidence targets), max_age 60 (~2 seconds retention for brief occlusion), min_hits 2 (fast track creation), iou_threshold 0.3 (small boxes have naturally low IoU), and min_box_area 20 (keep tiny distant targets). Principle: weaken appearance, strengthen motion, relax matching, extend survival.

Q3: How do I reduce aim-point jitter?
Three fixes: (1) add an EMA smoother with alpha 0.2–0.4 before aiming; (2) increase Kalman measurement_noise_scale (e.g., 2.0) to down-weight noisy single-frame detections; (3) add a PID dead zone (e.g., 5 pixels) so small errors don’t cause gimbal oscillation.

Q4: What performance can I expect on an RTX PRO 5000?
PP-YOLOE-SOD-S + OC-SORT at 1024×1024: ~85 FPS in FP32 (~12ms end-to-end), ~160 FPS with TensorRT FP16 (~6ms), and 300+ FPS with ROI-focused tracking in FP16 (~3ms). For embedded platforms, RKNN conversion on RK3588 achieves 15–20 FPS at 1024 resolution.

Q5: Why must sliding-window inference be enabled?
If your PP-YOLOE-SOD model was trained with large-image tiling, inference must use the matching sliding-window mode. Otherwise distant small targets in full-resolution frames are missed entirely, collapsing detection recall and breaking tracking continuity.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top