Docilis Labs
DOCILIS SYSTEMS // INITIALIZING
Docilis Labs Logo
Computer Vision / Edge EngineeringJuly 2026~4 min read

Lab Notes - Teaching AI Object Permanence & Motion

How we eliminated the Ping-Pong bug using ByteTrack spatial association and Exponential Moving Average temporal smoothing.

LT
Luke Tsalwa
Founder & Lead Researcher

Picture setting your mug down next to your laptop. If you glance back and forth between them, your brain instantly recognizes that both objects are sitting still. You don't re-identify them as "new objects" every time your eye moves.

When processing raw video frames through lightweight edge AI, however, models can lack this basic sense of permanence. During early testing of DVIE v1, we encountered what we nicknamed the **"Ping-Pong Oscillation Bug."**


The Ping-Pong Bug & How We Solved It

In v1, detection was evaluated frame-by-frame. If the camera saw a person and a chair simultaneously, slight variations in frame confidence caused the system to flip back and forth between labels every 50 milliseconds. The audio engine would get stuck in a loop: *"Person... Chair... Person... Chair..."*

To a visually impaired user, this creates overwhelming auditory noise.

1. Persistent Spatial Memory (ByteTrack)

In DVIE v1.5, we decoupled raw detection from spatial memory by integrating persistent multi-object tracking (`bytetrack.yaml`).

Instead of treating every video frame as a brand-new world, DVIE v1.5 assigns persistent tracking IDs to objects (e.g., *Track ID #14: Person*, *Track ID #18: Bench*).

Coupled with a per-track cooldown dictionary, the engine remembers what it has already told you. Once a hazard is announced, it enters a **5-second cooldown timer**. It tells you about the obstacle once, and then remains intelligently silent while tracking its position in the background.


2. Filtering Camera Jitter with EMA Motion Smoothing

Another challenge in wearable AI is natural human movement. When you walk, your head subtly bobs up and down. To a raw camera model, a static table can appear to rapidly grow and shrink, triggering false alarms like *"Warning: Table approaching!"* when you are standing completely still.

To solve this, we implemented **Exponential Moving Average (EMA)** height filtering to smooth out frame-to-frame noise:

$$H_{\text{smoothed}} = (\alpha \times H_{\text{current}}) + ((1 - \alpha) \times H_{\text{prev}})$$

Using an alpha factor ($\alpha = 0.35$), DVIE v1.5 smooths out single-frame camera bounces:

SOURCEUTF-8 // DOCILIS_DVIE
Raw Frame Heights:  [ 120px -> 145px -> 118px -> 140px ]  (Noisy / False Alarms)
Smoothed EMA Graph: [ 120px ---- 124px ---- 125px ---- 127px ]  (Stable Baseline)

Now, an object is only flagged as "Approaching" if its smoothed bounding box consistently expands by more than 15% across consecutive frames.

By layering simple, robust mathematics over neural models, we turned erratic visual data into calm, reliable guidance.
TAGS:#ByteTrack#EMA Smoothing#Ping-Pong Bug#Spatial Memory

// OTHER LAB DISPATCHES