The increasing adoption of mobile phones have significantly shortened the time required for firefighting agents to be alerted of a starting wildfire. In less dense areas, limiting and minimizing this duration remains critical to preserve forest areas.
Pyrovision aims at providing the means to create a wildfire early detection system with state-of-the-art performances at minimal deployment costs.
You can use the library like any other python package to detect wildfires as follows:
from pyrovision.models.rexnet import rexnet1_0x
from torchvision import transforms
import torch
from PIL import Image
# Init
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
tf = transforms.Compose([transforms.Resize(size=(448)), transforms.CenterCrop(size=448),
transforms.ToTensor(), normalize])
model = rexnet1_0x(pretrained=True).eval()
# Predict
im = tf(Image.open("path/to/your/image.jpg").convert('RGB'))
with torch.no_grad():
pred = model(im.unsqueeze(0))
is_wildfire = torch.sigmoid(pred).item() >= 0.5
Python 3.6 (or higher) and pip/conda are required to install Holocron.
You can install the last stable release of the package using pypi as follows:
pip install pyrovision
or using conda:
conda install -c pyronear pyrovision
Alternatively, if you wish to use the latest features of the project that haven't made their way to a release yet, you can install the package from source:
git clone https://github.com/pyronear/pyro-vision.git
pip install -e pyro-vision/.
The full package documentation is available here for detailed specifications.
If you wish to deploy containerized environments, a Dockerfile is provided for you build a docker image:
docker build . -t <YOUR_IMAGE_TAG>
You are free to use any training script, but some are already provided for reference. In order to use them, install the specific requirements and check script options as follows:
pip install -r references/requirements.txt
python references/classification/train.py --help
You can then use the script to train tour model on one of our datasets:
Download Dataset from https://drive.google.com/file/d/1Y5IyBLA5xDMS1rBdVs-hsVNGQF3djaR1/view?usp=sharing
This dataset is protected by a password, please contact us at contact@pyronear.org
python train.py WildFireLght/ --model rexnet1_0x --lr 1e-3 -b 16 --epochs 20 --opt radam --sched onecycle --device 0
You can also use out opensource dataset without password
python train.py OpenFire/ --use-openfire --model rexnet1_0x --lr 1e-3 -b 16 --epochs 20 --opt radam --sched onecycle --device 0
You can use our dataset as follow:
from pyrovision.datasets import OpenFire
dataset = OpenFire('./data', download=True)
If you wish to cite this project, feel free to use this BibTeX reference:
@misc{pyrovision2019,
title={Pyrovision: wildfire early detection},
author={Pyronear contributors},
year={2019},
month={October},
publisher = {GitHub},
howpublished = {\url{https://github.com/pyronear/pyro-vision}}
}
Please refer to CONTRIBUTING
to help grow this project!
Distributed under the Apache 2 License. See LICENSE
for more information.