Skip to content

pyronear/pyro-engine

Repository files navigation

PyroNear Logo

CI Status Documentation Status Test coverage percentage black

PyPi Version Anaconda Version DockerHub version pyversions license

PyroEngine: Wildfire detection on edge devices

PyroEngine provides a high-level interface to use Deep learning models in production while being connected to the alert API.

Quick Tour

Running your engine locally

You can use the library like any other python package to detect wildfires as follows:

from pyroengine.core import Engine
from PIL import Image

engine = Engine()

im = Image.open("path/to/your/image.jpg").convert('RGB')

prediction = engine.predict(im) 

Setup

Python 3.8 (or higher) and pip/conda are required to install PyroEngine.

Developer installation

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-engine.git
pip install -e pyro-engine/.

Full docker orchestration

In order to run the project, you will need to specify some information, which can be done using a .env file. This file will have to hold the following information:

  • API_URL: the URL of the API where to send alerts
  • LAT: the latitude of the device
  • LON: the longitude of the device
  • CAM_USER: the username to access the camera
  • CAM_PWD: the password to access the camera

So your .env file should look something like this:

API_URL=https://api.pyronear.org
LAT=48.88
LON=2.38
CAM_USER=my_dummy_login
CAM_PWD=my_dummy_pwd

Additionally, you'll need a ./data folder which contains:

  • credentials.json: a dictionary with the IP address of your cameras as key, and dictionary with entries login & password for their Alert API credentials
  • model.onnx: optional, will override the model weights download from HuggingFace Hub
  • config.json: optional, will override the model config download from HuggingFace Hub

Example of credentials.json:

{
    "169.254.40.1": {
        "brand": "reolink",
        "type": "ptz",
        "credentials": [
            {
                "login": "dummy_login_1",
                "password": "dummy_password_1",
                "posid": 1
            },
            {
                "login": "dummy_login_2",
                "password": "dummy_password_2",
                "posid": 2
            },
            {
                "login": "dummy_login_3",
                "password": "dummy_password_3",
                "posid": 3
            }
        ]
    },
    "169.254.40.3": {
        "brand": "reolink",
        "type": "static",
        "credentials": [
            {
                "login": "dummy_login_4",
                "password": "dummy_password_4"
            }
        ]
    }
}

Documentation

The full package documentation is available here for detailed specifications.

Contributing

Please refer to CONTRIBUTING if you wish to contribute to this project.

Credits

This project is developed and maintained by the repo owner and volunteers from Pyronear.

License

Distributed under the Apache 2 License. See LICENSE for more information.