Fire Detection (real time) YOLOv8 with Python in 6min

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi today I'm going to show you how to create yellow file 8 model which can detect fire on images or videos and probably the most important step is data preparation couple years ago I would have to label images by myself thanks to the great Community we have a lot of ready to go solutions for example roboflow I found their very cool data set which consists of two and a half thousand of images and they already have bounding boxes drowned on them all I have to do is Click download and choose the architecture today of course it's yellow file 8 but it also supports other configurations continue it generated code snippet with unique API key I'm going to do the training process in collabs so let's copy and paste it to Google column I have already prepared my script I'm using Google collab because they offer free GPU time for every user okay I have to install two additional libraries ultralytics and roboflow if you prepare data by yourself you probably don't need this I did it earlier so it's already installed some imports and this snippet is based from roboflow now we can trade the network exclamation mark turns the command line mode we have to set mode for train task for detect load our model architecture in this example I'm using small model I believe there is also Nano model medium model and large model path for the data and number of epochs for the sake of this video I will make only one Epoch but behind the scenes I train my model on 80 epochs it took about 40 minutes with Google GPU acceleration this is for image size plot screw will create of course plots in final directory training plots there we have some information about the shapes of of inputs of layers and result was saved in this path with this line I can check training plots but of course I should change the path and this plots are trash because I did only one Epoch on this training if you make real training these plots are very very important because because they enables you to see if further training even makes sense but it's topic probably for another video so let's go on the last line you would probably want to do validation for your model and that's it it's pretty amazing that we can train Network on custom data with five maybe 10 lines of code your model should be saved here depends on how many training you did and by default it's called bass dot PT you can download it here I'm not doing it because I already did I downloaded my ad epox model so let's switch to my local Visual Studio code this code is even simpler first load the model and then predict conf argument is the threshold now it's set for 60 percent let's start with some static images and change show to save okay my bad result saved in this path runs detect predict model has 68 percent of confidence that this is fire not bad but also not good you can ask why uh not 99 of confidence there are three main problems most important data set consists of images with forest fire with industrial fires this photo looks like from Studio because of its perfect black background next issue is training time it should be much much longer and last issue the architecture I choose the small one because it's faster than than the big one but has usually has worse performance look at the second picture there is no fire of this picture so I'm checking for some false positives boxes and it's fine we allow didn't detect any fire on this image if forest was in the Hampton season where the leaves are red and yellow it would probably fail but let's proceed to the purpose of this video real-time fire recognition I'm using my building camera so by default it's Source zero and let's go okay my bad if I want to see it in real time we need flag show through and let's remove this save through because I don't want to save it for one hour of work I think it's pretty cool first step to improve this modular accuracy is to retrain it on much bigger data set it would create better generalization in simply terms better performance thanks for watching and see you soon [Music]
Info
Channel: University of The Future
Views: 5,012
Rating: undefined out of 5
Keywords: yolo, yolov8, neural network, fire, forest fire, industrial fire, detection, roboflow, ultralytics, python3, python, machine learning, custom data set, google colab, gpu training, colab, notebook, artificial inteligence, tutorial, fire detection, segmentation, torch, pytorch, python machine learning, fire recognition, flame recognition, flame detection, flame bounding box, custom data set yolo, universe, gpu, yolo custom data, train yolo my dataset, classification, custom yolo
Id: -RDeVPHipZU
Channel Id: undefined
Length: 6min 15sec (375 seconds)
Published: Tue Apr 18 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.