AI and Automated Time Reporting: Turning Ideas into Innovation. Paper-Based Problem…
It all started with a conversation with my partner. She told me that at her workplace they still use paper reports to record their hours. They fill in their hours manually, send the reports to the head office, where someone then enters the data into an Excel document. Then it is sent to the payroll department, which compiles everything and creates payslips. When I heard this, I couldn’t help but think: “This has to be automated and made so much easier!”
With my background in Python, AI and databases, and a penchant for problem solving and inefficient processes, I saw this as the perfect challenge. Why not create a digital system where employees simply log in and out using facial recognition? No more paper handling, no incorrectly recorded hours and, above all, a smoother and fairer payroll process. That’s how the idea for my login system was born.
The Solution: A Facial Recognition Login System
I wanted to build a system where employees can identify themselves with their face instead of having to fill out forms or use cards. The camera scans their face, the system identifies them and records their login and logout automatically. All data is saved in a database in AWS, which is Amazon’s database Cloud service, and can be easily retrieved by the payroll administration without having to go through manual steps.
It was important for me to build a solution that was both secure, fast and easy to use. Employees would not have to do anything other than look into the camera, and everything would be handled automatically in the background. I also wanted the employer to be able to generate reports in an instant, instead of spending hours compiling data manually. I started by writing you a pseudocode which later became a small mind map, or rather a function map if you will, to better specify which functions were needed. After this, I checked out documentation and various libraries and then it was just a matter of coding.
How the System Works
The system is built in several steps. Only when you start the system do you see a box with a live video from the camera, the code detects if there is a face in the image and a green rectangle follows the face:
Then you register by pressing the register ”Register New User”, when you press the button the camera takes a picture and a new window pops up with the picture that the camera took and you have to fill in your details and you can also choose to take a new picture if you are dissatisfied I was quite happy with mine here 🙂
Then it’s done, now the picture is saved in the database and the code recognizes the face and you can log in and out and every time you do this, this information is recorded in the database as well as the time and date of logging in and out. You go back to the first box and now we press log in and viola!!
And again when logging out, the program recognizes the face:
Simply when they come to work and look into the camera, their face is compared to the stored images, and if a match is found, their login is recorded. The same thing happens when they go home and their logout is saved in the database. The system can be used for so much more than electronic locks or many other things where authentication is required.
To handle the interface, I have used Tinkter which I regret a little, PyQt5, is much better and less complicated but but live and learn. The camera is handled through OpenCV and the facial recognition is done using the face_recognition library. All interaction with the database is handled with MySQL, where each login and logout is saved in a table that can be exported if necessary.
To give an insight into how it works under the hood, we can take an example of facial recognition. When an employee looks into the camera, the image is analyzed and compared with the images in the database. If a match is found, their presence is recorded. This process happens lightning fast, and the only thing the user notices is a small confirmation message appearing on the screen.
In code, it works like this:
import face_recognition
def recognize_face(image_path, db_path):
known_faces = load_known_faces(db_path) # Hämtar lagrade ansiktsdata
unknown_image = face_recognition.load_image_file(image_path)
unknown_encoding = face_recognition.face_encodings(unknown_image)[0]
for name, known_encoding in known_faces.items():
results = face_recognition.compare_faces([known_encoding], unknown_encoding)
if results[0]:
return name # Returnerar identifierat namn
return "Unknown Person"
Benefits and Efficiency
The biggest benefit of this system is the time savings and cost efficiency. No more manual timesheet management, no miscalculations and no missed hours. Everything is recorded automatically and can be easily exported to the payroll system. This not only saves time for payroll administration but also for employees, who do not have to bother with manual logins and paperwork.
There is also an economic aspect. Having staff sitting around handling timesheets is an unnecessary cost when the process can be automated. Instead of someone manually entering data into Excel, everything happens in real time. The employer gets a clear overview of working hours and can ensure that everything is recorded correctly without the risk of mistakes or inaccuracies.
Lessons Learned and Future Development
This is just the beginning. I have already started thinking about how the system can be improved further. One of the things I want to implement is AI-based assessment of facial images to be able to identify attempts at cheating even better.
This project has been a fantastic challenge and a perfect opportunity to combine my passion for AI and automation with something that has real benefits in working life.
In today’s society this is not so remarkable most mobile phones are programmed to be able to use face recognition to unlock the phone for example. But it gave me such a great insight when I realized how this can be used practically.
A great challenge is to invent new technology but a perhaps greater one is to apply it to see how you can solve everyday problems and obstacles by applying the available technology and that is the great challenge in the coming years in AI.
During the journey I have learned a lot about computer vision and how a data can sense an image and perceive, computer vision has always been close to my heart for those of you who are interested in the subject, keep an eye out here on the blog because I will write about this in future blog posts.