Skip to content

SAM Annotator Keyboard Shortcuts

This document provides a comprehensive guide to the keyboard shortcuts available in the SAM Annotator tool. These shortcuts help users navigate the interface and perform operations efficiently.

Basic Navigation

Action Shortcut Description
Quit Q Exit the application
Next Image N Navigate to the next image in the dataset
Previous Image P Navigate to the previous image in the dataset
Save S Save current annotations
Clear Selection X Clear the current selection
Add Annotation A Add the current selection as an annotation
Undo Z Undo the last action
Redo Y Redo the previously undone action
Clear All C Clear all annotations on the current image

View Controls

Action Shortcut Description
Toggle Masks M Show/hide segmentation masks
Toggle Boxes B Show/hide bounding boxes
Toggle Labels L Show/hide annotation labels
Toggle Points T Show/hide prompt points
Toggle View Controls V Show/hide view control panel
Toggle Review Mode R Enter/exit annotation review mode

Export Operations

SAM Annotator supports exporting annotations to various formats using a two-key sequence:

  1. Press E to enter Export Mode
  2. Press the format key:
  3. C for COCO format
  4. Y for YOLO format
  5. P for Pascal VOC format

Zoom Controls

Action Shortcut Description
Zoom In = Increase zoom level
Zoom Out - Decrease zoom level
Reset Zoom 0 Reset zoom to 100%

Annotation Opacity Controls

Action Shortcut Description
Increase Opacity ] Make annotations more opaque
Decrease Opacity [ Make annotations more transparent

Function Keys

Action Shortcut Description
Help F1 Show help information
Save View Settings F2 Save current view configuration
Load View Settings F3 Load saved view configuration

Using Shortcuts Effectively

Tips for Efficient Annotation

  1. Learn the basics first: Focus on mastering A (add annotation), X (clear selection), and S (save) for the most common workflow.

  2. Navigation efficiency: Use N and P to quickly move through images without using the mouse.

  3. Customize view: Toggle various view elements (M, B, L) based on your current task to reduce visual clutter.

  4. Review workflow: Press R to enter review mode when you need to check your annotations without making accidental changes.

Example Workflows

Basic Annotation Workflow

  1. Navigate to an image (N/P)
  2. Create a selection (using mouse)
  3. Add the annotation (A)
  4. Repeat steps 2-3 for all objects
  5. Save work (S)
  6. Move to next image (N)

Review and Correction Workflow

  1. Enter review mode (R)
  2. Navigate through images (N/P)
  3. Exit review mode to make corrections (R again)
  4. Use undo/redo (Z/Y) to fix errors
  5. Save changes (S)

Customizing Shortcuts

Shortcuts can be customized by modifying the shortcuts.py file in the configuration directory. The default location is:

sam_annotator/config/shortcuts.py

To customize shortcuts, edit the SHORTCUTS and FUNCTION_SHORTCUTS dictionaries in this file.

Example of customization:

# Changing 'next_image' from 'n' to 'right arrow'
SHORTCUTS = {
    # ... other shortcuts ...
    'next_image': 'Right',  # Changed from 'n'
    # ... other shortcuts ...
}

Note: After customizing shortcuts, restart the application for changes to take effect.