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).