Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Release Google Colab of demo #115

Open
chadrs2 opened this issue Dec 7, 2024 · 1 comment
Open

Release Google Colab of demo #115

chadrs2 opened this issue Dec 7, 2024 · 1 comment

Comments

@chadrs2
Copy link

chadrs2 commented Dec 7, 2024

I've been trying to run the following example code in Google Colab, but I keep dealing with dependency issues or failures to install detectron2. Any suggestions or advice?

!pip install torch==1.13.1 torchvision==0.14.1 --extra-index-url https://download.pytorch.org/whl/cu113
!pip install -v git+https://github.com/MaureenZOU/detectron2-xyz.git 
!pip install git+https://github.com/cocodataset/panopticapi.git
!git clone https://github.com/UX-Decoder/Semantic-SAM

!python -m pip install -r Semantic-SAM/requirements.txt

!wget -O swint_only_sam_many2many.pth https://github.com/UX-Decoder/Semantic-SAM/releases/download/checkpoint/swint_only_sam_many2many.pth
import sys
sys.path.append('/content/Semantic-SAM')

from semantic_sam import prepare_image, plot_results, build_semantic_sam, SemanticSamAutomaticMaskGenerator
original_image, input_image = prepare_image(image_pth='examples/dog.jpg')  # change the image path to your image
mask_generator = SemanticSamAutomaticMaskGenerator(build_semantic_sam(model_type='T', ckpt='swint_only_sam_many2many.pth')) # model_type: 'L' / 'T', depends on your checkpint
masks = mask_generator.generate(input_image)
plot_results(masks, original_image, save_path='../vis/')  # results and original images will be saved at save_path
@EladWarshawsky
Copy link

I second your request. The install has been nightmarish. I am working on getting poetry to install with a better toml file etc. but no dice.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants