Documentation

AI Segmentation Plugin

Complete guide to install and use the TerraLab AI Segmentation plugin powered by Meta's Segment Anything Model (SAM).

1Install QGIS

QGIS is a free and open-source geographic information system. The AI Segmentation plugin is compatible with any QGIS version 3.x or above.

Download QGIS from the official website and follow the installation instructions for your operating system:

Download QGIS

2Install & Activate Plugin

Download the plugin as a ZIP file, extract it to your QGIS plugins folder, and activate it.

2.1 — Download the Plugin ZIP

Click the button below to download the plugin as a ZIP archive:

Download ZIP

2.2 — Open Your Plugins Folder

Navigate to your QGIS plugins directory based on your operating system:

%APPDATA%\QGIS\QGIS3\profiles\default\python\plugins

2.3 — Extract the Plugin

Drag and drop the downloaded ZIP file into the plugins folder, then unzip it. Make sure the folder is named QGIS_AI-Segmentation-main or rename it to ai_segmentation.

2.4 — Activate in QGIS

Open QGIS and enable the plugin:

  1. Go to Plugins → Manage and Install Plugins
  2. In the Installed tab, find "AI Segmentation"
  3. Check the box to enable the plugin
  4. The plugin icon will appear in your toolbar

3Install Python Dependencies

3.1 — Required Packages

The plugin requires the following Python packages to run:

torchsegment-anythingrasteriopandasnumpy

3.2 — Automatic Installation

When you first launch the plugin, it will automatically install these dependencies in QGIS's Python environment (separate from your system Python). The installation may take a few minutes (~2GB for PyTorch).

If you encounter any issues during this step, please contact us:

Need help? Contact us

4Newsletter Signup

After the initial setup, a popup will appear asking for your email address. This is optional but highly recommended.

Stay updated: Subscribe to receive notifications about new features, bug fixes, and important updates to the plugin. You can unsubscribe at any time.

5Install SAM Model

5.1 — Automatic Download

The plugin uses Meta's Segment Anything Model (SAM) for AI-powered segmentation. The model will be automatically downloaded when you first use the plugin.

5.2 — Model Storage Location

Models are stored in the following location:

C:\Users\<username>\.qgis_ai_segmentation\checkpoints\
Learn more about SAM

6Select Raster Image

6.1 — Supported Format

The plugin works with GeoTIFF format raster images. Select your raster layer from the dropdown in the plugin interface.

Supported format

GeoTIFF (.tif, .tiff)

6.2 — Limitations

Image size: Large or high-resolution images are not supported at this time. Please use smaller image tiles for best results.

7Segmentation Workflow

Use the segmentation tool to identify objects in your raster image, then save them as vector polygons.

7.1 — Place Points

The segmentation tool uses positive and negative points to identify and refine the area you want to segment.

Positive Point

Click to select areas you want to include in the segmentation.

Negative Point

Click to exclude areas that were incorrectly selected by positive points.

Tip: Use negative points to refine your selection when the model includes unwanted areas. This iterative approach helps achieve precise segmentation results.

7.2 — Add Polygons

Once you're satisfied with a segmentation, click "Add Polygon" to save it. You can add multiple polygons before exporting.

Note: The "Add Polygon" button stores the polygon temporarily in memory. It does not create a new layer yet.

7.3 — Save as Layer

When you're done adding polygons, click "Save as Layer" to export them as a vector layer.

Export format

GeoPackage (.gpkg)

Modern, open format recommended for vector data in GIS.

The saved layer will appear in your QGIS Layers panel and can be styled, edited, or exported to other formats.

8Support Us

Help us grow!

The best way to support TerraLab is to rate our plugin on the official QGIS catalog, test it on your projects, and share it with your colleagues and the GIS community.

Rate on QGIS Plugins