Skip to content
/ GPRN Public

[AAAI 2025] Official implement of SAM-Aware Graph Prompt Reasoning Network for Cross-Domain Few-Shot Segmentation

Notifications You must be signed in to change notification settings

CVL-hub/GPRN

Repository files navigation

[AAAI 2025] SAM-Aware Graph Prompt Reasoning Network for Cross-Domain Few-Shot Segmentation.

Shi-Feng Peng,Guolei Sun, Yong Li , Hongsong Wang , Guo-Sen Xie.

Welcome to the official PyTorch implementation repository of our paper SAM-Aware Graph Prompt Reasoning Network for Cross-Domain Few-Shot Segmentation, accepted to AAAI 2025.

Framework

Requirements

Download training and testing datasets for evaluation.

Source domain:

  • PASCAL VOC2012:

    Download PASCAL VOC2012 devkit (train/val data):

    wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar

    Download PASCAL VOC2012 SDS extended mask annotations from [Google Drive].

Target domains:

Pre-trained Weight

Download pre-trained ResNet models and SAM weights.

SAM base version weight

Pre-trained ResNet model weight

Generating SAM Masks

To save time, we have saved the masks generated by SAM to a file during actual operations, so you don’t need to regenerate them every time . You only need to run generate_mask.py to generate them once. Note that you should reconfigure the configuration such as file path and GPU ID in generate_mask.py .

python generate_mask.py

File Organization

GPRN/
|--dataset/
|  |--Deepglobe/
|  |  |--01_train_ori/
|  |  |--...
|  |  |--04_train_cat/
|  |  |--|--Deepglobe-SAM_mask/          # Masks generated by SAM
|  |--FSS-1000/
|  |  |--ab_wheel/
|  |  |--...
|  |  |--FSS-SAM-MASK/                   # Masks generated by SAM
|  |--ISIC/
|  |  |--ISIC2018_Task1-2_Training_Input/
|  |  |--...
|  |  |--ISIC-SAM-MASK/                  # Masks generated by SAM
|  |--LungSegmentation/
|  |  |--CXR_PNG/
|  |  |--...
|  |  |--Lung-SAM-MASK/                  # Masks generated by SAM
|  |--VOC2012/
|  |  |--JPEGImages/
|  |  |--...
|  |  |--SAM-PASCAL/                     # Masks generated by SAM

Evaluate our models

Please run the script file run.sh to evaluate our models. Here is an example on Deepglobe dataset:

CUDA_VISIBLE_DEVICES=0 python -W ignore test.py \
  --dataset deepglobe --data-root ./dataset \
  --backbone resnet50 --batch-size 6 --shot 1 --refine --positive_point 20 --negative_point 20 --alpha 0.5 --fuse_method coff \
  --post_refine

Related Repositories

This repository is built upon the foundations of Segment Anything, MGCL, IFA, VRP-SAM, MaskSLIC. We are very grateful for their contribution!

About

[AAAI 2025] Official implement of SAM-Aware Graph Prompt Reasoning Network for Cross-Domain Few-Shot Segmentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages