MCPcopy Index your code
hub / github.com/LiuTingWed/SAM-Not-Perfect

github.com/LiuTingWed/SAM-Not-Perfect @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
153 symbols 491 edges 20 files 62 documented · 41%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Segment Anything Is Not Always Perfect

Code repository for our paper titled "Segment Anything Is Not Always Perfect: An Investigation of SAM on Different Real-World Applications" (CVPRW Oral).

avatar


Updates

  • [x] Another work, Medical SAM Adapter which addresses the issue of lacking domain-specific medical knowledge in the SAM, are available now.
  • [x] Long version of this work has been accepted by Machine Intelligence Research.
  • [x] This work is awarded as Best Paper (Most Insightful Paper) at the CVPR'23 VISION Workshop. avatar
  • [x] Evaluation code has been released.
  • [x] This work has been accepted as an Oral Presentation at the CVPR'23 VISION Workshop.

Get Started

Eval SAM in different dataset

  1. Download the vit_b, vit_h and vim_l model from https://github.com/facebookresearch/segment-anything then put these models to the model_ck folder.
  2. Prepared own datasets put into the datasets folder.
  3. Set right path in /scripts/amg.py, then:

    run amg.py

Chosen best results form the sam_output folder

  1. After inferring, the SAM model generates predicted maps from a singer RGB image (multimask_output=True). Check right path in sam_dice_f1_mae.py or sam_f1_dice_mae.py to decide the best map selected by Dice or F1 metrics.

Eval other methods in different dataset

  1. Prepared these methods predicted maps to put into the other_methods_output folder.
  2. Check right path in /scripts/other_methods_dice_mae.py, then:

    run other_methods_dice_mae.py


Datasets

The download links of the dataset involved in our work are provided below.

DUTS COME15K VT1000 DIS COD10K SBU CDS2K ColonDB
Link Link Link Link Link Link Link Link

Citation

If you find our work useful for your research or applications, please cite using this BibTeX:

@article{Jisam2024,
      author={Ji, Wei and Li, Jingjing and Bi, Qi and Liu, Tingwei and Li, Wenbo and Cheng, Li},
      journal={Machine Intelligence Research},
      title={Segment Anything Is Not Always Perfect: An Investigation of SAM on Different Real-world Applications},
      year={2024},
      volume={21},
      pages={617--630},
      publisher={Springer}
}

@misc{wu2023medical,
      title={Medical SAM Adapter: Adapting Segment Anything Model for Medical Image Segmentation}, 
      author={Junde Wu and Wei Ji and Yuanpei Liu and Huazhu Fu and Min Xu and Yanwu Xu and Yueming Jin},
      year={2023},
      eprint={2304.12620},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

Acknowledgement

Thanks for the efforts of the authors involved in the Segment Anything.

Core symbols most depended-on inside this repo

cat
called by 11
segment_anything/utils/amg.py
filter
called by 6
segment_anything/utils/amg.py
items
called by 5
segment_anything/utils/amg.py
get_preprocess_shape
called by 4
segment_anything/utils/transforms.py
reset_image
called by 3
segment_anything/predictor.py
_build_sam
called by 3
segment_anything/build_sam.py
_separate_heads
called by 3
segment_anything/modeling/transformer.py
get_dense_pe
called by 3
segment_anything/modeling/prompt_encoder.py

Shape

Method 79
Function 55
Class 19

Languages

Python100%

Modules by API surface

segment_anything/utils/amg.py26 symbols
segment_anything/modeling/image_encoder.py16 symbols
segment_anything/modeling/prompt_encoder.py14 symbols
segment_anything/modeling/transformer.py11 symbols
segment_anything/utils/transforms.py9 symbols
segment_anything/predictor.py9 symbols
scripts/sam_f1_dice_mae.py9 symbols
scripts/sam_dice_f1_mae.py9 symbols
segment_anything/utils/onnx.py8 symbols
segment_anything/modeling/mask_decoder.py7 symbols
segment_anything/automatic_mask_generator.py7 symbols
scripts/other_methods_dice_mae.py7 symbols

For agents

$ claude mcp add SAM-Not-Perfect \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact