Skip to content
Back to skills

Frame Prediction Averaging

ASecurity

Average per-frame sigmoid predictions across sampled video frames to produce a stable video-level classification probability

  • 61 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
toolspythongit

Works with

  • cli

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill frame-prediction-averaging --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Frame Prediction Averaging?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Frame Prediction Averaging
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-frame-prediction-averaging/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-frame-prediction-averaging)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cv-frame-prediction-averaging
description: Average per-frame sigmoid predictions across sampled video frames to produce a stable video-level classification probability
---

# Frame Prediction Averaging

## Overview

Video classification models often process individual frames independently. Averaging the sigmoid outputs across all sampled frames reduces noise from individual frame variability (occlusion, motion blur, detection failures) and produces a more stable video-level prediction. This is simpler and often competitive with temporal models like LSTMs for binary classification tasks.

## Quick Start

```python
import torch
import numpy as np

def predict_video(model, frames, device="cuda"):
    model.eval()
    batch = torch.stack(frames).to(device)
    with torch.no_grad():
        logits = model(batch).squeeze()
        probs = torch.sigmoid(logits)
    return probs.mean().item()

# frames: list of N preprocessed tensors from sampled video frames
video_prob = predict_video(model, face_tensors)
```

## Workflow

1. Sample N frames from the video (typically 15-20)
2. Extract and preprocess face crops from each frame
3. Run each frame through the classifier to get sigmoid probabilities
4. Average all per-frame probabilities for the final video-level score
5. Optionally clip to [0.05, 0.95] to avoid extreme predictions from single-frame errors

## Key Decisions

- **Averaging vs. max**: mean is robust to outliers; max captures the single most suspicious frame (higher recall, lower precision)
- **Weighted average**: weight frames by face detection confidence to downweight low-quality detections
- **Frames with no face**: exclude from average rather than using a default value
- **Clipping**: clip final probability to [0.01, 0.99] to avoid log-loss penalties from extreme values
- **vs. temporal models**: averaging ignores frame order but is more robust with limited training data

## References

- [Inference Demo](https://www.kaggle.com/code/humananalog/inference-demo)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.