During my mandatory 2 year conscription in the Police Force, I was appointed as an Operations Support Officer in the Force’s transport department. This department was concerned with all the transportation and vehicular needs of the Police Force. We had an insane amount of vehicles under our purview and it was our job to ensure that the day-to-day operations ran smoothly. (with regards to vehicles)
One of the job scopes of our department is to ensure that every police vehicle on the road has passed inspection and has valid road tax. However, the strength of the police vehicular fleet is in the order of thousands, and this meant spending hours in front of computers, renewing the road tax for each and every single vehicle. There would be periods where we would receive hundreds of vehicles a day to renew, and there was a standard SOP to follow for the renewal of each and every vehicle. Mind you, this could take up to a few days of the dedicated effort of a team of officers just to renew and further follow-up actions. The process involved mindless entering of fields, clicking buttons, updating the database, all of which did not require any human intuition. I spent the first few weeks in my job, doing it the old-fashioned way and i thought to myself, “why am I doing this, this could easily be automated”. That’s when a lightbulb went off in me.
So, I did exactly that. For the next few months, I laid out a timeline. From conducting research, defining specifications, finding the relevant tech stack that would best fit my requirements, drafting up the overall architecture, software development, testing, to user documentation, it was important to me that I had a clear road laid in front of me so I did not lose vision of the goal as I would often experience in previous projects.
As for the tech stack, I would use for this project, I came across many tools like Cypress and CasperJS, but i concluded that Selenium + Python stack was best for me. Selenium being fairly senior out of the libraries, provided the well-established documentation and firm community support that I needed. Working in a government organization, I could not afford to have bugs and situations where I couldn’t find the solution on StackOverflow, so Selenium it had to be.
1. Why Corporate AI projects fail?
2. How AI Will Power the Next Wave of Healthcare Innovation?
3. Machine Learning by Using Regression Model
4. Top Data Science Platforms in 2021 Other than Kaggle
After running the bot with a decently sized test case, I ran into a huge problem. Bot detection. I was blocked from using the website for a certain amount of time, and I obviously I couldn’t afford for that to happen as that would destroy the purpose of the bot. To circumvent this, I modified the bot to enter fields at random intervals and to not submit too many forms 📄 within a small period of time.
Soon enough, I ran into another problem. CAPTCHAs. One of the forms required the submission of CAPTCHAs. I tried packages like pytesseract and captcha-solver but it didn’t work for a multitude of reasons. Now, this is where my clickbait title actually becomes true. I decided to build a model implementing computer vision and CNN concepts, to solve the CAPTCHA in real-time. The model was written in Tensorflow 2.0, with OpenCV & Pillow. I trained the model using a few thousand images of CAPTCHA that I painstakingly labeled myself. Let’s just say I ripped off a bunch of hair that day.
Once that was done, all that was left was user documentation and improving the code. Making it idiot-proof was crucial because I wanted the office to continue using the bot even after I left the force. After a few months of working on the script, the results were outstanding. A usual batch of vehicles that we would need to process on a daily would take around 1 to 3 hours of a few officers. I managed to cut this number down to mere minutes. This was huge, it meant clearing up our schedule, leaving more time for police officers to spend on other important tasks. It took a while for everyone to get accustomed to the bot, but eventually, it made our jobs so so much easier!
If you made it this far, thank you for your time! I would love to hear some feedback about my writing so if you feel like if there are areas in which i could improve, let me know!