Commit 932253f3 authored by fengyf1's avatar fengyf1
Browse files

Upload New File

parent d1faa4b3
Pipeline #3380 canceled with stages
# SAM
## 项目简介
SAM 是 Meta 推出的通用图像分割模型,通过三阶段架构实现零样本分割。它支持点、框等提示方式,能精准分割图像对象,通用性强、效果精准。
## 环境部署
### 1. 拉取镜像
```
docker pull image.sourcefind.cn:5000/dcu/admin/base/vllm:0.9.2-ubuntu22.04-dtk25.04.1-rc5-rocblas101839-0811-das1.6-py3.10-20250913-rc1
```
### 2. 创建容器
```
docker run -it \
--network=host \
--hostname=localhost \
--name=SAM_infer \
-v /opt/hyhal:/opt/hyhal:ro \
-v $PWD:/workspace \
--ipc=host \
--device=/dev/kfd \
--device=/dev/mkfd \
--device=/dev/dri \
--shm-size=512G \
--privileged \
--group-add video \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
image.sourcefind.cn:5000/dcu/admin/base/vllm:0.9.2-ubuntu22.04-dtk25.04.1-rc5-rocblas101839-0811-das1.6-py3.10-20250913-rc1 \
/bin/bash
```
## 测试步骤
### 1. 拉取优化后代码仓库
```
git clone http://developer.sourcefind.cn/codes/bw-bestperf/SAM.git
cd SAM
```
### 2. 安装依赖
```
pip install pycocotools -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install onnx -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install onnxruntime-1.19.2+das.opt1.dtk25041-cp310-cp310-manylinux_2_28_x86_64.whl
pip install -e .
```
### 4. 下载模型与数据集
```
# 模型下载
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth
# 数据集下载
wget -O coco_2017.zip https://ai-studio-online.bj.bcebos.com/v1/9b15388b52fa45bb8f4e66343d6e2fa690630a526df64fcd90d8ed8a124627bd?responseContentDisposition=attachment%3Bfilename%3Dmini-coco2017.zip&authorization=bce-auth-v1%2F5cfe9a5e1454405eb2a975c43eace6ec%2F2025-10-11T02%3A23%3A00Z%2F60%2F%2Fdb2d898bccb4ef8674047b3eda1aaaa094a71c8f87a7d2b51f49ee16e30c77ac
# 数据集解压
unzip coco_2017.zip -d mini_coco/
```
### 5. 测试命令
```
python scripts/amg_amp_compile_v2_warmup.py --checkpoint sam_vit_h_4b8939.pth --model-type vit_h --input mini_coco/val2017 --output ./output
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment