Implementation of a fire detection model to trace fire from video or image.This model is build based on original yolov7 by WongKinYiu
git clone https://github.com/vishnuvskvkl/yolov7-fire-detection.git
cd yolov7-fire-detection
conda create -n <environment_name> python=3.9
conda activate <environment_name>
For training we have to create an environment in pytorch with cuda support.
pip install -r requirements.txt
git clone https://github.com/WongKinYiu/yolov7.git
cd yolov7
For custom train the model I used fire dataset from Roboflow which contains 2005 images. You can either download or get the dataset using roboflow api key. Put it under the folder data
data
|train
|images
|labels
|val
|images
|labels
Replace the coco.yaml
file in folder data with data.yaml
and change the number of classes in cfg>training>yolov7.yaml
to 1
Download yolov7 weight files from here and put it inside the directory.
Beign Custom training by executing the command
python train.py --batch 16 --cfg cfg/training/yolov7.yaml --epochs 10 --data data/data.yaml --weights 'yolov7.pt' --device 0
Once the training is completed the model can be found at runs>train>weights
as best.pt
We can use this model for feature detection(either you can use your own trained model or the pretrained model released within this repository) by the command
python detect.py --weights /content/yolov7/runs/train/exp2/weights/best.pt --conf 0.1 --source 92.jpg
or for video
python detect.py --weights /content/yolov7/runs/train/exp2/weights/best.pt --conf 0.1 --source 92.mp4
dtt.mp4
Precision Curve | Recall Curve | Precision Recall Curve |
---|---|---|
Test batch label | Test batch prediction |
---|---|