LeanScene - ultra-lightweight AI model for finding video cuts
2 min read
LeanScene by developer lucaspy is a compact model with only 0.39M parameters that automatically detects scene boundaries in videos: hard cuts, dissolves, and fades. It outputs exact frame ranges for each shot along with a list of transitions containing their types and probabilities. With a weight size of just 1.6 MB, the AI model outperforms the popular TransNet V2 model in quality across all three test datasets while requiring 115 times fewer computational operations (MACs) per frame. The tool is useful for video editors, video analytics system developers, and anyone preparing datasets from long videos.
Key features
- Weighs only 1.6 MB (0.39M parameters) and requires 7.2M MACs (multiply-accumulate operations) per frame.
- Outperforms TransNet V2 on the F1 metric across the BBC Planet Earth, ClipShots, and RAI benchmarks.
- Runs locally without loading weights at runtime: models are already embedded in ready-to-use Python and Node.js packages.
- Available in ONNX format (two graphs for feature extraction and temporal head), enabling it to run directly in the browser without sending videos to a server.
What you can do
- Automatically split long videos into separate scenes when preparing datasets for training video models.
- Integrate cut detection into a Python script or Node.js service for indexing and analyzing video archives.
- Check your video's markup right in a browser tab via the author's web demo without uploading files to the cloud.
Example
import leanscene
result = leanscene.detect("video.mp4")
result.shots # [(0, 343), (344, 2403), ...]
result.transitions # [Transition(start=344, end=344, kind='cut'), ...]
result.probs # (frames, 3) float32: same, cut, fadeRead more
DetailsBenchmarks (F1, average over 5 seeds): BBC Planet Earth - 97.4 (vs. 96.1 for TransNet V2), ClipShots - 79.1 (vs. 77.7), RAI - 93.7 (vs. 92.6).
Weights in the repository (one of the seeds): 97.45 / 78.82 / 93.03.
Limitations: The Python package decodes video via OpenCV, so timings may shift on variable frame rate (VFR) files, although frame indices remain accurate.
License: MIT.










Comments