segment-anything-with-clip  by Curt-Park

Segmentation pipeline combining Segment Anything Model (SAM) with CLIP

created 2 years ago
345 stars

Top 81.4% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This project integrates Meta's Segment Anything Model (SAM) with OpenAI's CLIP to enable text-based image segmentation. It addresses the current limitation of SAM's text prompt functionality by leveraging CLIP to match text descriptions with object proposals generated by SAM, making it useful for researchers and developers working with multimodal vision-language tasks.

How It Works

The approach first generates all object proposals using SAM. These proposals are then cropped, and their features are extracted using CLIP. By calculating the similarity between these image features and a query text feature (also from CLIP), the system can identify and segment objects that best match the provided text prompt. This method effectively bridges the gap in SAM's text-prompting capabilities.

Quick Start & Requirements

  • Install and run via make env, conda activate segment-anything-with-clip, make setup, and make run.
  • Requires Anaconda.
  • Accessible via http://localhost:7860/.
  • Links: HuggingFace Space, Colab, Demo Video

Highlighted Details

  • Offers "Fast Segment Everything" for CPU-only environments, achieving comparable results to the original SAM with fewer inferences and under 10 seconds on an 8 vCPU/32GB RAM instance.
  • Includes examples for text, image, and drawing prompts using the Fast Segment Everything implementation.

Maintenance & Community

  • References official repositories for SAM and CLIP.

Licensing & Compatibility

  • No explicit license is mentioned in the README. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The project's licensing is not clearly defined, which may impact commercial adoption. While it offers CPU optimizations, performance details for GPU usage are not provided.

Health Check
Last commit

1 year ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
5 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.