Skip to content

Commit 68e8513

Browse files
committed
Update links after renaming the repo from segment-anything-2 to sam2
This PR update repo links after we renamed the repo from `segment-anything-2` to `sam2`. It also changes `NAME` in setup.py to `SAM-2` (which is already the named used in pip setup since python packages don't allow whitespace)
1 parent 05d9e57 commit 68e8513

File tree

9 files changed

+28
-28
lines changed

9 files changed

+28
-28
lines changed

INSTALL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ I got `ImportError: cannot import name '_C' from 'sam2'`
4848

4949
This is usually because you haven't run the `pip install -e ".[notebooks]"` step above or the installation failed. Please install SAM 2 first, and see the other issues if your installation fails.
5050

51-
In some systems, you may need to run `python setup.py build_ext --inplace` in the SAM 2 repo root as suggested in https://github.com/facebookresearch/segment-anything-2/issues/77.
51+
In some systems, you may need to run `python setup.py build_ext --inplace` in the SAM 2 repo root as suggested in https://github.com/facebookresearch/sam2/issues/77.
5252
</details>
5353

5454
<details>
@@ -59,7 +59,7 @@ I got `MissingConfigException: Cannot find primary config 'configs/sam2.1/sam2.1
5959

6060
This is usually because you haven't run the `pip install -e .` step above, so `sam2` isn't in your Python's `sys.path`. Please run this installation step. In case it still fails after the installation step, you may try manually adding the root of this repo to `PYTHONPATH` via
6161
```bash
62-
export SAM2_REPO_ROOT=/path/to/segment-anything-2 # path to this repo
62+
export SAM2_REPO_ROOT=/path/to/sam2 # path to this repo
6363
export PYTHONPATH="${SAM2_REPO_ROOT}:${PYTHONPATH}"
6464
```
6565
to manually add `sam2_configs` into your Python's `sys.path`.
@@ -84,7 +84,7 @@ from sam2.modeling import sam2_base
8484

8585
print(sam2_base.__file__)
8686
```
87-
and check whether the content in the printed local path of `sam2/modeling/sam2_base.py` matches the latest one in https://github.com/facebookresearch/segment-anything-2/blob/main/sam2/modeling/sam2_base.py (e.g. whether your local file has `no_obj_embed_spatial`) to indentify if you're still using a previous installation.
87+
and check whether the content in the printed local path of `sam2/modeling/sam2_base.py` matches the latest one in https://github.com/facebookresearch/sam2/blob/main/sam2/modeling/sam2_base.py (e.g. whether your local file has `no_obj_embed_spatial`) to indentify if you're still using a previous installation.
8888

8989
</details>
9090

@@ -123,7 +123,7 @@ This usually happens because you have multiple versions of dependencies (PyTorch
123123

124124
In particular, if you have a lower PyTorch version than 2.3.1, it's recommended to upgrade to PyTorch 2.3.1 or higher first. Otherwise, the installation script will try to upgrade to the latest PyTorch using `pip`, which could sometimes lead to duplicated PyTorch installation if you have previously installed another PyTorch version using `conda`.
125125

126-
We have been building SAM 2 against PyTorch 2.3.1 internally. However, a few user comments (e.g. https://github.com/facebookresearch/segment-anything-2/issues/22, https://github.com/facebookresearch/segment-anything-2/issues/14) suggested that downgrading to PyTorch 2.1.0 might resolve this problem. In case the error persists, you may try changing the restriction from `torch>=2.3.1` to `torch>=2.1.0` in both [`pyproject.toml`](pyproject.toml) and [`setup.py`](setup.py) to allow PyTorch 2.1.0.
126+
We have been building SAM 2 against PyTorch 2.3.1 internally. However, a few user comments (e.g. https://github.com/facebookresearch/sam2/issues/22, https://github.com/facebookresearch/sam2/issues/14) suggested that downgrading to PyTorch 2.1.0 might resolve this problem. In case the error persists, you may try changing the restriction from `torch>=2.3.1` to `torch>=2.1.0` in both [`pyproject.toml`](pyproject.toml) and [`setup.py`](setup.py) to allow PyTorch 2.1.0.
127127
</details>
128128

129129
<details>
@@ -168,7 +168,7 @@ You may see error log of:
168168
> unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
169169
170170
This is probably because your versions of CUDA and Visual Studio are incompatible. (see also https://stackoverflow.com/questions/78515942/cuda-compatibility-with-visual-studio-2022-version-17-10 for a discussion in stackoverflow).<br>
171-
You may be able to fix this by adding the `-allow-unsupported-compiler` argument to `nvcc` after L48 in the [setup.py](https://github.com/facebookresearch/segment-anything-2/blob/main/setup.py). <br>
171+
You may be able to fix this by adding the `-allow-unsupported-compiler` argument to `nvcc` after L48 in the [setup.py](https://github.com/facebookresearch/sam2/blob/main/setup.py). <br>
172172
After adding the argument, `get_extension()` will look like this:
173173
```python
174174
def get_extensions():

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
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:
2727

2828
```bash
29-
git clone https://github.com/facebookresearch/segment-anything-2.git
29+
git clone https://github.com/facebookresearch/sam2.git
3030

31-
cd segment-anything-2 & pip install -e .
31+
cd sam2 & pip install -e .
3232
```
3333
If you are installing on Windows, it's strongly recommended to use [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install) with Ubuntu.
3434

@@ -86,9 +86,9 @@ with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
8686
masks, _, _ = predictor.predict(<input_prompts>)
8787
```
8888

89-
Please refer to the examples in [image_predictor_example.ipynb](./notebooks/image_predictor_example.ipynb) (also in Colab [here](https://colab.research.google.com/github/facebookresearch/segment-anything-2/blob/main/notebooks/image_predictor_example.ipynb)) for static image use cases.
89+
Please refer to the examples in [image_predictor_example.ipynb](./notebooks/image_predictor_example.ipynb) (also in Colab [here](https://colab.research.google.com/github/facebookresearch/sam2/blob/main/notebooks/image_predictor_example.ipynb)) for static image use cases.
9090

91-
SAM 2 also supports automatic mask generation on images just like SAM. Please see [automatic_mask_generator_example.ipynb](./notebooks/automatic_mask_generator_example.ipynb) (also in Colab [here](https://colab.research.google.com/github/facebookresearch/segment-anything-2/blob/main/notebooks/automatic_mask_generator_example.ipynb)) for automatic mask generation in images.
91+
SAM 2 also supports automatic mask generation on images just like SAM. Please see [automatic_mask_generator_example.ipynb](./notebooks/automatic_mask_generator_example.ipynb) (also in Colab [here](https://colab.research.google.com/github/facebookresearch/sam2/blob/main/notebooks/automatic_mask_generator_example.ipynb)) for automatic mask generation in images.
9292

9393
### Video prediction
9494

@@ -113,7 +113,7 @@ with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
113113
...
114114
```
115115

116-
Please refer to the examples in [video_predictor_example.ipynb](./notebooks/video_predictor_example.ipynb) (also in Colab [here](https://colab.research.google.com/github/facebookresearch/segment-anything-2/blob/main/notebooks/video_predictor_example.ipynb)) for details on how to add click or box prompts, make refinements, and track multiple objects in videos.
116+
Please refer to the examples in [video_predictor_example.ipynb](./notebooks/video_predictor_example.ipynb) (also in Colab [here](https://colab.research.google.com/github/facebookresearch/sam2/blob/main/notebooks/video_predictor_example.ipynb)) for details on how to add click or box prompts, make refinements, and track multiple objects in videos.
117117

118118
## Load from 🤗 Hugging Face
119119

demo/frontend/src/demo/DemoConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const RESEARCH_BY_META_AI = 'By Meta FAIR';
2525
export const DEMO_FRIENDLY_NAME = 'Segment Anything 2 Demo';
2626
export const VIDEO_WATERMARK_TEXT = `Modified with ${DEMO_FRIENDLY_NAME}`;
2727
export const PROJECT_GITHUB_URL =
28-
'https://github.com/facebookresearch/segment-anything-2';
28+
'https://github.com/facebookresearch/sam2';
2929
export const AIDEMOS_URL = 'https://aidemos.meta.com';
3030
export const ABOUT_URL = 'https://ai.meta.com/sam2';
3131
export const EMAIL_ADDRESS = '[email protected]';

notebooks/automatic_mask_generator_example.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"id": "4290fb06-a63f-4624-a70c-f7c9aae4b5d5",
3535
"metadata": {},
3636
"source": [
37-
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/facebookresearch/segment-anything-2/blob/main/notebooks/automatic_mask_generator_example.ipynb\">\n",
37+
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/facebookresearch/sam2/blob/main/notebooks/automatic_mask_generator_example.ipynb\">\n",
3838
" <img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/>\n",
3939
"</a>"
4040
]
@@ -82,10 +82,10 @@
8282
" print(\"CUDA is available:\", torch.cuda.is_available())\n",
8383
" import sys\n",
8484
" !{sys.executable} -m pip install opencv-python matplotlib\n",
85-
" !{sys.executable} -m pip install 'git+https://github.com/facebookresearch/segment-anything-2.git'\n",
85+
" !{sys.executable} -m pip install 'git+https://github.com/facebookresearch/sam2.git'\n",
8686
"\n",
8787
" !mkdir -p images\n",
88-
" !wget -P images https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/notebooks/images/cars.jpg\n",
88+
" !wget -P images https://raw.githubusercontent.com/facebookresearch/sam2/main/notebooks/images/cars.jpg\n",
8989
"\n",
9090
" !mkdir -p ../checkpoints/\n",
9191
" !wget -P ../checkpoints/ https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt"

notebooks/image_predictor_example.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"id": "ee822903-7739-4c1b-941a-b292b6e89bcf",
3434
"metadata": {},
3535
"source": [
36-
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/facebookresearch/segment-anything-2/blob/main/notebooks/image_predictor_example.ipynb\">\n",
36+
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/facebookresearch/sam2/blob/main/notebooks/image_predictor_example.ipynb\">\n",
3737
" <img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/>\n",
3838
"</a>"
3939
]
@@ -51,7 +51,7 @@
5151
"id": "07fabfee",
5252
"metadata": {},
5353
"source": [
54-
"If running locally using jupyter, first install `sam2` in your environment using the [installation instructions](https://github.com/facebookresearch/segment-anything-2#installation) in the repository.\n",
54+
"If running locally using jupyter, first install `sam2` in your environment using the [installation instructions](https://github.com/facebookresearch/sam2#installation) in the repository.\n",
5555
"\n",
5656
"If running from Google Colab, set `using_colab=True` below and run the cell. In Colab, be sure to select 'GPU' under 'Edit'->'Notebook Settings'->'Hardware accelerator'. Note that it's recommended to use **A100 or L4 GPUs when running in Colab** (T4 GPUs might also work, but could be slow and might run out of memory in some cases)."
5757
]
@@ -81,11 +81,11 @@
8181
" print(\"CUDA is available:\", torch.cuda.is_available())\n",
8282
" import sys\n",
8383
" !{sys.executable} -m pip install opencv-python matplotlib\n",
84-
" !{sys.executable} -m pip install 'git+https://github.com/facebookresearch/segment-anything-2.git'\n",
84+
" !{sys.executable} -m pip install 'git+https://github.com/facebookresearch/sam2.git'\n",
8585
"\n",
8686
" !mkdir -p images\n",
87-
" !wget -P images https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/notebooks/images/truck.jpg\n",
88-
" !wget -P images https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/notebooks/images/groceries.jpg\n",
87+
" !wget -P images https://raw.githubusercontent.com/facebookresearch/sam2/main/notebooks/images/truck.jpg\n",
88+
" !wget -P images https://raw.githubusercontent.com/facebookresearch/sam2/main/notebooks/images/groceries.jpg\n",
8989
"\n",
9090
" !mkdir -p ../checkpoints/\n",
9191
" !wget -P ../checkpoints/ https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt"

notebooks/video_predictor_example.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"id": "a887b90f-6576-4ef8-964e-76d3a156ccb6",
3838
"metadata": {},
3939
"source": [
40-
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/facebookresearch/segment-anything-2/blob/main/notebooks/video_predictor_example.ipynb\">\n",
40+
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/facebookresearch/sam2/blob/main/notebooks/video_predictor_example.ipynb\">\n",
4141
" <img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/>\n",
4242
"</a>"
4343
]
@@ -55,7 +55,7 @@
5555
"id": "8491a127-4c01-48f5-9dc5-f148a9417fdf",
5656
"metadata": {},
5757
"source": [
58-
"If running locally using jupyter, first install `sam2` in your environment using the [installation instructions](https://github.com/facebookresearch/segment-anything-2#installation) in the repository.\n",
58+
"If running locally using jupyter, first install `sam2` in your environment using the [installation instructions](https://github.com/facebookresearch/sam2#installation) in the repository.\n",
5959
"\n",
6060
"If running from Google Colab, set `using_colab=True` below and run the cell. In Colab, be sure to select 'GPU' under 'Edit'->'Notebook Settings'->'Hardware accelerator'. Note that it's recommended to use **A100 or L4 GPUs when running in Colab** (T4 GPUs might also work, but could be slow and might run out of memory in some cases)."
6161
]
@@ -85,7 +85,7 @@
8585
" print(\"CUDA is available:\", torch.cuda.is_available())\n",
8686
" import sys\n",
8787
" !{sys.executable} -m pip install opencv-python matplotlib\n",
88-
" !{sys.executable} -m pip install 'git+https://github.com/facebookresearch/segment-anything-2.git'\n",
88+
" !{sys.executable} -m pip install 'git+https://github.com/facebookresearch/sam2.git'\n",
8989
"\n",
9090
" !mkdir -p videos\n",
9191
" !wget -P videos https://dl.fbaipublicfiles.com/segment_anything_2/assets/bedroom.zip\n",
@@ -1047,7 +1047,7 @@
10471047
"id": "e023f91f-0cc5-4980-ae8e-a13c5749112b",
10481048
"metadata": {},
10491049
"source": [
1050-
"Note that in addition to clicks or boxes, SAM 2 also supports directly using a **mask prompt** as input via the `add_new_mask` method in the `SAM2VideoPredictor` class. This can be helpful in e.g. semi-supervised VOS evaluations (see [tools/vos_inference.py](https://github.com/facebookresearch/segment-anything-2/blob/main/tools/vos_inference.py) for an example)."
1050+
"Note that in addition to clicks or boxes, SAM 2 also supports directly using a **mask prompt** as input via the `add_new_mask` method in the `SAM2VideoPredictor` class. This can be helpful in e.g. semi-supervised VOS evaluations (see [tools/vos_inference.py](https://github.com/facebookresearch/sam2/blob/main/tools/vos_inference.py) for an example)."
10511051
]
10521052
},
10531053
{

sam2/utils/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def fill_holes_in_mask_scores(mask, max_area):
329329
f"{e}\n\nSkipping the post-processing step due to the error above. You can "
330330
"still use SAM 2 and it's OK to ignore the error above, although some post-processing "
331331
"functionality may be limited (which doesn't affect the results in most cases; see "
332-
"https://github.com/facebookresearch/segment-anything-2/blob/main/INSTALL.md).",
332+
"https://github.com/facebookresearch/sam2/blob/main/INSTALL.md).",
333333
category=UserWarning,
334334
stacklevel=2,
335335
)

sam2/utils/transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def postprocess_masks(self, masks: torch.Tensor, orig_hw) -> torch.Tensor:
108108
f"{e}\n\nSkipping the post-processing step due to the error above. You can "
109109
"still use SAM 2 and it's OK to ignore the error above, although some post-processing "
110110
"functionality may be limited (which doesn't affect the results in most cases; see "
111-
"https://github.com/facebookresearch/segment-anything-2/blob/main/INSTALL.md).",
111+
"https://github.com/facebookresearch/sam2/blob/main/INSTALL.md).",
112112
category=UserWarning,
113113
stacklevel=2,
114114
)

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
from setuptools import find_packages, setup
99

1010
# Package metadata
11-
NAME = "SAM 2"
11+
NAME = "SAM-2"
1212
VERSION = "1.0"
1313
DESCRIPTION = "SAM 2: Segment Anything in Images and Videos"
14-
URL = "https://github.com/facebookresearch/segment-anything-2"
14+
URL = "https://github.com/facebookresearch/sam2"
1515
AUTHOR = "Meta AI"
1616
AUTHOR_EMAIL = "[email protected]"
1717
LICENSE = "Apache 2.0"
@@ -79,7 +79,7 @@
7979
"Failed to build the SAM 2 CUDA extension due to the error above. "
8080
"You can still use SAM 2 and it's OK to ignore the error above, although some "
8181
"post-processing functionality may be limited (which doesn't affect the results in most cases; "
82-
"(see https://github.com/facebookresearch/segment-anything-2/blob/main/INSTALL.md).\n"
82+
"(see https://github.com/facebookresearch/sam2/blob/main/INSTALL.md).\n"
8383
)
8484

8585

0 commit comments

Comments
 (0)