Code Monkey home page Code Monkey logo

samist's Introduction

SAMIST

Segment Anything Model (SAM) Image Segmentation Tool. A python GUI for image segmentation using SAM by Meta AI.

Installation

  1. Clone this repository and navigate into its directory
  2. Install dependencies, i.e. using pip install -r requirements.txt
  3. Download a model checkpoint from Meta AI:
  1. Run the script using python main.py

Usage

SAMIST utilizes PySimpleGui, and has no command line interface. The GUI looks like this when the program is started:

samist0

  • Use the 'Device' dropdown to select between CUDA and CPU execution. Note that CPU execution is significantly slower.
  • Select the 'Model Type' using the dropdown. Ensure that the model type you selected corresponds to the checkpoint you are using, or the program will hang.
  • Click 'Browse Model' to open up a system dialog and select the model path.
  • To the right of the 'Image File' textbox, select 'Browse' to load find an image, then press 'Load Image' to load it for segmentation. The image thumbnail will then appear in the GUI. The GUI looks like this after an image is loaded:

samist

  • Use the 'Points per side', 'Stability Score Threshold' and 'Prediction IOU Threshold' to set mask generation parameters. Experiment to find what works best for your application.
  • Click 'Segment Loaded Image' to begin image segmentation. This and the 'Load Image' button will be grayed out while segmentation is in progress. The GUI looks like this after image segmentation:

samist2

  • If one or more masks were generated using your parameter set, the 'Select Masked Image' slider will appear on the GUI. Drag it to select a mask for viewing and export. Position zero will show the original image.
  • There are three ways to export a mask using SAMIST, all of which will bring up the system dialog:
    1. 'Save Mask': This will save the full resolution greyscale mask to an image file.
    2. 'Save Masked Image': This will save a copy of the image with the mask applied to it, i.e. a full-resolution version of the masked image as it appears in the GUI.
    3. 'Save Cropped Image': This will save a copy of the image with the mask applied to it and crop it to contents.

Afterword

I hope you find this tool both useful and simple to use. Please let me know if you encounter any issues or have any suggestions. The Segment Anything Model was created by Meta AI and is licensed under the Apache 2.0 license.

samist's People

Contributors

dibrale avatar

Watchers

 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.