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:
- Press E to enter Export Mode
- Press the format key:
- C for COCO format
- Y for YOLO format
- 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
-
Learn the basics first: Focus on mastering A (add annotation), X (clear selection), and S (save) for the most common workflow.
-
Navigation efficiency: Use N and P to quickly move through images without using the mouse.
-
Customize view: Toggle various view elements (M, B, L) based on your current task to reduce visual clutter.
-
Review workflow: Press R to enter review mode when you need to check your annotations without making accidental changes.
Example Workflows
Basic Annotation Workflow
- Navigate to an image (N/P)
- Create a selection (using mouse)
- Add the annotation (A)
- Repeat steps 2-3 for all objects
- Save work (S)
- Move to next image (N)
Review and Correction Workflow
- Enter review mode (R)
- Navigate through images (N/P)
- Exit review mode to make corrections (R again)
- Use undo/redo (Z/Y) to fix errors
- 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.