Skip to content

Latest commit

 

History

History
59 lines (47 loc) · 1.44 KB

README.md

File metadata and controls

59 lines (47 loc) · 1.44 KB

sam_topo

Segment anything model for topographic data

  • easy to costumize: matplotlib-based GUI
  • Segment everything first and then interactive segmentation for individual masks

Installation

Please follow the instructions to install segment-anything: https://github.com/facebookresearch/segment-anything.git

Install sam_topo:

git clone https://github.com/ZhiangChen/sam_topo.git
cd sam_topo
pip install .

Run

  1. Run GUI for interactive segmentation
python3 gui.py
  1. Use the sam_topo library
from sam_topo.gui import SAM_Topo_GUI
sam_topo_gui = SAM_Topo_GUI(img_path='../data/data/sample_data/beach_hillshade_grayscale.png', 
                            sam_checkpoint = "../data/models/sam_vit_h_4b8939.pth", 
                            model_type = "vit_h", 
                            is_cuda=True)
  1. Tiff data preprocessing: SAM requires RGB images. sam_topo.preprocessing provides functions to convert tiff data to color or grayscale images.

Demo

  1. Segment everything
  1. Visualize individaul mask
  1. Delete masks
  1. Modify individaul mask
  1. Jupyter notebook option (preview)