本指南提供了使用 UV 包管理器快速安装和设置 SHARP 项目的详细步骤。UV 是一个高性能的 Python 包管理器,能够加速依赖安装过程。
SHARP 是一个用于从单张图像生成逼真视图合成的方法。它通过神经网络的单次前向传递,在不到一秒的时间内回归出场景的 3D 高斯表示,然后可以实时渲染附近视图的高分辨率逼真图像。
- 操作系统:Windows、Linux 或 macOS
- Python 3.13(建议使用)
- CUDA GPU(用于渲染轨迹,预测功能支持 CPU、CUDA 和 MPS)
在 PowerShell 中运行以下命令:
(Invoke-WebRequest -Uri https://astral.sh/uv/install.ps1 -UseBasicParsing).Content | PowerShell -在终端中运行以下命令:
curl -LsSf https://astral.sh/uv/install.sh | shgit clone https://github.com/apple/ml-sharp.git
cd ml-sharp使用 UV 创建一个 Python 3.13 虚拟环境:
uv venv --python 3.13 venvvenv\Scripts\activatesource venv/bin/activate使用 UV 安装项目依赖:
uv pip install -r requirements.txt运行以下命令验证安装是否成功:
sharp --help如果安装成功,您将看到类似以下输出:
Usage: sharp [OPTIONS] COMMAND [ARGS]...
Run inference for SHARP model.
Options:
--help Show this message and exit.
Commands:
predict Predict Gaussians from input images.
render Predict Gaussians from input images.
sharp predict -i /path/to/input/images -o /path/to/output/gaussians# 从输入图像预测并渲染
sharp predict -i /path/to/input/images -o /path/to/output/gaussians --render
# 从已有的高斯表示渲染
sharp render -i /path/to/output/gaussians -o /path/to/output/renderings- 确保您的网络连接正常
- 尝试使用管理员权限运行安装命令
- 检查系统防火墙设置,确保允许 UV 下载依赖
- 确保您使用的是推荐的 Python 3.13 版本
- 尝试清理 UV 缓存:
uv cache clean - 检查
requirements.txt文件是否存在且完整
- 确保虚拟环境已正确激活
- 检查是否所有依赖都已成功安装
- 尝试重新安装项目:
uv pip install -e .
请查看仓库中的 LICENSE 和 LICENSE_MODEL 文件了解许可证信息。