Green-on-Green Detection¶
Green-on-Green (GoG) detection enables the OWL to identify weeds growing within crops, where traditional colour-based detection cannot distinguish weed from crop.
Overview¶
GoG uses YOLO object detection models to identify weeds directly, regardless of background. Two inference backends are supported:
Backend |
Format |
Best for |
|---|---|---|
NCNN (recommended) |
Directory with |
Production on Raspberry Pi — fast, no GPU needed |
PyTorch |
Single |
Development and training |
Models are loaded automatically from the models/ directory. The OWL auto-detects the model format.
Hardware Requirements¶
The OWL runs YOLO inference natively on the Raspberry Pi via NCNN. The Google Coral USB Accelerator that earlier documentation referenced is no longer recommended — it has been superseded by the Raspberry Pi AI Hat+, which is the current recommended accelerator for in-field Green-on-Green deployments.
Recommended: Raspberry Pi AI Hat+. The Waveshare variant is widely available — Waveshare AI Hat+ — and other Hailo-based AI Hat+ variants from different vendors work the same way. Higher-compute variants cost more but let you run larger inference image sizes, which is worth it if you need higher accuracy on smaller targets.
Without an accelerator: the Pi can run smaller NCNN models on CPU only. That works for testing and low-resolution inference, but the AI Hat+ is what unlocks larger image sizes and the frame rates needed for boom-speed operation.
Installing AI¶
AI detection needs ultralytics (with PyTorch and NCNN) in the OWL’s virtual environment. Units set up with
owl_setup.sh --factory ship without it, so a fresh factory unit can only run colour detection until AI is installed.
Every OWL reports what AI it can run in its state and in the standalone /api/system_stats:
"ai": {
"cpu": {"installed": true},
"hailo": {"present": false, "chip": null, "runtime": false},
"accelerator": "cpu"
}
accelerator is hailo8 when a Hailo-8 card and its runtime are both present, cpu when only ultralytics is
installed, and null when the unit has no AI. While it is null, the dashboards refuse the AI and Hybrid modes
with a plain reason instead of selecting a mode the OWL cannot run.
Install AI from the dashboard or phone app. POST /api/ai/install runs a normal software update at the
branch the OWL is on and also installs requirements-gog.txt. It needs an internet connection (a phone hotspot
works) and about 3 GB of free space, and can take 20 minutes or more on a Pi. Progress is the ordinary update
progress (GET /api/settings/update/status on a standalone OWL, GET /api/update/status on the networked
controller). On the networked controller the same route takes {"device_ids": ["owl-1"]} or "all". If the
install fails, or runs past the update’s 30 minute limit, the update rolls back like any other.
Install AI over SSH:
bash ~/owl/owl_update.sh --with-ai
If AI cannot load¶
Choosing AI is only saved once the OWL reports the model running. If it cannot load (no AI installed, no model,
a damaged model), the OWL keeps detecting with its previous mode, and algorithm_error in the state says why.
An OWL that starts up with algorithm = gog or gog-hybrid in its config and cannot load the model falls back
to exhsv colour detection, so a unit is never left without detection after a restart. The config file is not
changed, so the unit runs AI again once the problem is fixed.
Detection Modes¶
OWL supports two GoG detection strategies, selected by the algorithm config key:
gog— Direct detectionThe YOLO model detects weeds directly. Each detection bounding box is mapped to a relay lane for actuation. Use this when your model is trained specifically on weeds.
gog-hybrid— Crop masking + colour detectionThe YOLO model identifies and masks crop regions. The remaining (non-crop) areas are then processed with the ExHSV colour algorithm to find weeds. Use this when you have a crop model but not a weed-specific model.
Actuation Modes¶
How YOLO detections are mapped to relay lanes:
centre(default)The horizontal centre of each bounding box determines which relay lane fires. Works with both detection and segmentation models.
zoneUses the segmentation mask to count pixels in each relay lane. Only fires if the pixel count exceeds
min_detection_pixels. Requires a segmentation model (trained with-segsuffix).
Set the mode with the actuation_mode key in [GreenOnGreen].
Model Management¶
Placing models manually¶
Copy model files to ~/owl/models/ on the Raspberry Pi:
NCNN: A directory containing a
.paramand.binfile pairPyTorch: A single
.ptfile
# Example: copy an NCNN model
scp -r my_model_ncnn/ owl@owl.local:~/owl/models/
Upload and deploy via dashboard¶
The networked controller includes a model management page for uploading and deploying models wirelessly:
Open the controller’s
/modelspage from a laptop browserUpload a
.ptfile or.zipcontaining NCNN.param+.binfilesSelect target OWL devices
Click Deploy — the model is transferred to each OWL over the network
Each OWL checks the download’s SHA-256 before it touches the model it already has. For an NCNN zip it checks
the zip file first (the hash Noktura sends), then the extracted files (the hash the controller sends). A zip
whose files sit in one top-level folder is unpacked without that folder. If the check or the unpacking fails,
the previous model stays in place and model_download in the state reports the error.
Hot-swap via AI tab¶
The dashboard AI tab lets you switch between models without restarting:
Open the AI tab in the dashboard
Select a model from the dropdown — shows model type (detection/segmentation), format, and size
Filter which classes to detect using the class button grid
Click Apply to hot-swap the model
Weed Tracking¶
When tracking_enabled = True in the [Tracking] config section, OWL uses ByteTrack to assign persistent IDs to detected weeds across frames. This provides:
Class smoothing: Predictions are averaged over a sliding window (
track_class_windowframes) to reduce class flickeringCrop mask stabilisation: In
gog-hybridmode, crop mask regions persist fortrack_crop_persistframes after a crop detection leaves the frame, preventing false positives at crop edges
Tracking adds minimal overhead and is recommended for GoG deployments.
Training Your Own Model¶
Collect images of weeds in your specific field conditions — lighting, soil type, growth stage, and crop all matter
Annotate images using Roboflow or Label Studio to draw bounding boxes (or polygons for segmentation) around weeds
Train with Ultralytics YOLO:
pip install ultralytics yolo detect train data=your_dataset.yaml model=yolov8n.pt epochs=100 imgsz=320
Export to NCNN for deployment on Raspberry Pi:
yolo export model=best.pt format=ncnn imgsz=320
This creates a directory with
.paramand.binfiles ready to copy to~/owl/models/.
Check Weed-AI for existing annotated weed image datasets that may be relevant for your conditions.
Configuration¶
GreenOnGreen parameters¶
Parameter |
Default |
Description |
|---|---|---|
|
|
Directory containing YOLO model files. |
|
|
Minimum confidence threshold (0.0-1.0). |
|
(empty) |
Comma-separated class IDs to detect. Empty = all classes. |
|
|
Relay mapping: |
|
|
Minimum mask pixels for zone mode actuation. |
|
|
YOLO input image size. Smaller = faster, larger = more accurate. |
|
|
Pixel buffer around crop mask regions (gog-hybrid). |
Tracking parameters¶
Parameter |
Default |
Description |
|---|---|---|
|
|
Enable ByteTrack multi-object tracking. |
|
|
Frames to smooth class predictions over. |
|
|
Frames a crop mask persists after detection leaves. |
Next Steps¶
Configuration Guide - Full parameter reference
AI Assistant - Control detection settings through natural language
Weed-AI - Access training datasets