Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
geezacoleman authored Sep 27, 2023
1 parent a169080 commit 36c3223
Showing 1 changed file with 44 additions and 32 deletions.
76 changes: 44 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ Simplifying the integration of weed detection into your platform.

## Overview
The OpenWeedLocator (OWL) is an open-source weed detection device for low-cost,
DIY site-specific weed management. Here, we're making the software that supports
the OWL more accesible with an easy-to-use API, so you can integrate weed detection
into your own devices and services more easily by simply calling
`GreenonBrown.find()`.
DIY site-specific weed management. The full project can be found [here](https://github.com/geezacoleman/OpenWeedLocator).
Here, we're making the software that supports the OWL more accesible with an easy-to-use API,
so you can integrate weed detection into your own devices and services more easily
by simply calling `GreenonBrown.find()`.

Currently, it supports green-on-brown detection on all platforms, and green-on-green
on desktops through the Ultralytics package.
Currently, owl-tools supports green-on-brown detection on all platforms, and green-on-green
on desktops through the Ultralytics package. Train your only YOLO algorithms and simply integrate
them by providing a path to the trained `model.pt`.

In the future, we will support plant counting, GPS integration and green-on-green
on edge devices (Jetson Nano, Raspberry Pi)
on edge devices (Jetson Nano, Raspberry Pi). If you're nterested in specific features,
feel free to raise an issue or pull request.

## Installation
To install the latest version of `openweedlocator-tools` simply run:
### Desktop (GreenOnGreen + GreenOnBrown)
```
pip install openweedlocator-tools[desktop]
```
### Raspberry Pi (
### Raspberry Pi (GreenOnBrown only)
```
pip install openweedlocator-tools[rpi]
```
Expand All @@ -40,17 +42,23 @@ webcam(algorithm='gog', model_path='models/yolov8n.pt) # press escape to exit, a
images_and_video(media_path='path/to/your/media_files
```

## Streamlit App
Try it for yourself now with the online, Streamlit app!
[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://owl-tools.streamlit.app/)

## Example
This example shows the basic functionality of the detection classes, GreenOnBrown and GreenOnGreen to operate on a video.
These examples shows the basic functionality of the detection classes, GreenOnBrown and GreenOnGreen to operate on a video.

```Python
from owl.detection import GreenOnBrown
import cv2

video_path = 'path_to_video.mp4'
VIDEO_PATH = r'media/test_video_1.avi'
ALGORITHM = 'exhsv'

weed_detector = GreenOnBrown()

video_feed = cv2.VideoCapture(video_path)
video_feed = cv2.VideoCapture(VIDEO_PATH)

while True:
ret, frame = video_feed.read()
Expand All @@ -59,7 +67,7 @@ while True:
break

# the weed_detector.find() method returns a tuple with four items
results = weed_detector.find(image,
results = weed_detector.find(frame.copy(),
exgMin=30,
exgMax=250,
hueMin=30,
Expand All @@ -70,48 +78,52 @@ while True:
saturationMax=255,
minArea=1,
show_display=False,
algorithm='exg',
algorithm=ALGORITHM,
invert_hue=False)

contours, bounding_boxes, weed_centres, display_image = results
cv2.imshow('OWL-tput', display_image)

if cv2.waitKey(1) & 0xFF == ord('q'):
break

```
Instead of instantiating your own `GreenOnBrown()` instance, you can make the most of the
`get_weed_detector()` and `setup_and_run_detector()`. The `setup_and_run_detector()` function
makes it easy to use the inbuilt `config.CONFIG_DAY_SENSITIVITY_1`, to avoid providing all

Instead of instantiating your own `GreenOnBrown()` instance, you can make the most of
`owl.utils.io.get_weed_detector()` and `owl.utils.io.setup_and_run_detector()` functions. The `setup_and_run_detector()` function
makes it easy to use the inbuilt `owl.utils.config.CONFIG_DAY_SENSITIVITY_1`, to avoid providing all
variables yourself. For example:

```Python
weed_detector = get_weed_detector(algorithm=algorithm, model_path=model_path, platform=platform)
from owl.utils.io import get_weed_detector, load_config, setup_and_run_detector
import cv2

CONFIG_NAME = "CONFIG_DAY_SENSITIVITY_1"
ALGORITHM = 'exhsv'
MODEL_PATH = None
VIDEO_PATH = r'media/test_video_1.avi'
PLATFORM = 'desktop'

weed_detector = get_weed_detector(algorithm=ALGORITHM, model_path=MODEL_PATH, platform='desktop')

algorithm = 'exhsv'
CONFIG_NAME="CONFIG_DAY_SENSITIVITY_1"
config = load_config(CONFIG_NAME)
config.update({"algorithm": f"{algorithm}"})
config.update({"algorithm": f"{ALGORITHM}"})

video_feed = cv2.VideoCapture(video_path)
video_feed = cv2.VideoCapture(VIDEO_PATH)

while True:
ret, frame = video_feed.read()

_, _, _, image = setup_and_run_detector(weed_detector=weed_detector,
if not ret:
break

_, _, _, display_image = setup_and_run_detector(weed_detector=weed_detector,
frame=frame.copy(),
config=config)
cv2.imshow('Video Feed', image)

cv2.imshow('OWL-tput', display_image)

if cv2.waitKey(1) & 0xFF == ord('q'):
break

cv2.destroyAllWindows()
```


## Streamlit App
Try it for yourself now with the online, Streamlit app!
[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://owl-tools.streamlit.app/)

0 comments on commit 36c3223

Please sign in to comment.