- 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)
- Save current masks
- Zoom in and zoom out
- Brush tool and eraser tool
- Save masks in coco format
- 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
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
You can download the model checkpoints here.
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
- Segment-Anything - https://github.com/facebookresearch/segment-anything