-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tamar Rott Shaham
committed
Aug 14, 2024
1 parent
8b489eb
commit 43cbf65
Showing
13 changed files
with
5,347 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "synthetic-neurons-dataset/Grounded-Segment-Anything"] | ||
path = synthetic-neurons-dataset/Grounded-Segment-Anything | ||
url = https://github.com/IDEA-Research/Grounded-Segment-Anything.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"mono": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], "or": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], "and": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]} |
Submodule Grounded-Segment-Anything
added at
2b1b72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Setup Instructions for Synthetic Neurons | ||
|
||
## To set up the synthetic neurons: | ||
|
||
1. **init Grounded-SAM submodule** | ||
``` | ||
git submodule init | ||
git submodule update | ||
``` | ||
|
||
2. **Follow the setup instructions on Grounded-SAM setup:** | ||
- Export global variables (choose whether to run on CPU or GPU; note that running on CPU is feasible but slower, approximately 3 seconds per image): | ||
```bash | ||
export AM_I_DOCKER=False | ||
export BUILD_WITH_CUDA=True | ||
export CUDA_HOME=/path/to/cuda-11.3/ | ||
``` | ||
- Install Segment Anything: | ||
```bash | ||
python -m pip install -e segment_anything | ||
``` | ||
- Install Grounding Dino: | ||
```bash | ||
python -m pip install -e GroundingDINO | ||
``` | ||
- Install diffusers: | ||
```bash | ||
pip install --upgrade diffusers[torch] | ||
``` | ||
- Install osx: | ||
```bash | ||
git submodule update --init --recursive | ||
cd grounded-sam-osx && bash install.sh | ||
``` | ||
|
||
3. **Download grounded DINO and grounded SAM .pth files** | ||
- Download groudned DINO: | ||
```bash | ||
cd .. #back to ./Grounded_Segment-Anything | ||
#download the pretrained groundingdino-swin-tiny model | ||
wget https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth | ||
``` | ||
- Download grounded SAM: | ||
```bash | ||
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth | ||
``` | ||
- Try running grounded SAM demo: | ||
```bash | ||
export CUDA_VISIBLE_DEVICES=0 | ||
python grounded_sam_demo.py \ | ||
--config GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py \ | ||
--grounded_checkpoint groundingdino_swint_ogc.pth \ | ||
--sam_checkpoint sam_vit_h_4b8939.pth \ | ||
--input_image assets/demo1.jpg \ | ||
--output_dir "outputs" \ | ||
--box_threshold 0.3 \ | ||
--text_threshold 0.25 \ | ||
--text_prompt "bear" \ | ||
--device "cpu" | ||
``` |
Oops, something went wrong.