[doc] add INSTALL.md as an installation FAQ page

This commit is contained in:
Ronghang Hu
2024-08-02 21:44:28 +00:00
parent 0e78a11899
commit b744a3c084
2 changed files with 97 additions and 2 deletions

View File

@@ -14,7 +14,7 @@
## Installation
Please install SAM 2 on a GPU machine using:
SAM 2 needs to be installed first before use. The code requires `python>=3.10`, as well as `torch>=2.3.1` and `torchvision>=0.18.1`. Please follow the instructions [here](https://pytorch.org/get-started/locally/) to install both PyTorch and TorchVision dependencies. You can install SAM 2 on a GPU machine using:
```bash
git clone https://github.com/facebookresearch/segment-anything-2.git
@@ -28,6 +28,12 @@ To use the SAM 2 predictor and run the example notebooks, `jupyter` and `matplot
pip install -e ".[demo]"
```
Note:
1. It's recommended to create a new Python environment for this installation and install PyTorch 2.3.1 (or higher) via `pip` following https://pytorch.org/. If you have a PyTorch version lower than 2.3.1 in your current environment, the installation command above will try to upgrade it to the latest PyTorch version using `pip`.
2. The step above requires compiling a custom CUDA kernel with the `nvcc` compiler. If it isn't already available on your machine, please install the [CUDA toolkits](https://developer.nvidia.com/cuda-toolkit-archive) with a version that matches your PyTorch CUDA version.
Please see [`INSTALL.md`](./INSTALL.md) for FAQs on potential issues and solutions.
## Getting Started
### Download Checkpoints
@@ -86,7 +92,7 @@ with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
state = predictor.init_state(<your_video>)
# add new prompts and instantly get the output on the same frame
frame_idx, object_ids, masks = predictor.add_new_points(state, <your prompts>):
frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>):
# propagate the prompts to get masklets throughout the video
for frame_idx, object_ids, masks in predictor.propagate_in_video(state):