SAM2.1 checkpoints + training code + Demo
This commit is contained in:
Haitham Khedr
2024-09-28 08:20:56 -07:00
parent 7e1596c0b6
commit aa9b8722d0
325 changed files with 38174 additions and 223 deletions

View File

@@ -51,7 +51,7 @@
"id": "07fabfee",
"metadata": {},
"source": [
"If running locally using jupyter, first install `segment-anything-2` in your environment using the [installation instructions](https://github.com/facebookresearch/segment-anything-2#installation) in the repository.\n",
"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",
"\n",
"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)."
]
@@ -88,7 +88,7 @@
" !wget -P images https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/notebooks/images/groceries.jpg\n",
"\n",
" !mkdir -p ../checkpoints/\n",
" !wget -P ../checkpoints/ https://dl.fbaipublicfiles.com/segment_anything_2/072824/sam2_hiera_large.pt"
" !wget -P ../checkpoints/ https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt"
]
},
{
@@ -284,8 +284,8 @@
"from sam2.build_sam import build_sam2\n",
"from sam2.sam2_image_predictor import SAM2ImagePredictor\n",
"\n",
"sam2_checkpoint = \"../checkpoints/sam2_hiera_large.pt\"\n",
"model_cfg = \"sam2_hiera_l.yaml\"\n",
"sam2_checkpoint = \"../checkpoints/sam2.1_hiera_large.pt\"\n",
"model_cfg = \"configs/sam2.1/sam2.1_hiera_l.yaml\"\n",
"\n",
"sam2_model = build_sam2(model_cfg, sam2_checkpoint, device=device)\n",
"\n",