Giter Site home page Giter Site logo

segment-anything-webui's Introduction

Segment Anything web UI

demo

This is a web interface for the Segment Anything.

Usage

Environment Require: Python >= 3.8.13, Node >= 18.15.0 (LTS), CUDA(optional)

  1. Fowllow the instructions in the Segment Anything to install
# e.g.
pip install git+https://github.com/facebookresearch/segment-anything.git
pip install opencv-python pycocotools matplotlib onnxruntime onnx

mkdir model
# download the model to `model/`
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth -O model/sam_vit_b_01ec64.pth
# https://dl.fbaipublicfiles.com/segment_anything/sam_vit_l_0b3195.pth
# https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth
  1. Install the webui dependencies:
# python server as backend
pip3 install torch numpy 'uvicorn[standard]' fastapi pydantic python-multipart Pillow click
# or 
cd script && pip3 install -r requirements.txt
# webui frontend
npm i
  1. run the server:
python3 script/server.py
  1. run the webui:
npm run dev

Advanced

Change the .env.local file to change the server address.

The model server can be run on a remote GUI server, and the webui can be run on a local machine.

The API in server.py is lambda function. Though it is slow (Encoding Image Each Request), it is easy to deploy.

Upload Image on

TODO

  • Pre extract image features
  • Frontend onnx inference
  • Add CLIP for text Prompt
  • Better compress for mask matrix

Reference

License

MIT

segment-anything-webui's People

Contributors

kingfish404 avatar

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.