FastSAM部署//使用教程//python

废话不多说 直接开始

先打开anaconda prompt

1.创建一个新环境

conda create -n FastSAM python=3.9
conda activate FastSAM

2.下载软件包

git clone https://github.com/CASIA-IVA-Lab/FastSAM.git

3.然后跳转到这个包的文件夹下并安装(安装在哪里就跳到哪里,比如说我的就是cd D:\FastSAM,下载很慢,可以去找清华镜像,此处省略)

cd FastSAM
pip install -r requirements.txt

4.安装CLIP

pip install git+https://github.com/openai/CLIP.git

5.在FastSAM下建立一个新文件夹weights

6.下载权重文件到这个新文件夹下

https://drive.google.com/file/d/1m1sjY4ihXBU1fZXdQ-Xdj-mDltW-2Rqv/viewicon-default.png?t=O83Ahttps://drive.google.com/file/d/1m1sjY4ihXBU1fZXdQ-Xdj-mDltW-2Rqv/view

7.使用

python Inference.py --model_path ./weights/FastSAM-x.pt --img_path ./images/dogs.jpg
python Inference.py --model_path ./weights/FastSAM-x.pt --img_path ./images/dogs.jpg  --text_prompt "the yellow dog"
python Inference.py --model_path ./weights/FastSAM-x.pt --img_path ./images/dogs.jpg --box_prompt "[570,200,230,400]"
python Inference.py --model_path ./weights/FastSAM-x.pt --img_path ./images/dogs.jpg  --point_prompt "[[520,360],[620,300]]" --point_label "[1,0]"

要想运行自己的数据,只需要把自己的图像复制到FastSAM文件下的images文件夹下,将代码中的dog.jpg改为自己的图像名称就行了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值