SAM(segment anything model)当地摆设复现

[复制链接]
查看931 | 回复0 | 2023-8-23 12:05:31 | 显示全部楼层 |阅读模式
源码位置:https://github.com/facebookresearch/segment-anything
一、下载

  1. pip install git+https://github.com/facebookresearch/segment-anything.git
复制代码
大概 直接下载,解压到当前文件夹,并把解压出的文件夹名字改成segment-anything

二、安装

1、进入segment-anything文件夹
  1. cd segment-anything
复制代码
2、安装
  1. pip install -e .
复制代码
3、安装其他依靠
  1. pip install opencv-python pycocotools matplotlib onnxruntime onnx
复制代码
4、下载模子文件到segment-anything文件夹内

default or vit_h:
  1. https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth
复制代码
vit_l:
  1. https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth
复制代码
vit_b:
  1. https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth
复制代码
5、下载数据集
  1. https://ai.facebook.com/datasets/segment-anything-downloads/
复制代码
大概用本身的图片数据集
三、运行

整体文件布局

  1. python scripts/amg.py --checkpoint <path/to/checkpoint> --model-type <model_type> --input <image_or_folder> --output <path/to/output>
复制代码
例如:在D:\PythonProject\segment-anything\test\input文件夹下放入图片,利用vit_b模子sam_vit_b_01ec64.pth,输出到D:\PythonProject\segment-anything\test\output文件夹内
  1. python scripts/amg.py --checkpoint sam_vit_b_01ec64.pth --model-type vit_b --input D:\PythonProject\segment-anything\test\input --output D:\PythonProject\segment-anything\test\output
复制代码
输入:

输出:


来源:https://blog.csdn.net/koukutou_mikiya/article/details/130281945
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则