Skip to main content

Introduction

What are Keyframes?

Keyframes in video annotation are specific frames selected for annotation within a video file. Instead of annotating every frame, you can select key moments that represent important changes or events in the video.This approach:
  • Reduces annotation time and cost
  • Focuses on critical frames
  • Maintains annotation quality
  • Enables efficient video annotation workflows

Video Project Setup

Import Required Modules

Required Imports
Important: Keyframe operations are only available for video projects. The LabellerrProject class automatically detects video projects and provides these methods.

Adding or Updating Keyframes

KeyFrame Schema

Before adding keyframes, you need to understand the KeyFrame structure:
KeyFrame Structure

KeyFrame Parameters


Add or Update Keyframes

You can add new keyframes or update existing ones using the same method:
Add/Update Keyframes
Behavior:
  • If a keyframe with the same frame_number already exists, it will be updated
  • If the frame_number is new, a new keyframe will be added

Batch Keyframe Creation

You can efficiently add multiple keyframes at once:
Batch Keyframe Creation

Deleting Keyframes

Delete Specific Keyframes

Remove keyframes by specifying their frame numbers:
Delete Keyframes
Caution: Deleting keyframes also removes any annotations associated with those frames. This action cannot be undone.

Complete Workflow Example

End-to-End Keyframe Management

Complete Keyframe Workflow

Common Use Cases

Regular Interval Sampling

Select keyframes at regular intervals (e.g., every 30 frames) for consistent annotation coverage

Scene Change Detection

Use automated scene detection to identify keyframes at scene transitions

Event-Based Selection

Manually select keyframes at important events or actions in the video

Adaptive Sampling

Adjust keyframe density based on video content complexity

Best Practices

Keyframe Selection Guidelines

Optimal Keyframe Density

  • Low motion videos: 1 keyframe every 2-3 seconds
  • Medium motion videos: 1 keyframe every 1-2 seconds
  • High motion videos: 1 keyframe every 0.5-1 second
  • Critical events: Always include keyframes at important moments

Performance Considerations

  • Add keyframes in batches rather than one-by-one
  • Validate frame numbers before submission
  • Handle errors gracefully with try-except blocks
  • Consider video length and framerate when selecting intervals

Annotation Quality

  • Include keyframes that capture state changes
  • Ensure sufficient coverage for temporal tracking
  • Balance between annotation workload and quality
  • Review keyframe selection before starting annotation

Error Handling

Common Errors and Solutions

Error Handling Example

Common Issues


Advanced Usage

Custom Keyframe Selection Logic

Custom Keyframe Logic

Create Projects

Learn how to create video annotation projects

Retrieve Projects

Retrieve project information and file lists

Getting Started

SDK installation and initialization guide
For technical support, contact support@tensormatics.com