Logo

Preventing fires in open landscapes using Image Processing

By Luis Carmona | 12/06/2024

Motivation:

Imagine the following: The university you attend has some power spike and then a room starts to catch on fire. This instantly caugh my attention, and I needed to develop a solution to prevent fires to spread. This is how this project started, an ambission to solve the several fires that happened at UFRJ during my studies there.

Noticia da Globo do fogo na UFRJ

But this was not the first incident that happened. Another fire that touched me was the one at Quinta da Boa Vista in Rio de Janeiro, which also belongs to the Federal University of Rio de Janeiro, my Alma Mater.

Noticia da Globo do fogo no Museu Nacional

The model

Although I didn't find any dataset to address my initial project, I found one at Roboflow that was for a smoke detection competition. So for the image source and for the model I would use I just imported both of them like so:

Noticia da Globo do fogo no Museu Nacional

Then the model loading becames very straight forward and we can analyse its results. Here I trained the model for 256 epochs with a batch size of 16.

Noticia da Globo do fogo no Museu Nacional

The Results

The results turned out better than expected for this class. Here is a little visual in the important metrics like precision, recall, and mean Average Precision (mAP). A brief explanation of these metrics is:

  • Precision: Is the ratio between the true positives over the sum of the true positives and false positives
  • Recall: Is the ratio between the true positives over the sum of the true positives and false negatives
  • Mean Average Precision: Is the sum of the Average Precision (AP) of each class and then taking the average over the number of classes
Noticia da Globo do fogo no Museu Nacional

Image Results

Noticia da Globo do fogo no Museu Nacional

It was possible to identify early smokes in open landscapes given a image or a frame as we will see next. This would potentially reduce mass fires as it would possibilitate the

Video Results

As we were able to identify smoke in images, its very simple to identify them in videos, just take each frame and process it. The code provided, possibilitates the generation of videos like the one below. This is one of the many utilizations we can find for Image Processing, there are so much more things we can do.

Noticia da Globo do fogo no Museu Nacional

Conclusion

This project was done back in 2021, when YoloV5 was the best model available. Now, 3 years later, we have newer models that would provide a better output. I will try to explore them and its differences in a new post. Hope you guys enjoyed, see you in a next post.