Installation

We provide convenient setup scripts for each supported device that will install all the necessary dependencies for you. Before running the setup script, ensure that your Python version is 3.7 <= x <= 3.9, and that you have write access to root folders (e.g. /usr/bin).

git clone https://github.com/datature/edge.git
cd <DEVICE_FOLDER>
chmod u+x setup_datature_edge.sh
./setup_datature_edge.sh

🚧

It is recommended NOT to use a virtual environment for this project, since it involves running system-level daemon scripts.

The script will auto-reboot your device for the camera and other firmware settings to take effect. Once done, check that you have the following four files in their respective directories:

  • /usr/bin/datature-edge: this is the binary executable compiled from datature-edge.sh that allows you to start and stop the camera streaming and inference, and switch between models by specifying the model key and project secret from Datature Nexus.
  • /usr/src/datature-edge/datature_edge.py: this is the Python script that grabs frames from the Raspberry Pi camera stream, performs inference, and displays the prediction results in real-time. The parent directory should contain other supporting files as well.‍
  • /etc/datature_edge.conf: this is a configuration file that stores user parameters such as the confidence threshold and model input size. They will be passed on to the Python script upon invocation.
  • /etc/systemd/system/datature_edge.service: this is a system-level file that is invoked upon startup. This allows the Python inference script to be executed automatically even after the Raspberry Pi has been rebooted. The inference script will also be automatically restarted upon failures (such as OOM errors or with an accidental KeyboardInterrupt) to ensure that minimal user intervention is required.