Multi-Modal UAV Detection, Classification and Tracking Algorithm -- Technical Report for CVPR 2024 UG2 Challenge
Table of Contents
Our method has been tested on python 3.10, CUDA>=11.6. The simplest way to install all dependences is to use anaconda and pip in the following steps:
conda create -n MMUAV python=3.10
conda activate MMUAV
conda install -c "nvidia/label/cuda-11.6.0" cuda-toolkit
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.6 -c pytorch -c conda-forge
pip install -r requirements.txtInstall Yolov9 Dependency
> pip install yolov9/requirements.txtAnd download pretrained weight of Yolov9 under ./yolov9.
Then Prepare the dataset utilizing the zero-shot UAV detection by Yolov9
> python3 yolov9/detect.py --source $SOURCE --img 640 --device 0 --weights './yolov9-e.pt' --name $OUTPUT --num_kf 5 --kf_int 50 --save-cropReplace $SOURCE and $OUTPUT to the source and desired output directories of the target trajectory. num_kf is the maximum number of keyframe selected from the trajectory. kf_int is the interval threshold between each keyframe to prevent selecting similar keyframes. save-crop will save the cropped image for detected drones, necessary for the training of efficientnet.
This section introduces Python scripts for processing LiDAR point cloud data, tracking objects, and visualizing trajectories. The pipeline consists of three main stages: preprocessing, fusion tracking, and postprocessing. Each stage is executed via a separate script with configurable command-line arguments.
- Python 3.x: Ensure Python is installed on your system.
- Required Libraries: Install the necessary dependencies by running:
pip install numpy sklearn torch matplotlib scipy stonesoup
- Custom Modules: The scripts rely on additional modules (
dataset_loader.py,extract_feature.py,lidar_360_detector.py). Ensure these are available in your project directory. - Input Data: LiDAR data should be organized in
.npyfiles within the specified dataset folder.
- Input Data: Place your LiDAR data in a folder (e.g.,
C:\Users\Yi\Desktop\val) with subfolders for sequences (e.g.,seq1). - Output Folders: Results and figures will be saved to specified directories (e.g.,
C:\Users\Yi\Desktop\result,C:\Users\Yi\Desktop\figure).
This script processes raw LiDAR data from Livox Avia and 360-degree LiDAR sensors, performs clustering, and fuses the results.
python .\point_cloud_processing\tracker\preprocess.py --dataset_folder "C:\Users\Yi\Desktop\val"- Purpose: Reads LiDAR data, downsamples it (if necessary), applies clustering (DBSCAN), and uses an LSTM model for detection. The processed data is saved in subfolders (
livox_avia_processed,lidar_360_processed,lidar_fusion). - Arguments:
--dataset_folder: Path to the folder containing sequence subfolders (default:C:\Users\Yi\Desktop\val).--model_path: (Optional) Path to the LSTM model file. Defaults tolstm_model.pthin the script directory if not specified.
- Output: Processed
.npyfiles in the sequence subfolders.
- Ensure the dataset folder contains subfolders with
livox_aviaandlidar_360directories. - The script skips non-directory entries and creates output folders as needed.
This script performs object tracking on the fused LiDAR data using a Kalman filter-based tracker from the Stone Soup library.
python .\point_cloud_processing\tracker\fusion_tracking.py --dataset_folder "C:\Users\Yi\Desktop\val" --result_folder "C:\Users\Yi\Desktop\result" --sequence "seq1"- Purpose: Clusters the fused point cloud data (using DBSCAN), tracks objects over time with an Extended Kalman Filter, and saves the tracked states.
- Arguments:
--dataset_folder: Path to the folder containing the preprocessed data (e.g.,C:\Users\Yi\Desktop\val).--result_folder: Path to save the tracking results (e.g.,C:\Users\Yi\Desktop\result).--sequence: Specific sequence to process (e.g.,seq1). If omitted, all sequences in the dataset folder are processed.--eps: DBSCAN epsilon parameter (default:1.0).--min_samples: DBSCAN minimum samples (default:1).--noise_covar: Measurement noise covariance (default:0.001).--missed_distance: Distance threshold for missed detections (default:3.0).--covar_trace_thresh: Covariance threshold for track deletion (default:30.0).--min_points: Minimum points for track initiation (default:1).
- Output:
.npyfiles containing tracked object positions in the result folder (e.g.,C:\Users\Yi\Desktop\result\seq1).
- The script processes the
lidar_fusionsubfolder from the preprocessing step. - Adjust tunable parameters (e.g.,
--eps,--missed_distance) based on your data characteristics.
This script interpolates tracked trajectories and generates visualizations of positions and velocities.
python .\point_cloud_processing\tracker\postprocess.py --dataset_folder "C:\Users\Yi\Desktop\result" --figure_folder "C:\Users\Yi\Desktop\figure" --seq_folder "seq1" --spline_smoothing 0.7- Purpose: Loads tracked data, interpolates trajectories using spline interpolation, and plots the results (positions and velocities) in a figure.
- Arguments:
--dataset_folder: Path to the folder containing tracking results (e.g.,C:\Users\Yi\Desktop\result).--figure_folder: Path to save the output figures (e.g.,C:\Users\Yi\Desktop\figure).--seq_folder: Sequence folder name to process (e.g.,seq1).--spline_smoothing: Smoothing factor for spline interpolation (default:0.5, example:0.7).
- Output: A
.pngfile (e.g.,seq1.png) in the figure folder, showing X/Y/Z positions and velocities.
- The script uses the tracking results from the previous step.
- Adjust
--spline_smoothingto control the smoothness of the interpolated trajectory.
To process a single sequence (seq1) from start to finish:
- Preprocess:
python .\point_cloud_processing\tracker\preprocess.py --dataset_folder "C:\Users\Yi\Desktop\val"
- Track:
python .\point_cloud_processing\tracker\fusion_tracking.py --dataset_folder "C:\Users\Yi\Desktop\val" --result_folder "C:\Users\Yi\Desktop\result" --sequence "seq1"
- Postprocess:
python .\point_cloud_processing\tracker\postprocess.py --dataset_folder "C:\Users\Yi\Desktop\result" --figure_folder "C:\Users\Yi\Desktop\figure" --seq_folder "seq1" --spline_smoothing 0.7