Code Monkey home page Code Monkey logo

refsam's Introduction

RefSAM

This repository is for evaluating the basic performance of SAM on the Referring Image Segmementation task. Check out the SAM project here.

The Naive Zero Shot Approach

The very basic approach we use is to:

  1. Produce a referring expression representation using the CLIP language transformer.
  2. Extract SAM masks from an image.
  3. Embed the masked sections into a CLIP model to produce a representation of the section.
  4. Compare the masked section representation to the representation of the referring expression.

The code for the approach can be found in model.py

Setup

Install SAM

    pip install git+https://github.com/facebookresearch/segment-anything.git

Load the SAM model in the pretrained/ folder

I used the sam_vit_h_4b8939.pth model from the SAM repository. It can be found here

Load the data

Follow the directions in prepare_dataset.md to download and setup the evaluation dataset.

Run the evaluation

To evaluate the approach run.

    python evaluate_on_refcoco.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.