insect-detect
Detection models and Python scripts for automated insect monitoring with the Insect Detect DIY camera trap.
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.7%) to scientific vocabulary
Keywords
Repository
Detection models and Python scripts for automated insect monitoring with the Insect Detect DIY camera trap.
Basic Info
- Host: GitHub
- Owner: maxsitt
- License: gpl-3.0
- Language: Python
- Default Branch: main
- Homepage: https://maxsitt.github.io/insect-detect-docs/
- Size: 54.6 MB
Statistics
- Stars: 54
- Watchers: 2
- Forks: 21
- Open Issues: 0
- Releases: 8
Topics
Metadata Files
README.md
Insect Detect - DIY camera trap for automated insect monitoring

This repository contains Python scripts and YOLOv5, YOLOv6, YOLOv7 and YOLOv8 object detection models (.blob format) for testing and deploying the Insect Detect DIY camera trap for automated insect monitoring.
The camera trap system is composed of low-cost off-the-shelf hardware components (Raspberry Pi Zero 2 W, Luxonis OAK-1, Witty Pi 4 L3V7), combined with open source software and can be easily assembled and set up with the provided instructions.

Installation
[!IMPORTANT] Please make sure that you followed all steps to set up your Raspberry Pi.
Install all dependencies/packages and automatically run the required setup steps:
bash
wget -qO- https://raw.githubusercontent.com/maxsitt/insect-detect/main/insect_detect_install.sh | bash
Optional: Install and configure Rclone if you want to use the upload feature:
bash
wget -qO- https://rclone.org/install.sh | sudo bash
Check out the Usage documentation for more information.
Detection models
| Model | size
(pixels) | mAPval
50-95 | mAPval
50 | Precisionval
| Recallval
| SpeedOAK
(fps) | params
(M) |
| ----------- | --------------------- | -------------------- | ----------------- | --------------------- | ------------------ | ---------------------- | ------------------ |
| YOLOv5n | 320 | 53.8 | 96.9 | 95.5 | 96.1 | 49 | 1.76 |
| YOLOv6n | 320 | 50.3 | 95.1 | 96.9 | 89.8 | 60 | 4.63 |
| YOLOv7-tiny | 320 | 53.2 | 95.7 | 94.7 | 94.2 | 52 | 6.01 |
| YOLOv8n | 320 | 55.4 | 94.4 | 92.2 | 89.9 | 39 | 3.01 |
Table Notes
- All models were trained to 300 epochs with batch size 32 and default hyperparameters. Reproduce the model training with the provided [Google Colab notebooks](https://github.com/maxsitt/insect-detect-ml#model-training). - Trained on [Insect_Detect_detection](https://universe.roboflow.com/maximilian-sittinger/insect_detect_detection) dataset [version 7](https://universe.roboflow.com/maximilian-sittinger/insect_detect_detection/dataset/7), downscaled to 320x320 pixel with only 1 class ("insect"). - Model metrics (mAP, Precision, Recall) are shown for the original PyTorch (.pt) model before conversion to ONNX -> OpenVINO -> .blob format. Reproduce metrics by using the respective model validation method.![]()
Processing pipeline
All configuration parameters can be customized in the web app or by directly modifying the
config_custom.yaml
file. You can generate multiple custom configuration files and select the active config either in
the web app or by modifying the
config_selector.yaml.
Processing pipeline for the
trigger_capture.py
script that can be used for automated insect monitoring:
- A custom YOLO insect detection model is run in real time on device (OAK) and uses a continuous stream of downscaled LQ frames as input.
- An object tracker uses the bounding box coordinates of detected insects to assign a unique tracking ID to each individual present in the frame and track its movement through time.
- The tracker + model output from inference on LQ frames is synchronized with MJPEG-encoded HQ frames (default: 3840x2160 px) on device (OAK).
- The HQ frames are saved to the microSD card at the configured capture intervals while an insect is detected (triggered capture) and independent of detections (time-lapse capture).
- Corresponding metadata from the detection model and tracker output is saved to a metadata .csv file for each detected and tracked insect (including timestamp, label, confidence score, tracking ID, tracking status and bounding box coordinates).
- The bounding box coordinates can be used to crop detected insects from the corresponding HQ frames and save them as individual .jpg images. Depending on the post-processing configuration, the original HQ frames are optionally deleted to save storage space.
- If a power management board (Witty Pi 4 L3V7 or PiJuice Zero) is connected and enabled in the configuration, intelligent power management is activated which includes battery charge level monitoring with conditional recording durations.
- With the default configuration, running the recording consumes ~3.8 W of power.


More information about the processing pipeline can be found in the Insect Detect Docs 📑.
Check out the classification
instructions and the insect-detect-ml GitHub repo for
information on how to classify the cropped detections with the provided classification model and script.
Take a look at the post-processing instructions for information on how to post-process the metadata with classification results.
License
This repository is licensed under the terms of the GNU General Public License v3.0 (GNU GPLv3).
Citation
If you use resources from this repository, please cite our paper:
Sittinger M, Uhler J, Pink M, Herz A (2024) Insect detect: An open-source DIY camera trap for automated insect monitoring. PLOS ONE 19(4): e0295474. https://doi.org/10.1371/journal.pone.0295474
Owner
- Name: Maximilian Sittinger
- Login: maxsitt
- Kind: user
- Location: Germany
- Company: JKI
- Twitter: M_Sittinger
- Repositories: 2
- Profile: https://github.com/maxsitt
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use resources from this repository, please cite it using this metadata."
title: "Insect Detect - Software for automated insect monitoring with a DIY camera trap system"
authors:
- family-names: Sittinger
given-names: Maximilian
orcid: "https://orcid.org/0000-0002-4096-8556"
license: GPL-3.0
doi: 10.5281/zenodo.7472238
repository-code: "https://github.com/maxsitt/insect-detect"
url: "https://maxsitt.github.io/insect-detect-docs/"
version: 1.7
date-released: "2024-04-19"
preferred-citation:
type: article
authors:
- family-names: Sittinger
given-names: Maximilian
- family-names: Uhler
given-names: Johannes
- family-names: Pink
given-names: Maximilian
- family-names: Herz
given-names: Annette
title: "Insect detect: An open-source DIY camera trap for automated insect monitoring"
journal: "PLOS ONE"
year: 2024
month: 4
volume: 19
issue: 4
start: 1
end: 28
doi: 10.1371/journal.pone.0295474
url: "https://doi.org/10.1371/journal.pone.0295474"
GitHub Events
Total
- Watch event: 14
- Issue comment event: 4
- Push event: 37
- Pull request event: 1
- Fork event: 3
Last Year
- Watch event: 14
- Issue comment event: 4
- Push event: 37
- Pull request event: 1
- Fork event: 3
Dependencies
- APScheduler ==3.10.4
- av ==10.0.0
- depthai ==2.23.0.0
- numpy ==1.25.2
- opencv-contrib-python ==4.5.5.62
- pandas ==2.1.1
- psutil ==5.9.5