Segment Any Medical-Model (SAMM): A 3D Slicer integration to Meta's SAM. 实践

论文: https://arxiv.org/abs/2304.05622

项目: https://github.com/bingogome/samm

系统:windows 10

下载 https://download.slicer.org/

下载 git https://git-scm.com/download/win

直接下载两个压缩包,放到你想放的目录中,并解压。

https://github.com/bingogome/samm/archive/refs/heads/main.zip

https://github.com/facebookresearch/segment-anything/archive/refs/heads/main.zip

cd segment-anything-main/
pip install -e .

pip install opencv-python matplotlib onnxruntime onnx -i https://pypi.tuna.tsinghua.edu.cn/simple/

安装报错:

pip install pycocotools -i https://pypi.tuna.tsinghua.edu.cn/simple/

错误:

building 'pycocotools._mask' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for pycocotools

解决:
conda install pycocotools -c conda-forge

image

预训练模型 2.4G:https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth

image

image

slicer.util.pip_install("pyyaml")
slicer.util.pip_install("pyzmq")

3D slicer -> Developer Tools→ Extension Wizard。

Extension Tools-> Select Extension-> 导入 samm/samm 文件夹。

目前问题: 我加载图像后

image

image

python .\samm-python-terminal\sam_server.py

image

我输出的和 DEMO 的不一样呀??我什么结果也没得到。可能我没有 GPU 的问题?
我把下面这行改为了 cpu。sam_server.py 的 36 行。
self.device = "cpu"

posted @ 2023-04-16 00:49  cold_moon  阅读(547)  评论(7编辑  收藏  举报