It can be done in different ways. I'll give you few suggestions and you pick up as per your need

Fix the camera in a way like only those people, who exit the room will be recorded
If you want to save and record those data , you can have ID card detection with matching face

If you explain it some more deep I'll suggest some other ways
I have an emergency door that individuals should only be exiting from, so I'm trying to think of ways to use computer vision with python to identify if someone entered through it. I've found posted discussing tracking individuals and object detection, but I can't find anything on entering or exiting a door. Any suggestions/guidance would be greatly appreciated.
Python identify if someone entered a door from a video feed