# 创建Python3.12虚拟环境
conda create -n sam3 python=3.12 -y
# 激活虚拟环境
conda activate sam3# 克隆sam3源码,用于sam3相关库安装
git clone https://github.com/facebookresearch/sam3
# 切换到sam3目录
cd sam3
# 检出特定的版本
git checkout 84cc43b# 安装sam3依赖库
pip install -e . -i https://pypi.mirrors.ustc.edu.cn/simple
# 安装其他依赖库
pip install requests einops decord pycocotools psutil matplotlib \
opencv-python pandas scikit-image scikit-learn \
-i https://pypi.mirrors.ustc.edu.cn/simple
# 校验PyTorch是否正确安装
python -c "import torch; print(torch.cuda.is_available())"
# 如果为False,则重装PyTorch(一般出现在Windows上)
pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/cu124
# Windows
pip install -U "triton-windows<3.6" -i https://pypi.mirrors.ustc.edu.cn/simple
# 切换回上一级目录
cd ..# 下载脚本
wget https://aliendao.cn/model_download2.py
# 下载权重
python model_download2.py --repo_id facebook/sam3 python 01_image_segment.pypython 02_image_segment.py《大模型项目实战:多领域智能应用开发》配套资源:https://github.com/little51/llm-dev 《大模型项目实战:Agent开发与应用》配套资源:https://github.com/little51/agent-dev DINOv3训练示例:https://github.com/little51/dinov3-train DINOv3其他示例:https://github.com/little51/dinov3-samples