Scene Separation & Data Selection: Temporal Segmentation Algorithm for Real-time Video Stream Analysis

Yuelin Xin, Zihan Zhou, Yuxuan Xia

Abstract

This paper introduces 2SDS (Scene Separation and Data Selection), a lightweight, non-neural temporal segmentation algorithm designed to bridge the gap between static image recognition and continuous video analysis. By segmenting video streams into coherent "scenes" using an improved difference hash (dHash) method and selecting representative frames via Length Weighted Average Pooling (LWAP), 2SDS enables standard 2D CNNs to process temporal data efficiently in real-time. Experimental results demonstrate over 90% accuracy in standard video streams, offering a high-speed alternative to computationally intensive 3D CNNs and RNNs.

Introduction

While 2D Convolutional Neural Networks (CNNs) excel at identifying objects in static images, they struggle with the "continuity issue" in video. They treat video as a sequence of discrete, unrelated snapshots, losing vital temporal context such as motion. Existing solutions like 3D CNNs are computationally expensive for indefinite streams, while RNNs/LSTMs often introduce high latency, making them impractical for real-time applications like live surveillance.

2SDS seeks a middle ground: a non-neural implementation that groups adjacent, similar frames into scenes, preserving temporal information without the massive overhead of a fully neural temporal model.

Methods

The 2SDS algorithm operates in parallel with standard image recognition, acting as a "sidecar" that organizes data for the 2D CNN.

The 2SDS system architecture integrates scene separation and data selection alongside a standard CNN pipeline.

1. Scene Separation (The dHash Approach)

Instead of using a neural network to detect scene changes, 2SDS employs an improved dHash (difference hash) method to minimize computational load:

  • Downsampling & Grayscale: High-resolution frames (e.g., 3000px) are shrunk to an 8x9 grid and converted to grayscale to reduce complexity.
  • Hash Calculation: The algorithm compares adjacent pixels in each row. If the left pixel is brighter than the right, it assigns a '1'; otherwise, a '0'. This results in a 64-bit hash representing the frame's structure.
  • Hamming Distance: To find the difference between two frames, the algorithm performs a simple bitwise Exclusive Or (XOR) operation on their hashes. If the resulting "Hamming distance" exceeds a threshold (typically 5), a scene change is declared.
Preprocessing steps for dHash involve downsampling high-resolution frames to an 8x9 grid and converting them to grayscale.

2. Data Selection and Smoothing

Once a scene is identified, the algorithm must pick the most representative result from the frames within that scene using LWAP (Length Weighted Average Pooling). Inspired by CNN pooling layers, LWAP segments recognition data and calculates a weighted average to filter out noise like camera shakes. The algorithm then selects the frame whose feature intensity is closest to the weighted average of the entire scene.

Results and Discussion

The algorithm's performance was evaluated using a dataset derived from YouTube-VOS, categorized by visual complexity:

  • Interview Videos: Achieved 90.10% accuracy. The algorithm occasionally over-judged transitions due to the hard-coded sensitivity threshold.
  • Vibrant Videos: Accuracy dropped to 54.90%. Fast-moving sports and dynamic advertisements proved difficult for the dHash method to segment effectively.
  • Hybrid Videos: In long-form tests, the algorithm reached 99.06% accuracy, successfully detecting 105 out of 106 scenes.

Overall, the preliminary experiments yielded an accuracy of over 90%, proving the concept viable for standard video streams.

Conclusion and Future Work

2SDS provides a high-efficiency alternative for temporal segmentation by replacing the "slow pathway" of traditional video networks with mathematical heuristics. The primary limitation is the hard-coded Hamming distance threshold, which struggles with high-motion content. Future work will focus on implementing dynamic thresholds and integrating Graph Neural Networks (GNNs) to model spatial relationships between objects, allowing the system to understand not just that a scene changed, but how the objects within it interact.

Summary updated

BibTeX
@inproceedings{xin2022scene,
  author = {Yuelin Xin and Zihan Zhou and Yuxuan Xia},
  title = {{Scene Separation \& Data Selection: Temporal Segmentation Algorithm for Real-time Video Stream Analysis}},
  booktitle = {STRL @ IJCAI},
  year = {2022},
}
Figure