Over the past year, there has been a huge outcry over the state of policing throughout the United States. In light of the recent events at the US Capitol, people have voiced concerns about the stark differences in treatment of African Americans at Black Lives Matter protests and white Americans infiltrating the Capitol. Peaceful protests made up of African Americans were often met with unnecessary violence from the police while there was no retaliation to the more violent protests run by white Americans. These protests are just a small representation of a larger problem in the nation where minorities are disproportionately affected in the policing system.

A leading cause of police violence is the lack of preparation in peacefully responding to situations. When police officers enter a potentially dangerous situation with uncertainty and no clear plan of action, the situation escalates into a more violent scenario. Providing officers with predictions and key information on future crimes would allow them to restore peace, de-escalate a conflict, and even prevent the crime all together.

However, city governments and police departments currently have no way to use existing crime data to predict future crimes and offer the best course of action, meaning there will continue to be similar injustices. Thus, we took a unique approach from the common hackathon project. Instead of creating an application meant for general use, we developed an application for governments and law enforcement. We hope to implement our software as part of a nationwide government plan to promote better crime response.

Thus, we developed Recon, an application that uses AI to assist law enforcement in smarter crime response.

What it does

Recon is a progressive web application that lets law enforcement and governments prepare and predict future crime, overall addressing recent improper police responses.

On the Government page, city officials upload crime data their cities already have stored. We don’t use any demographic based data, and this is important to prevent any sort of racial or identity bias that could arise when using demographic based data. Once this data is provided, it is sent to Google Cloud, where we then create a model and interactive map for that specific city.

The interactive map is made to answer four main questions: where crimes occur, when crimes occur, what types of crimes occur, and most importantly, how the crime should be resolved. Users are able to see where crimes are most likely to happen through the interactive map, and using the time filters, they can filter to specific days of the week and/or times of day. By hovering over a pin, users can see the type of crime and the recommended method of de-escalation. Given problems with police brutality and inefficient responses, it’s essential to predict the best methods for responding beforehand. Users can filter by type of crime and when the crime will occur. Our map has two central pins with an adjustable radius, and we show crimes at the intersection of these two circles. With these mappings, different police departments can coordinate their patrols in the right places and reduce potential conflicts and escalations.

Our algorithm is built on a public dataset of San Francisco crime data, and the given parameters include category of crime, location (latitude/longitude), time and day, and how the crime was resolved. We don’t use any demographic information to prevent identity bias. We focus heavily on reducing biases, which is why we chose this specific dataset. We trained the model on all the parameters and gave each as both features and labels, so that it could predict details of future crimes by learning the relationships between all the features. The model is an XG Boost, or gradient boosting, machine learning algorithm because of its ability to process high amounts of numerical data. It performed better than other tested models, such as a Keras one. Tuning hyperparameters allowed for an effective final model.

Our map is built with D3.js for integration with ML predictions, and GeoPandas for rendering and processing model predictions. For integrating the backend ML and the frontend map, we have the model predict new crime based on a test map for the following week, and then we export the predictions as a JSON file using GeoPandas and GeoJSON. We then load this JSON file using D3.js and build the interactive map around these data points.

We also adjusted our model to predict the best solution to crimes. Police departments can input details about a potential crime and we determine the best way to resolve it, helping them make better decisions to reduce injustices. We deployed our adjusted model on PythonAnywhere with Flask as our framework.

Finally, community members can use the Community Page to help their police department. With the Bounty Board, they can keep an eye out for wanted individuals and earn rewards for providing tips. Additionally, the report system lets them report suspicious individuals nearby, overall strengthening a broken relationship between communities and law enforcement.

How we built it

After numerous hours of wireframing, conceptualizing key features, and outlining tasks, we divided the challenge amongst ourselves by assigning Ishaan to developing the UI/UX, Adithya to doing data analytics and Google Cloud integration, Ayaan to developing our crime prediction models, and Viraaj to developing and integrating the interactive map.

We coded the entire app in the following languages/frameworks: HTML, CSS, Javascript, and Python. We used Google Cloud and Flask for our backend and map. We developed our interactive map with Google Cloud*, **D3.js, and GeoPandas/GeoJSON. We built our AI models with Sci-Kit and other ML libraries, and deployed some on PythonAnywhere with Flask. We hosted our website through Netlify and Github. We collected our data from open-source sites.

Challenges we ran into

The primary challenge that we ran into was developing our crime models. Since the data was very complex and required cleaning, we weren’t sure how to start. Luckily, we were able to learn how to use JSON with python to easily parse the data. Training these models was also a huge challenge because of the sheer size of the data. While we were not able to fully deploy our full models, as they are too large to deploy on free and available servers, as long as governments give us data, we can produce models and maps for them.

In addition, many of these technologies were brand-new to us. We have not used advanced AI/ML on this level in the past, and learning how to develop these models was a giant hurdle we needed to overcome. In addition, we spend hours learning how to use new data visualization mapping tools, specifically D3.js, GeoPandas, and GeoJSON to build our interactive maps. We are very proud of overcoming these challenges to come up with a finished product.

Accomplishments we are proud of

We are incredibly proud of how our team found a distinctive yet viable solution to assisting law enforcement. We are proud that we were able to develop some of our most advanced models so far. We are extremely proud of developing a solution that has never been previously considered or implemented in this setting. Most importantly, we were able to achieve our goals for the weekend by completely finishing our app, which we are very happy with.

What we learned

Our team found it incredibly fulfilling to use our AI knowledge in a way that could effectively assist governments to improve policing. We were excited to develop models to impact such a pressing problem in our society. Seeing how we could use our software engineering skills to address police brutality and systemic injustices was the highlight of our weekend.

From a software perspective, we focused on developing a large scale model and an interactive map. Our team has had some experience with AI, but in this project we dramatically increased our knowledge and were able to use our skills to develop advanced ML models. At first we weren’t sure at all how to process so much numerical data, but after many tutorials and reading, we learned how to use XG Boost models for our task. Learning a lot more about AI and data analysis was a great achievement for all of us this weekend. We learned how to use great frameworks such as Google Cloud to impact social good. We were also able to use new data visualization tools we’ve never seen before, specifically D3.js, GeoPandas, and GeoJSON, to build our virtual map, which allowed our project to reach the next level.

What is next for Recon

We believe that our application would be best implemented on a local and state government level. Law enforcement and government officials currently do not have a way to effectively prepare for and predict crime, but with our solution, they can more properly address and reduce crime.

In terms of our application, we would love to deploy our models on the web and streamline the process of collecting and preparing data, training a model, and creating an interactive map all in one step. Given that our current situation prevents us from buying a web server capable of running all those processes at once, we look forward to acquiring a web server that can process high-level computation. Lastly, we would like to refine our algorithms to incorporate more crime parameters and other cities.

Share this project: