xChar
·2 years ago

工具分享

FastSAM是一个CNN Segment Anything模型,仅使用SA-1B数据集的2%进行训练。FastSAM在50倍的运行速度下实现了与SAM方法相当的性能。

19-fastsam

特点

官方介绍比SAM快50倍,并且打到相同性能效果,模型基于YoloV8结构,训练成本也比SAM的低很多。

部署

  • 安装项目

    git clone https://github.com/CASIA-IVA-Lab/FastSAM.git && cd FastSAM
    pip install git+https://github.com/openai/CLIP.git
    
    conda create -n FastSAM python=3.9
    conda activate FastSAM
    
    pip install -r requirements.txt
    
  • 使用

    # Everything模式
    python Inference.py --model_path ./weights/FastSAM.pt --img_path ./images/dogs.jpg
    
    # 文本提示分割,使用CLIP辅助
    python Inference.py --model_path ./weights/FastSAM.pt --img_path ./images/dogs.jpg  --text_prompt "the yellow dog"
    
    # 框选模式
    python Inference.py --model_path ./weights/FastSAM.pt --img_path ./images/dogs.jpg --box_prompt "[570,200,230,400]"
    
    # 点击模式
    python Inference.py --model_path ./weights/FastSAM.pt --img_path ./images/dogs.jpg  --point_prompt "[[520,360],[620,300]]" --point_label "[1,0]"
    

平台

官方demo


声明

本文仅作为工具分享记录。

本文与HBlog保持同步。

Loading comments...