Lucas Jackson commited on
Update from github.com/lucasjacks0n/LeanScene@f3f307c
Browse filesFiles changed (6)
- LICENSEAdded+21
- README.md+98
- leanscene.ptAdded+3
- onnx/features.onnxAdded+3
- onnx/head.onnxAdded+3
- onnx/meta.jsonAdded+11
123456789101112131415161718192021MIT License
Copyright (c) 2026 Lucas Jackson
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.123---license: mit---123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101---license: mitpipeline_tag: video-classificationtags:- shot-boundary-detection- shot-transition-detection- scene-detection- video- onnx- pytorch---# LeanSceneA 0.39M-parameter network that finds shot transitions (cuts, dissolves, fades) in video.It scores higher than TransNet V2 on all three of that model's benchmarks, with 115x feweroperations per frame.- **Try it in your browser:** <https://lucasjackson.dev/leanscene/>. Drop a video and see everytransition on a timeline. It runs in the tab; nothing is uploaded.- **Code, training and evaluation:** <https://github.com/lucasjacks0n/LeanScene>## Results| | BBC Planet Earth | ClipShots | RAI | Parameters | MACs per frame ||---|---|---|---|---|---|| TransNet V2 | 96.1 | 77.7 | 92.6 | 7.62 M | 832 M || **LeanScene** (mean of 5 seeds) | **97.4** ± 0.1 | **79.1** ± 0.2 | **93.7** ± 0.5 | **0.39 M** | **7.2 M** || The weights in this repository (one of the 5 seeds) | 97.45 | 78.82 | 93.03 | | |F1 over transitions with TransNet V2's own protocol (two-frame tolerance). Both models are runthrough the same decoding and scoring code, and LeanScene's decision rule was fixed before thetest sets were scored. The GitHub README has the fine print.## Use itThe weights ship inside the packages, so the usual way to use the model is to install one ofthem; nothing is downloaded at run time.```sh# Pythonpip install git+https://github.com/lucasjacks0n/LeanSceneleanscene video.mp4# Node.jsnpm install leanscenenpx leanscene video.mp4``````pythonimport leansceneresult = leanscene.detect("video.mp4")result.shots # [(0, 343), (344, 2403), ...] inclusive frame ranges, 0-basedresult.transitions # [Transition(start=344, end=344, kind='cut'), ...]result.probs # (frames, 3) float32: same, cut, fade``````tsimport { detect } from "leanscene";const { shots, transitions } = await detect("video.mp4");```A cut is reported on the first frame of the new shot. A gradual transition is the run offrames inside it, and those frames belong to neither neighbouring shot.## Files| File | What it is ||---|---|| `leanscene.pt` | The PyTorch checkpoint the Python package bundles (1.6 MB). Load it with `leanscene.load_model("leanscene.pt")` or `leanscene --model leanscene.pt` || `onnx/features.onnx` | The per-frame network as ONNX: 100x100 frames in, features out || `onnx/head.onnx` | The temporal head as ONNX: features in, per-frame probabilities (same, cut, fade) out || `onnx/meta.json` | What the two graphs need around them: input size, feature width, histogram bins, and the decision rule (cut >= 0.7, fade >= 0.8, fade runs closed over gaps of <= 8 frames) |The two ONNX graphs are the ones the Node.js package and the browser demo run. The colourhistogram that sits between them is computed outside the graphs; the Node.js package's sourceshows how the pieces fit together.## Training dataA mix of synthetic transitions made from single-shot clips, hand-labeled YouTube videos, andClipShots. The single-shot clips are not distributed, so these exact weights cannot beretrained; the training code and the labels are in the GitHub repository.## Limits- The Python package decodes with OpenCV. Times are frame index divided by the container'sframe rate, so they drift on variable-frame-rate files; frame indices are exact.- Scores are for the three benchmarks above. Other kinds of footage were not measured.## CitationThe paper is in preparation. Until then:```Lucas Jackson. LeanScene: A 0.39M-Parameter Network for Fast Shot Transition Detection.https://github.com/lucasjacks0n/LeanScene```MIT license.
123version https://git-lfs.github.com/spec/v1oid sha256:b0d1cc2a77f8aa91d0e27868734bd8da621cd62dbaf701fb6979558ee03f4730size 1603123123version https://git-lfs.github.com/spec/v1oid sha256:b4718ff9f153f9c377d25ca27846da4bdd6a6a0b0e84fd9a58a1ed4fc822cee5size 279293123version https://git-lfs.github.com/spec/v1oid sha256:a064baae28e72c4f8a8eb5e0dfc8449ffeb8ef1dad2968bca4edb72b723b9b41size 13086251234567891011{ "checkpoint": "leanscene", "dim": 896, "feat": 128, "size": 100, "histBins": 4, "receptiveField": 63, "cut": 0.7, "fade": 0.8, "close": 8}LICENSEAdded+21
README.md+98
leanscene.ptAdded+3
onnx/features.onnxAdded+3
onnx/head.onnxAdded+3
onnx/meta.jsonAdded+11