Image classification API for Emergency Calls

Image classification API for Emergency Calls
Photo by César Abner Martínez Aguilar / Unsplash

Technology is continuously evolving, and artificial intelligence is an advancement that will considerably change industries. At Zaleos, we like to adapt strategies for growth and innovation. That is why machine learning inspired my new project.

The vision

Personally, I think people can face challenges when managing emergency calls when information is limited or unclear. That's why I thought doing a project on image classification would be a good idea.

To be precise, from my point of view, if the Emergency Center or Public Safety Answering Point (PSAP) has an image of the surroundings provided by the caller, it is a great help for 911 or 112 dispatchers. By having a visual representation of the scene and knowing what the caller is dealing with, dispatchers can more accurately assess the situation. The image and the prediction allow them to determine the appropriate measurements and tools required to address the emergency effectively. As a result, this can lead to a more efficient response.

Development

The project is a service that provides an API. The user can upload images, and the API calls a function to predict the image. After that, it saves the prediction and the image into a database. Although building this project was not too hard, it was pretty rewarding since I learned quite a lot in the process.

Structure of the project

The API is built using Python and FastAPI. It revolves around three key methods:

  1. POST: After receiving an image, the API invokes an image classifier to identify the element in the image. After predicting the element, it stores the prediction, its accuracy, and the image it received inside the database.
  2. GET: With the GET request, the user can access both the root directory and specific paths within the database. This allows the user to retrieve information about past incidents.
  3. DELETE: The API has a DELETE method to manage stored information.

On the other hand, the database is a docker container created with a docker file to help automate its deployment since it contains all the necessary elements to run it.

Last but not least, the image classification is built with Keras from analyzed TensorFlow. In the beginning, I chose to classify with C# and ml.net. I analyzed the usage and how it worked, but I finally chose Python because it is more convenient. The model uses deep learning and is implemented with neural networks. Furthermore, it can classify various animals, plants, and objects. Here is an example of the image classification, where I upload an image of an ambulance and the output of the prediction:

0:00
/0:08

For example, if I POST images in the API, the output would be:

Prediction of different images and their confidence

Conclusion

In conclusion, the journey of building the project was fulfilling. I think I acquired and learned a lot in the process, which is the most important objective since, at Zaleos, we consider self-improvement and having a growth mindset essential.

References