Skip to content

Latest commit

 

History

History
107 lines (71 loc) · 2.88 KB

README.md

File metadata and controls

107 lines (71 loc) · 2.88 KB

yolov7-fire-detection

Implementation of a fire detection model to trace fire from video or image.This model is build based on original yolov7 by WongKinYiu

Install Dependencies

Clone this repository

git clone https://github.com/vishnuvskvkl/yolov7-fire-detection.git
cd yolov7-fire-detection

Create a new environment to run the model

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

Clone the official yolov7 repository

git clone https://github.com/WongKinYiu/yolov7.git
cd yolov7

Creating custom dataset

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

Start Custom Training

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

Results

Precision Curve Recall Curve Precision Recall Curve

Validation predictions

Test batch label Test batch prediction

Confusion Matrix