Skip to content

OpenTopography/Segment_Anything_Model_Topography

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NSF-1948857

Segment Anything Model for Topography Data (SAM_TOPO)

Segment Anything is an image segmentation model developed by Meta AI. It is designed to reduce the need for custom data annotation, training compute, and task-specific modeling expertise.

SAM for Topography data (SAM_TOPO) is a Graphical User Interface (GUI) program backed by Meta’s Segment Anything Model (SAM) to offer interactive segmentation capacities on topography datasets.

Features:

  • easy to customize 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/OpenTopography/Segment_Anything_Model_Topography.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)

Citation

@article{chen2023segmenting,
  title={Segmenting geologic landforms using zero-shot deep learning and lidar topography},
  author={Chen, Zhiang and Scott, Chelsea and Schwarz, Madeline F and Johnstone, Sam and Crosby, Christopher J and Arrowsmith, Ramon},
  journal={AGU23},
  year={2023},
  publisher={AGU}
}

https://agu.confex.com/agu/fm23/meetingapp.cgi/Paper/1352775

Meta AI Segment Anything

@article{kirillov2023segany,
  title={Segment Anything},
  author={Kirillov, Alexander and Mintun, Eric and Ravi, Nikhila and Mao, Hanzi and Rolland, Chloe and Gustafson, Laura and Xiao, Tete and Whitehead, Spencer and Berg, Alexander C. and Lo, Wan-Yen and Doll{\'a}r, Piotr and Girshick, Ross},
  journal={arXiv:2304.02643},
  year={2023}
}