Skip to content

[CVPR 2025] Fine-Grained Image-Text Correspondence with Cost Aggregation for Open-Vocabulary Part Segmentation

License

Notifications You must be signed in to change notification settings

kaist-cvml/part-catseg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fine-Grained Image-Text Correspondence with
Cost Aggregation for Open-Vocabulary Part Segmentation

Jiho Choi1 *, Seonho Lee1 *, Seungho Lee2, Minhyun Lee2, Hyunjung Shim1
(* indicates equal contributions)
1Graduate School of Artificial Intelligence, KAIST, Republic of Korea
2School of Integrated Technology, Yonsei University, Republic of Korea
{jihochoi, glanceyes, kateshim}@kaist.ac.kr, {seungholee, lmh315}@yonsei.ac.kr

arXiv CVPR

drawing


PartCATSeg

PartCATSeg is a novel framework to address the critical challenges of OVPS(Open-Vocabulary Part Segmentation) and significantly improve model performance by leveraging the cost volume.

drawing

Updates

  • [2025.04.15] πŸ‘¨β€πŸ’» The official codes have been released!
  • [2025.02.26] πŸŽ‰ Our paper has been accepted to CVPR 2025!
  • [2025.01.16] πŸ“„ Our paper is now available! You can find the paper here.

Installation

# ------------------
#     Init conda
# ------------------
conda create --name partcatseg python=3.8 -y
conda activate partcatseg
pip install --upgrade pip
conda install cuda=12.4.1 -c nvidia -y
pip install torch==2.2.2 torchvision==0.17.2 --index-url https://download.pytorch.org/whl/cu121
pip install timm==0.9.1
pip install scikit-image==0.21.0
pip install scikit-learn==0.24.2
pip install opencv-python==4.5.5.64
pip install hydra-core==1.3.2
pip install openmim==0.3.6
pip install mmsegmentation==0.29.1
pip install tokenizers==0.11.1
pip install Pillow~=9.5
pip install numpy==1.23.0
pip install einops ftfy regex fire ninja psutil gdown

# --------------------------
#     Install Detectron2
# --------------------------
pip install 'git+https://github.com/facebookresearch/detectron2.git'
python -c "import detectron2; print(detectron2.__version__)"  # 0.6

# --------------------------
#     Install mmcv
# --------------------------
# pip install mmcv-full==1.7.1
# => if an error occurs
pip install mmcv-full==1.7.1 -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html
python -c "import mmcv; print(mmcv.__version__)"  # 1.7.1

Prepare Datasets

cd datasets

PascalPart116

  • You can find further information in the OV-PARTS GitHub repository.
gdown https://drive.google.com/uc?id=1QF0BglrcC0teKqx15vP8qJNakGgCWaEH
tar -xzf PascalPart116.tar.gz
find datasets/PascalPart116/images/val/ -name '._*' -delete
find datasets/PascalPart116/ -name '._*' -delete

ADE20KPart234

gdown https://drive.google.com/uc?id=1EBVPW_tqzBOQ_DC6yLcouyxR7WrctRKi
tar -xzf ADE20KPart234.tar.gz

PartImageNet (Seg)

  • Download the LOC_synset_mapping.txt file from this link and place it in the datasets folder.
  • Download PartImageNet_Seg from PartImageNet and extract it into the datasets folder.

PartImageNet (OOD)

  • TBA

Preprocess Datasets

  • PascalPart116
  • ADE20KPart234
  • PartImageNet (Seg)
  • PartImageNet (OOD) - TBA
# PascalPart116
python baselines/data/datasets/mask_cls_collect.py \
    datasets/PascalPart116/annotations_detectron2_part/val \
    datasets/PascalPart116/annotations_detectron2_part/val_part_label_count.json

python baselines/data/datasets/mask_cls_collect.py \
    datasets/PascalPart116/annotations_detectron2_obj/val \
    datasets/PascalPart116/annotations_detectron2_part/val_obj_label_count.json

# ADE20KPart234
# (no preprocessing required)

# PartImageNet (Seg)
cd datasets
python partimagenet_preprocess.py --data_dir PartImageNet
# Make sure to have LOC_synset_mapping.txt in the datasets folder mentioned above.

# PartImageNet (OOD)
# TBA

Pre-trained Weights

Please first donwload the pre-trained CAT-Seg weight model_final_base.pth from the following link to use them in the training.

Model Checkpoint
CAT-Seg download linkΒ 

Make sure to place the downloaded weights in the pretrain_weights folder.


For the evaluation, we provide the pre-trained weights for the PartCATSeg model on the following datasets:

Model Setting Dataset Checkpoint
PartCATSeg zero-shot Pascal-Part-116 modelΒ 
PartCATSeg zero-shot ADE20K-Part-234 modelΒ 
PartCATSeg zero-shot PartImageNet (Seg) modelΒ 
PartCATSeg zero-shot PartImageNet (OOD) TBAΒ 
mkdir weights && cd weights

# Pascal-Part-116
# PartCATSeg (partcatseg_voc.pth (927.9M))
gdown https://drive.google.com/uc?id=1WhbMVGKm7KkHacz9rY5vU7oVILzvI_OK

# ADE20K-Part-234
# PartCATSeg (partcatseg_ade.pth (927.9M))
gdown https://drive.google.com/uc?id=12JgECVJco81EoI_3ZR93S2z7zdvwAyU9

# PartImageNet (Seg)
# PartCATSeg (partcatseg_partimagenet.pth (927.9M))
gdown https://drive.google.com/uc?id=1Jp8IjrTlQKGUOaSU8REvB4wvHmyNb2yV

Usage (Run)

Zero-Shot Prediction
# -------------
#     Train
# -------------
python train_net.py \
    --num-gpus 4 \
    --config-file configs/zero_shot/partcatseg_voc.yaml

# -----------------
#     Inference
# -----------------
python train_net.py \
    --num-gpus 4 \
    --config-file configs/zero_shot/partcatseg_voc.yaml \
    --eval-only MODEL.WEIGHTS ./weights/partcatseg_voc.pth

Project Structure

[PROJECT_ROOT]
β”œβ”€β”€ datasets/
β”‚   β”œβ”€β”€ PascalPart116/
β”‚   β”‚   β”œβ”€β”€ images
β”‚   β”‚   β”œβ”€β”€ annotations_detectron2_obj
β”‚   β”‚   └── annotations_detectron2_part
β”‚   β”œβ”€β”€ ADE20KPart234/
β”‚   └── PartImageNet/
β”œβ”€β”€ weights/
β”‚   β”œβ”€β”€ partcatseg_voc.pth
β”‚   └── partcatseg_ade.pth
β”œβ”€β”€ configs/
β”‚   β”œβ”€β”€ zero_shot
β”‚   β”‚   β”œβ”€β”€ partcatseg_voc.yaml
β”‚   β”‚   β”œβ”€β”€ partcatseg_ade.yaml
β”‚   β”‚   β”œβ”€β”€ partcatseg_partimagenet.yaml
β”‚   β”‚   └── ...
β”œβ”€β”€ baselines/
β”‚   β”œβ”€β”€ evaluation/
β”‚   β”‚   └── partcatseg_evaluation.py
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”œβ”€β”€ dataset_mappers/
β”‚   β”‚   β”‚   └── object_part_mapper.py
β”‚   β”‚   └── datasets/
β”‚   β”‚       └── register_pascal_part_116.py
β”‚   β”œβ”€β”€ modeling/
β”‚   β”‚   β”œβ”€β”€ backbone/
β”‚   β”‚   β”‚   └── dinov2_backbone.py
β”‚   β”‚   β”œβ”€β”€ heads/
β”‚   β”‚   β”‚   └── part_cat_seg_head.py
β”‚   β”‚   └── transformer/
β”‚   β”‚       β”œβ”€β”€ part_cat_seg_model.py
β”‚   β”‚       β”œβ”€β”€ part_cat_seg_predictor.py
β”‚   β”‚       └── part_cat_seg_model.py
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── visualizer.py
β”‚   β”œβ”€β”€ third_party/
β”‚   β”œβ”€β”€ partcatseg.py
β”‚   └── config.py
β”œβ”€β”€ README.md
└── train_net.py

Acknowledgement

We would like to express our gratitude to the open-source projects and their contributors, including PartCLIPSeg, OV-PARTS, CLIPSeg, Mask2Former, CLIP, and OV-DETR.

About

[CVPR 2025] Fine-Grained Image-Text Correspondence with Cost Aggregation for Open-Vocabulary Part Segmentation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages