Nomination-NRB / SAM-webui

segment anything webui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SAM-webui

News

  • Release code
  • Add brush and eraser tool
  • Add save type dropdown menu
  • Add mask_kernel in getting mask (The default value is 0, and expansion is not performed)
  • Add White Masks (Using the white mask in stable diffusion inpainting)
  • Add Compose Masks (The mask splices the corresponding map together to facilitate the corresponding mask and the original image)

TODO List

  • Save current masks
  • Zoom in and zoom out
  • Brush tool and eraser tool
  • Save masks in coco format

Features

  • Preview Images
  • Multi-View Switch
  • SAM Point Segmentation
  • SAM Box Segmentation
  • SAM Auto Segmentation (Inference without prompt)
  • Undo (ctrl+z)
  • Clear (c)
  • Save Masks (ctrl+s)
  • Mouse wheel to zoom in / out
  • Find shortcuts when mouse hovering on buttons!
  • Press ctrl to drag the zoomed image
  • Press alt to change the brush to eraser

Install

The code requires python>=3.8, as well as pytorch>=1.7 and torchvision>=0.8. Please follow the instructions here to install both PyTorch and TorchVision dependencies. Installing both PyTorch and TorchVision with CUDA support is strongly recommended.

We have tested: Python 3.8 pytorch 2.0.0 (py3.8_cuda11.7_cudnn8.5.0_0) torchvision 0.15.0

git clone https://github.com/Nomination-NRB/SAM-webui.git
cd SAM-webui; pip install -e .
pip install opencv-python pycocotools matplotlib onnxruntime onnx flask flask_cors

Model Checkpoints

You can download the model checkpoints here.

Run

MODEL_TYPE: vit_h, vit_l, vit_b

python app.py --model_type vit_h --checkpoint ../models/sam_vit_h_4b8939.pth

If you want to run on cpu,

python app.py --model_type vit_h --checkpoint ../models/sam_vit_h_4b8939.pth --device cpu

Credits

About

segment anything webui

License:Apache License 2.0


Languages

Language:Python 63.3%Language:HTML 24.0%Language:JavaScript 12.8%