This repository provides the official implementation of MemLoTrack, a memory-augmented LoRA-based tracker.
-
Based on the LoRAT codebase: https://github.com/LitingLin/LoRAT
We sincerely thank the LoRAT authors for making their excellent codebase publicly available. -
Paper: MemLoTrack (MDPI Sensors): https://www.mdpi.com/1424-8220/25/23/7359
 : https://drive.google.com/drive/folders/1cr2yX1UagM48qIuWzvYUSfl2V1CUZuAK?usp=sharing
-
antiuav410_retrained_weight.bin: We first pretrained the tracker on standard SOT benchmark datasets (e.g., LaSOT, TrackingNet, COCO 2017), and then fine-tuned it on Anti-UAV410. -
antiuav410_scratch_weight.bin: Model trained from scratch on the Anti-UAV410 dataset
Assuming you are working on a python environment with pip installed. We recommend running this in a virtual environment.
apt update
apt install -y libturbojpegPyTorch version should be >= 2.0.
pip install torch torchvisionpip install -r requirements.txt- Anti-UAV410 (project page): https://github.com/HwangBo94/Anti-UAV410
- Anti-UAV410 (download link): https://drive.google.com/file/d/1zsdazmKS3mHaEZWS2BnqbYHPEcIaH5WR/view
The organized directory should look like as follow :
--AntiUAV410/
|--test
|--train
|--val
Copy consts.template.yaml as consts.yaml and fill in the path.
Anti_UAV_410_PATH: '/path/to/antiuav410'Register an account at wandb, then login with the command:
wandb loginNote: Our code performs evaluation automatically when model training is completed.
- Model weight is saved in
/path/to/output/run_id/checkpoint/epoch_{last}/model.safetensors. - Performance metrics can be found on terminal output and wandb dashboard.
- Tracking results are saved in
/path/to/output/run_id/eval/epoch_{last}/.
To modify training configurations such as total epochs and other detailed hyperparameters, please edit the following file: config/MemLoTrack/run.yaml
The following command executes training and evaluation for the datasets defined in config/_dataset/train.yaml and config/_dataset/test.yaml.
# Train and evaluate MemLoTrack model on all GPUs
./run.sh MemLoTrack dinov2 --output_dir /path/to/output./run.sh MemLoTrack dinov2 --output_dir /path/to/output --device_ids 0,1,2,3You can set the default settings, e.g. output_dir, in run.sh.
To train or evaluate specifically on the Anti-UAV 410 Dataset, use the following --mixin flags:
-
For Train & Evaluation: Add
--mixin anti_uav_train --mixin anti_uav_test -
For Evaluation Only: Add
--mixin anti_uav_test --mixin evaluation
# Train and evaluate MemLoTrack model on all GPUs
./run.sh MemLoTrack dinov2 --mixin anti_uav_train --mixin anti_uav_test --output_dir /path/to/output# Only evaluate MemLoTrack model on all GPUs
./run.sh MemLoTrack dinov2 --mixin anti_uav_test --mixin evaluation --output_dir /path/to/output --weight_path /path/to/weightNote: If you encounter any issues with torch.compile, disable is with --mixin disable_torch_compile.
Note: You can disable wandb logging with --disable_wandb.
You can run evaluation only with the following command:
# evaluation only, defined in config/_dataset/test.yaml
./run.sh MemLoTrack dinov2 --output_dir /path/to/output --mixin evaluation --weight_path /path/to/weight.bin# evaluation only, defined in config/MemLoTrack/_mixin/anti_uav_test.yaml
./run.sh MemLoTrack dinov2 --output_dir /path/to/output --mixin evaluation --mixin anti_uav_test --weight_path /path/to/weight.binThe evaluated datasets are defined in config/MemLoTrack/_mixin/anti_uav_test.yaml.
Results are saved in /path/to/output/run_id/eval/epoch_{last}/, where run_id is the current run ID, and epoch_{last} is the last epoch.
The bundled evaluation code is based on the official Anti-UAV410 repository.
trackit/datasets/SOT/datasets/Anti_UAV_410.py accepts an evaluation_mode seed parameter:
standard(default): keeps valid target-present frames for the existing AUC, precision, and normalized-precision workflow.state_accuracy: keeps every frame in its original order and marks target-absent frames withvalidity=False. This is required for SA evaluation.
Select the mode in a dataset configuration; no source-code commenting or uncommenting is required:
- name: "Anti_UAV_410"
type: "SOT"
splits: "test"
parameters:
evaluation_mode: "state_accuracy"The provided config/MemLoTrack/_mixin/anti_uav_test.yaml already enables this mode. Its SA evaluation source intentionally avoids filters that remove invalid or empty annotations, because those filters would delete target-absent frames and break frame alignment.
./run.sh MemLoTrack dinov2 \
--output_dir /path/to/output \
--mixin evaluation \
--mixin anti_uav_test \
--weight_path /path/to/weight.binThe result archive is written below /path/to/output/<run_id>/eval/epoch_<last>/. Extract results.zip; it contains a tracker directory with one <sequence-name>.txt file per Anti-UAV410 sequence. SA mode preserves the official sequence names, so no prefix-removal or file-renaming step is needed.
From the repository root, run:
python Anti-UAV410/Evaluation_for_SA.py \
--dataset-path /path/to/Anti-UAV410 \
--pred-path /path/to/extracted-results/<tracker-directory> \
--split test \
--mode 1 \
--output /path/to/eval_details.txt--mode 1 means XYWH predictions (the format produced by results.zip); use --mode 2 for XYXY input. The evaluator requires the prediction and ground-truth frame counts to match. In text results, a box with non-positive width or height, including 0 0 0 0, represents a target-absent prediction. For Anti-UAV410 SA-mode exports, annotated target-absent positions are encoded as 0 0 0 0; a prediction/existence length mismatch raises an error instead of being silently truncated or padded.
For the official multi-tracker plots and PDF report, configure dataset_path, result_dir, and tracker paths in Anti-UAV410/Evaluation_for_paper_work.py and Anti-UAV410/utils/trackers.py, then run that script from the Anti-UAV410 directory.
This page describes how to create a custom dataset for training and evaluation.
Add --mixin resumable to the command line to enable resumable checkpointing. This allows you to resume training from the last saved checkpoint if the training process is interrupted.
./run.sh MemLoTrack dinov2 --output_dir /path/to/output --mixin resumableOr you can set the default value in run.yaml to:
checkpoint:
- type: "regular"
epoch_trigger:
interval: 10
last: true
resumable: true # false --> true
max_to_keep: 5Now the training process will save checkpoints every 10 epochs, and the last checkpoint will be saved as recovery.yaml in the checkpoint directory.
Load the last checkpoint by specifying the --resume argument:
./run.sh MemLoTrack dinov2 --output_dir /path/to/output --mixin resumable --resume /path/to/output/run_id/checkpoint/recovery.yaml@article{park2025memlotrack, title={MemLoTrack: Enhancing TIR Anti-UAV Tracking with Memory-Integrated Low-Rank Adaptation}, author={Park, Jae Kwan and Han, Ji-Hyeong}, journal={Sensors}, volume={25}, number={23}, pages={7359}, year={2025}, publisher={MDPI} }

