镜像社区
部署GPU实例
文档中心
常见问题(FAQ)
深度学习
其他
segment-anything
分割任何物体模型 (SAM)可根据点或框等输入提示生成高质量物体蒙版,并可用于为图像中的所有物体生成蒙版。该模型已在包含 1100 万张图像和 11 亿个蒙版的数据集上进行了训练,并且在各种分割任务中具有强大的零样本性能
0/小时
v1.0

1 介绍

分割任何物体模型 (SAM)可根据点或框等输入提示生成高质量物体蒙版,并可用于为图像中的所有物体生成蒙版。该模型已在包含 1100 万张图像和 11 亿个蒙版的数据集上进行了训练,并且在各种分割任务中具有强大的零样本性能

###1.1说明 已在RTX40系列、3090、3080ti适配;

2 使用

推理模式分为point prompt、Box prompt (xywh)以及Points_box prompt

2.1 point promp

推理

请下载预训练的权重检查点。将它放在/workspace/segment-anything/checkpoint文件夹中。(注意:vit_b类型对应/workspace/segment-anything/checkpoint/sam_vit_b_01ec64.pth;vit_h类型对应/workspace/segment-anything/checkpoint/sam_vit_h_4b8939.pth) 运行下面的命令来推理;

cd /workspace/segment-anything/notebooks

python inference_point.py 

可以自己指定图片、checkpoint、模型类型、输出路径以及点的坐标;

python inference_point.py --image_path /workspace/segment-anything/truck.jpg --input_point '[[500,375]]' --output_dir /workspace/segment-anything/output_masks --checkpoint /workspace/segment-anything/checkpoint/sam_vit_b_01ec64.pth --type vit_b

2.2 Box prompt (xywh)

推理

请下载预训练的权重检查点。将它放在/workspace/segment-anything/checkpoint文件夹中。(注意:vit_b类型对应/workspace/segment-anything/checkpoint/sam_vit_b_01ec64.pth;vit_h类型对应/workspace/segment-anything/checkpoint/sam_vit_h_4b8939.pth) 运行下面的命令来推理;

cd /workspace/segment-anything/notebooks

python inference_box.py 

可以自己指定图片、checkpoint、模型类型、输出路径以及框的坐标;

python inference_box.py --image_path /workspace/segment-anything/truck.jpg --input_box '[425, 600, 700, 875]' --output_dir /workspace/segment-anything/output_masks --checkpoint /workspace/segment-anything/checkpoint/sam_vit_b_01ec64.pth --type vit_b

2.3 Points_box prompt

推理

请下载预训练的权重检查点。将它放在/workspace/segment-anything/checkpoint文件夹中。(注意:vit_b类型对应/workspace/segment-anything/checkpoint/sam_vit_b_01ec64.pth;vit_h类型对应/workspace/segment-anything/checkpoint/sam_vit_h_4b8939.pth); 运行下面的命令来推理下;

cd /workspace/segment-anything/notebooks

python inference_box_point.py 

可以自己指定图片、checkpoint、模型类型、输出路径以及点和框的坐标;

python inference_box_point.py --image_path /workspace/segment-anything/truck.jpg --input_box '[425, 600, 700, 875]' --input_point '[[575,750]]' --output_dir /workspace/segment-anything/output_masks --checkpoint /workspace/segment-anything/checkpoint/sam_vit_b_01ec64.pth --type vit_b
镜像信息
@naoxin
已使用
10
镜像大小40GB
最近编辑2025-02-13
支持卡型
RTX40系48G RTX40系P403080Ti3090A100A800
+7
框架版本
PyTorch-1.8.1
CUDA版本
11.1
应用
JupyterLab: 8888
版本
v1.0
2025-02-13
PyTorch:1.8.1 | CUDA:11.1 | 大小:40.00GB