Skip to content

geshang777/Selfment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning Accurate Segmentation Purely from Self-Supervision

output_2.mp4

Introducing Selfment, a fully self-supervised framework that segments foreground objects directly from raw images without human labels, pretrained segmentation models, or any post-processing.


News

  • 2026.06.25 🔥🔥🔥 Full code of Selfment has been released! Hope you enjoy it!
  • 2026.06.18 🔥🔥🔥 Selfment has been accepted by ECCV 2026!

TODOs

  • Release paper
  • DINOv3 PatchHead
  • Inference code
  • Multi-GPU eval code
  • Multi-GPU training code

Environment Setup

  • We use python 3.11/CUDA 12.4/torch 2.9.1 for implementation.
  • We train our models on 8 NVIDIA A100 GPUs with 80G memory, please make sure that your VRAM is sufficient to avoid the potential OOM issues during training.
  • Download the DINOv3-7B and the PatchHead into the ckpt, and download the required datasets (COD10K, CAMO, DUTS, DUT-OMRON, HKU-IS, ECSSD) into the datasets folder.
  • Install dependencies by:
pip install -r requirements.txt

Quick Start

python demo/demo.py \
  --image demo/camouflaged.jpg \
  --head_ckpt /path/to/checkpoint_epoch3.pth \
  --dino_type dinov3 \
  --dino_repo ./dino/dinov3 \
  --dino_model_name dinov3_vit7b16 \
  --dino_weights /path/to/dinov3-weights.pth \
  --dino_depth 40 \
  --postprocess none \
  --output_dir ./demo_outputs

Training

Single-node multi-GPU training with torchrun:

torchrun --standalone --nproc_per_node=8 --master_port=29511 train.py \
  --input_dir datasets/DUTS/DUTS-TR/DUTS-TR-Image \
  --output_dir ./selfment_train \
  --cache_dir ./feature_cache \
  --dino_type dinov3 \
  --dino_repo ./dino/dinov3 \
  --dino_model_name dinov3_vit7b16 \
  --dino_weights /path/to/dinov3-weights.pth \
  --dino_depth 40 \
  --img_size 768 \
  --epochs 3 \
  --lr 1e-3 \
  --embed_dim 128 \
  --max_images 1000

Evaluation

Run evaluation:

python inference.py \
  --head_ckpt /path/to/checkpoint_epoch3.pth \
  --input_dir /path/to/images \
  --output_dir ./inference_results \
  --cache_dir ./feature_cache \
  --dino_type dinov3 \
  --dino_repo ./dino/dinov3 \
  --dino_model_name dinov3_vit7b16 \
  --dino_weights /path/to/dinov3-weights.pth \
  --dino_depth 40 \
  --postprocess none

And compute metrics:

python eval.py \
  --pred_dir /path/to/pred_masks \
  --gt_dir /path/to/gt_masks

Citation

If you find our work helpful, please cite:

@article{you2026learning,
  title={Learning Accurate Segmentation Purely from Self-Supervision},
  author={You, Zuyao and Wu, Zuxuan and Jiang, Yu-Gang},
  journal={ECCV},
  year={2026}
}

Acknowledgements

Selfment is built upon TokenCut and DINOv3. We express our gratitude to the authors for their remarkable work.

About

[ECCV 2026] Official Implementation of "Learning Accurate Segmentation Purely from Self-Supervision"

Resources

Stars

13 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors