Resource-efficient fog computing vision system for occupancy monitoring: A real-world deployment in university libraries
Alejandro Santos Martinez-Sala, Lucio Hernando-Cánovas, Juan Carlos Sánchez-Aarnoutse, Juan José Alcaraz · Internet of Things · 2025
This paper presents a fog computing system for real-time occupancy monitoring across three university libraries, using ceiling-mounted, top-view cameras positioned above each entrance. Video streams from low-cost cameras are securely transmitted to a fog server deployed within the university’s intranet. Top-view person tracking ensures privacy compliance by inherently eliminating facial recognition, but introduces challenges such as non-standard human appearance, occlusions, and lighting variations. For person detection, we employ a YOLOv5 model initially trained on top-view human annotations, further refined through transfer learning using a curated dataset from the three libraries. The system features a two-stage processing pipeline. First, a lightweight background subtraction algorithm filters frames with potential motion, which are queued via RabbitMQ for sequential processing. Second, a People Flow Counting module applies the optimized YOLOv5 model to detect and count individuals in each frame, followed by a custom tracking algorithm and virtual line-crossing logic to ensure accurate flow tracking. Each library is handled independently through a batch processing approach, updating occupancy estimates with bounded delay using a single CPU-only fog server. This architecture maintains low latency while avoiding server overload and minimizing energy use. The system has been in continuous production for over twelve months, demonstrating reliable performance across all three libraries on commodity hardware. Quantitative evaluation confirms 94% accuracy in people flow detection, validating the system’s robustness, scalability, and practical utility for long-term, privacy-preserving deployment in smart campus environments.