how i saved the police force hours of work daily using artificial intelligence

Tejas
Becoming Human: Artificial Intelligence Magazine
5 min readJul 26, 2021

--

I would like to preface all of this by saying that there are certain details and procedures I will not be able to reveal, due to it being classified and as a result, my explanation may not be as coherent as I would like it to be. It’s going to be a long one, so bear with me yea?

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 regard 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 and renewing the road tax for every vehicle. There would be periods where we would receive hundreds of vehicles a day to renew, and there was an SOP to follow for the renewal of every vehicle. Mind you, this could easily take a dedicated team of officers a few days to renew and to follow through on the appropriate actions. The process involved mindless entering of fields, clicking buttons, and 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 my head.

Next-generation Fast Response Car

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, and 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.

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

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

The architecture of the ConvNet i used, with a dropout layer added.

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!

--

--