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.
2026.06.25🔥🔥🔥 Full code of Selfment has been released! Hope you enjoy it!2026.06.18🔥🔥🔥 Selfment has been accepted by ECCV 2026!
- Release paper
- DINOv3 PatchHead
- Inference code
- Multi-GPU eval code
- Multi-GPU training code
- 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 thedatasetsfolder. - Install dependencies by:
pip install -r requirements.txtpython 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_outputsSingle-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 1000Run 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 noneAnd compute metrics:
python eval.py \
--pred_dir /path/to/pred_masks \
--gt_dir /path/to/gt_masksIf 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}
}Selfment is built upon TokenCut and DINOv3. We express our gratitude to the authors for their remarkable work.