AI experiments
How I build it, what works and what remains unresolved.
A laboratory for explaining what I build
I share independent AI experiments: the question, implementation, measurements and remaining failures. The first two explore computer vision on a shopping-mall video. Their results describe that scene, not general product accuracy across cameras or environments.
01 · Table occupancy
Question: can video distinguish an occupied table from someone merely walking past?
I define table areas as polygons, segment people and objects, and track their trajectories. A rule combines time within a zone and limited movement to estimate occupancy.
From video to estimated occupancy
- SegmentYOLO26x-seg detects objects and silhouettes
- TrackByteTrack connects observations across frames
- AssociateCompare people with table zones
- MeasureEstimate occupancy and duration
Implementation
This experiment requires at least 1.5 seconds within a zone and average movement below 6 pixels per frame. A grace period prevents brief occlusions from immediately ending occupancy. These values are specific to this experiment.
# Pseudocode for the experimental rule.
if time_in_zone >= 1.5 and mean_movement < 6:
table_occupied = True
Chair counts fluctuated because of occlusions and camera movement. I retained silhouettes and moved furniture counts to the final summary, using a median. Visual stability still needs comparison with the actual scene.
02 · Counting, dwell time and reidentification
Question: how can I avoid counting someone repeatedly when tracking loses their trajectory?
The experiment defines crossing lines and a dwell zone. A tracker may assign a new identifier after an occlusion, so counting identifiers is not the same as counting people.
I use DINOv2 appearance vectors from body crops. Time, position and visual similarity help stitch compatible trajectory fragments. This is appearance-based reidentification within the scene; it does not assign names or use facial recognition.
Reconstructing a trajectory
- ObserveCollect tracking fragments
- RepresentExtract body appearance with DINOv2
- CompareCheck time, distance and similarity
- StitchJoin compatible fragments
Calibrating the comparison
The code samples similarity between trajectories overlapping in time and uses the 99th percentile as a reference. This is a heuristic: duplicate detections can contaminate those pairs. Joining also requires a limited time gap and a plausible movement distance.
Documented measurements
The evaluation recorded on October 17, 2026 compares variants on the same video:
| Measurement | Without reidentification | With reidentification | Manual reference |
|---|---|---|---|
| People stopping in the zone | 9 | 6 | 3–4 |
| Estimated mean dwell time | 13.4 s | 22.3 s | Approximately 35–40 s for the observed family |
The dwell reference concerns the family, not exhaustive labels for every visit. Reidentification reduces fragmentation but still overcounts. Line crossings lack complete manual validation. These are documented measurements, not a fresh evaluation or a general accuracy percentage.
Experiment structure
- Python, PyTorch and OpenCV: video processing and analysis.
- YOLO26x-seg and ByteTrack: segmentation and tracking.
- DINOv2: appearance representations for stitching.
- Detection caches: reuse inference while changing rules or visualization.
- Separate evaluation: compare counts with manual references.
Shared processing, table rules, people counting, reidentification and evaluation live in separate modules. I review individual frames before generating the video and final summary. Next steps include labeling crossings, reducing short-lived tracks and assessing posture changes.
The reference footage is by Joshua Miranda on Pexels, identified in the project as mall-3660928. This page shares methods and results without publishing footage, person crops, vectors or cache files.
From experiments to products
This space documents learning. El Empleado Juan presents commercial capabilities and value; here I explain these independent demos and their limitations.