RefOnce: Distilling References into a Prototype Memory for Referring Camouflaged Object Detection
- Python 3.8+
- PyTorch and TorchVision
- Other deps: timm==0.4.12, py_sod_metrics==1.2.4, opencv-python, pillow, tqdm
Install example (choose a proper CUDA or CPU wheel as needed):
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
pip install timm==0.4.12 py_sod_metrics==1.2.4 opencv-python pillow tqdm- Dataset root should contain the following structure (R2C7K example, at least test set should exist):
dataset/
R2C7K/
Camo/
test/
Imgs/<Class>/<name>.jpg|.png
GT/<Class>/<name>.png
Ref/ # keep original structure if present; not strictly required for inference
-
Weights: place the checkpoint (e.g., RefOnce.pth) anywhere and pass it via --checkpoint.
-
Entry points and useful references:
- Shell runner: test.sh
- Python entry: test.py
- Model: RefOnce.init(), RefOnce.test_forward()
Shell script (recommended):
bash test.sh 0 # optional GPU index, default 0;The script calls test.py with defaults:
- data-root: ./dataset/R2C7K
- checkpoint: RefOnce.pth
- batch-size: 22
- save-dir: ./output/release/
- save-preds: False (metrics only)
Notes:
- By default, predictions are not saved; enable with --save-preds True and provide --save-dir.
- Metrics are reported by CalTotalMetric.get_results() and include Smeasure, wFmeasure, MAE, adpEm, meanEm, maxEm, adpFm, meanFm, maxFm.
If this release helps your research, please cite it. Example BibTeX (replace with your official paper info):
@article{wu2025refonce,
title={RefOnce: Distilling References into a Prototype Memory for Referring Camouflaged Object Detection},
author={Wu, Yu-Huan and Zhu, Zi-Xuan and Wang, Yan and Zhen, Liangli and Fan, Deng-Ping},
journal={arXiv preprint arXiv:2511.20989},
year={2025}
}This project is based on ZoomNet, RefCOD, and PySODMetrics. Thanks to the authors for their open-source contributions.