Corporate answer: big, hairy proprietary algorithms. Startup answer: straight magic, yo. Real answer: manual for this week. We're doing a couple things that don't scale to validate a concept.
Total occupancy but larger spaces can be segmented however they might want (order line, dining, bathrooms, bar area, etc.) Just need to separate two sections with a sensor.
1 sensor... ingress = movement into one area out of an adjacent area. Simultaneously, that counts as an egress (that person having moved out of that adjacent area into the next).
For accurate, autonomous counting, we use this little guy -- https://s3.amazonaws.com/screenshots.angel.co/73/340163/7982...
We're gunning for city-wide, real-time movement.