GSense Documentation
  • Welcome to GSense
  • Getting Started
    • Installation
    • Workflow
    • Features
  • Basics
    • Image loading and managing
      • Load images
      • Viewer
      • Layers
    • Spectral Indexing
    • Image Segmentation
      • Default models
      • Custom models
    • Annotation
    • Binarizer
    • Export
Powered by GitBook
On this page
  1. Basics
  2. Image Segmentation

Custom models

Using model checkpoints obtained from fine-tuning Segment Anything Model pretrained models on custom dataset.

PreviousDefault modelsNextAnnotation

Last updated 6 months ago

If you have your own SAM fine-tuned model checkpoint file (.pth) or would like to use one obtained from fine-tuning SAM's vit-b model with root images, follow these steps:

  1. Select Model Type:

    • In the Model Settings tab, select the model type (vit-h or vit-b) matching the model architecture of your custom checkpoint.

  2. Load the Custom Checkpoint:

    • Click on the Load Custom Checkpoint button.

    • A file dialog will appear; browse and select your checkpoint file (.pth format).

Make sure to choose 'Vit-b' model type with this custom model checkpoint.

Load the custom model checkpoint by clicking on the Load Custom Checkpoint button.

  1. Initialize the Model:

  • After loading the checkpoint, click the Initialize Model button.

  • A message box will confirm if the model initialization is successful.


Once the model is initialized, you can now run segmentation:

Prerequisites:

  • Ensure you have generated pseudo-RGB images using the Spectral Indexingtab.

  1. Run Segmentation:

    • Click the Run Segmentation button.

    All generated pseudo-RGB images of all loaded images will be processed. The segmentation may take some time, depending on the number of images and model complexity.

  2. View Results:

    Once segmentation is complete, the segmented masks will appear as additional layers in the viewer.

    • Each pseudo-RGB image will have its mask as a new layer. Select the Pseudo-RGB x-x button of choice to view its mask.

    • You can toggle the visibility of the layers using the Layer List dock (enable from the Layers button).

Using custom model comes with the option to use a threshold slider to control the generated mask. Tick the 'Threshold' checkbox to make the slider visible.

Video demo link to segment images with SAM ViT-b model checkpoint obtained from fine tuning with root images:

To use a model checkpoint obtained from fine-tuning SAM Vit-b model with , download the and move it to the 'ckpt' folder.

Ensure you have (either RGB or hyperspectral).

peanut and sweetcorn root images
custom checkpoint
loaded images