Skip to content

Commit d44c446

Browse files
authored
Merge pull request #60 from tapis-project/dev
Version 0.6.0
2 parents 7486f11 + be4a7c2 commit d44c446

File tree

31 files changed

+636
-84
lines changed

31 files changed

+636
-84
lines changed

.github/workflows/docker-image.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,43 @@ jobs:
724724
tags: tapis/detection_reporter_plugin:${{ env.TRAPS_REL }}
725725
build-args: REL=${{ env.TRAPS_REL }}
726726

727+
video_generating_plugin:
728+
runs-on: ubuntu-latest
729+
environment: main
730+
needs: camera_traps_py_313
731+
steps:
732+
- name: Set TRAPS_REL
733+
run: |
734+
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
735+
TRAPS_REL=${{ inputs.release_tag }}
736+
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
737+
TRAPS_REL=latest
738+
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
739+
TRAPS_REL=latest
740+
else
741+
TRAPS_REL=${{ github.event.release.tag_name }}
742+
fi
743+
echo "TRAPS_REL=$TRAPS_REL" >> "$GITHUB_ENV"
744+
- name: Checkout
745+
uses: actions/checkout@v4
746+
- name: Set up QEMU
747+
uses: docker/setup-qemu-action@v3
748+
- name: Set up Docker Buildx
749+
uses: docker/setup-buildx-action@v3
750+
- name: Login to Docker Hub
751+
uses: docker/login-action@v3
752+
with:
753+
username: ${{ secrets.DOCKERHUB_USERNAME }}
754+
password: ${{ secrets.DOCKERHUB_TOKEN }}
755+
- name: Build and push oracle_plugin
756+
uses: docker/build-push-action@v5
757+
with:
758+
context: external_plugins/video_generating_plugin
759+
platforms: linux/amd64,linux/arm64
760+
push: true
761+
tags: tapis/video_generating_plugin:${{ env.TRAPS_REL }}
762+
build-args: REL=${{ env.TRAPS_REL }}
763+
727764
custom_install:
728765
runs-on: ubuntu-latest
729766
environment: main
@@ -785,7 +822,7 @@ jobs:
785822
trigger_tests:
786823
runs-on: ubuntu-latest
787824
environment: main
788-
needs: [engine, image_scoring_plugin_server_py_313, image_scoring_plugin_ultralytics_py_313, image_scoring_plugin_yolov5_py_38, image_scoring_plugin_py_nano_38, image_generating_plugin, image_detecting_plugin, power_measuring_plugin, oracle_plugin, detection_reporter_plugin, custom_install]
825+
needs: [engine, image_scoring_plugin_server_py_313, image_scoring_plugin_ultralytics_py_313, image_scoring_plugin_yolov5_py_38, image_scoring_plugin_py_nano_38, image_generating_plugin, image_detecting_plugin, power_measuring_plugin, oracle_plugin, detection_reporter_plugin, video_generating_plugin, custom_install]
789826
steps:
790827
- name: Check if tests are disabled
791828
run: |

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "camera-traps"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# its value will be the tag assigned to all images that get built.
55
# For example:
66
#
7-
# export TRAPS_REL=0.5.0
8-
# export TRAPS_REL=0.5.
7+
# export TRAPS_REL=0.6.0
8+
# export TRAPS_REL=0.6.
99
#
1010
# NOTE: Right now, building with tag `latest` is not supported. Instead,
1111
# build a semantic version and then tag the result as latest.
@@ -56,7 +56,10 @@ build-detection:
5656
build-detecting:
5757
cd external_plugins/image_detecting_plugin && docker build -t tapis/image_detecting_plugin:${TRAPS_REL} --build-arg REL=${TRAPS_REL} .; cd ../..
5858

59-
build-py-plugins: build-camerapy build-scoring-server build-generating build-power build-oracle build-detection build-detecting
59+
build-video:
60+
cd external_plugins/video_generating_plugin/ && docker build -t tapis/video_generating_plugin:${TRAPS_REL} --build-arg REL=${TRAPS_REL} .; cd ../..
61+
62+
build-py-plugins: build-camerapy build-scoring-server build-generating build-power build-oracle build-detection build-detecting build-video
6063

6164
build-installer:
6265
cd installer && docker build -t tapis/camera-traps-installer:${TRAPS_REL} --build-arg REL=${TRAPS_REL} .; cd ../

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# camera-traps
22

3-
The Camera Traps application is both a simulator and IoT device software for utilizing machine learning on the edge in field research. The first implementation specializes in applying computer vision (detection and classification) to wildlife images for animal ecology studies. Two operational modes are supported: "simulation" mode and "demo" mode. When executed in simulation mode, the software serves as a test bed for studying ML models, protocols and techniques that optimize storage, execution time, power and accuracy. It requires an input dataset of images to act as the images that would be generated an IoT camera device; it uses these images to drive the simulation.
3+
The Camera Traps application is both a simulator and IoT device software for utilizing machine learning on the edge in field research. The first implementation specializes in applying computer vision (detection and classification) to wildlife images for animal ecology studies. Two operational modes are supported: "simulation" mode and "demo" mode. When executed in simulation mode, the software serves as a test bed for studying ML models, protocols and techniques that optimize storage, execution time, power and accuracy. Simulation mode accepts two different input types: (1) an input dataset of images to act as the images that would be generated an IoT camera device or (2) an input video file that would be captured by a camera which is then processed by an image detecting plugin that saves frames with motion in them; it uses these images to drive the simulation.
44

55
Conversely, when run in "demo" mode, the application serves as software that can be deployed onto actual, Linux-based camera trap devices in the wild. In this case, the Camera Traps software relies on a digital camera accessible over a Linux device mount (the default `/dev/video0` location can be re-configured), and it drives the camera directly using the Linux Motion activation software, which comes bundled with the as a plugin with Camera Traps. It includes a detection reporter plugin and MQTT component which coordinate to communicate in real time when a configurable object of interest has been detected (up to a configurable confidence threshold). As a proof of concept of the capabilities of the software, we are producing a demo integration with drone software developed by the Stewart Lab at OSU which enables the Camera Traps software to communicate over a local network to a nearby drone whenever an object of interest is detected.
66

@@ -9,6 +9,8 @@ Conversely, when run in "demo" mode, the application serves as software that can
99
- CI4AI
1010
- Animal Ecology
1111

12+
---
13+
1214
# Explanation
1315

1416
## Architectual Overview
@@ -29,6 +31,7 @@ In general, plugins can also depend on their own environment variables and/or co
2931
| -------------------------- | ------------------------------- | -------------------------- | ----------------------------------- |
3032
| camera-traps application | TRAPS_CONFIG_FILE | ~/traps.toml | Can be 1st command line parameter |
3133
| image_gen_plugin | | /input.json | |
34+
| video_generating_plugin | TRAPS_VIDEO_OUTPUT_PATH | | |
3235
| image_detecting_plugin | | /etc/motion/motion.conf |
3336
| detection_reporter_plugin| TRAPS_DETECTION_REPORTER_* | /traps-detection.toml |
3437
| image_store_plugin | TRAPS_IMAGE_STORE_FILE | ~/traps-image-store.toml | |
@@ -159,6 +162,8 @@ When *image_recv_write_file_action* is specifed, the *image_recv_plugin* uses th
159162
The *image_uuid* and *image_format* are from the NewImageEvent. The image_file_prefix can be the empty string and the image_format is always lowercased when used in the file name.
160163

161164

165+
---
166+
162167
# How-To Guide
163168

164169
## Quick Start
@@ -232,7 +237,8 @@ allow_anonymous true
232237

233238
In-memory representations of events are translated into flatbuffer binary streams plus a leading two byte sequence that identifies the event type. These statically defined byte sequences are specified in the [events.rs](https://github.com/tapis-project/camera-traps/blob/main/src/events.rs) source file and repeated here for convenience.
234239

235-
// Each event is assigned a binary prefix that zqm uses to route incoming binary streams to all of the event's subscribers.<br>
240+
Each event is assigned a binary prefix that zqm uses to route incoming binary streams to all of the event's subscribers.<br>
241+
```
236242
pub const NEW_IMAGE_PREFIX: [u8; 2] = [0x01, 0x00];<br>
237243
pub const IMAGE_RECEIVED_PREFIX: [u8; 2] = [0x02, 0x00];<br>
238244
pub const IMAGE_SCORED_PREFIX: [u8; 2] = [0x03, 0x00];<br>
@@ -243,6 +249,7 @@ pub const PLUGIN_TERMINATING_PREFIX: [u8; 2] = [0x11, 0x00];<br>
243249
pub const PLUGIN_TERMINATE_PREFIX: [u8; 2] = [0x12, 0x00];<br>
244250
pub const MONITOR_POWER_START_PREFIX: [u8; 2] = [0x20, 0x00];<br>
245251
pub const MONITOR_POWER_STOP_PREFIX: [u8; 2] = [0x21, 0x00];<br>
252+
```
246253

247254
Each event sent or received begins with its two byte prefix followed by its serialized form as defined in the camera-traps flatbuffer definition file ([events.fbs](https://github.com/tapis-project/camera-traps/blob/main/resources/events.fbs)). The following section describes how to generate Rust source code from this definition file, a similar process can be used for any language supported by flatbuffers.
248255

RELEASE_NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Camera Traps Release Notes
22

3+
## Version 0.6.0
4+
This release includes three main improvements:
5+
1. A Video Generating plugin that uses a video file and a v4l2loopback virtual device to simulate a mounted camera stream, to use in conjunction with the Image Detecting plugin.
6+
2. Improved metric reporting.
7+
3. Set a minimum time between image events when using the Image Detecting plugin.
8+
39
## Version 0.5.0
410
This major release expands the camera-traps application with a new functional mode, referred to as `demo` mode.
511
Unlike the original simulation mode,

external_plugins/detection_reporter_plugin/detection_reporter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ def main():
128128
if is_detected_image(uuid):
129129
update_csv('STORING', uuid, image_path=image_path, decision=destination)
130130

131+
elif isinstance(event, PluginTerminateEvent):
132+
done = True
133+
logger.info(f'Received Terminate event * and shutting down detection reporter plugin')
134+
send_quit_command(socket)
135+
131136
if __name__ == '__main__':
132137
logger.info("Detection reporter plugin starting...")
133138
main()

external_plugins/image_detecting_plugin/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ RUN find / -path /proc -prune -o -path /sys -prune -o -path /dev -prune -o -writ
77
RUN apt update && apt install -y motion vim
88
RUN pip install watchdog
99
RUN pip install PILLOW
10+
RUN pip install PyYaml
1011

1112
# Config files
1213
ADD motion.default /etc/default/motion
1314
ADD motion.conf /etc/motion/motion.conf
15+
RUN mkdir /var/log/motion
1416

1517
# Code
1618
ADD image_detecting_plugin.py /image_detecting_plugin.py
1719
ADD entry.sh /entry.sh
1820

19-
RUN chmod -R 0777 /oracle_plugin.py || true
21+
RUN chmod -R 0777 /image_detecting_plugin.py || true
2022

2123

2224
ENTRYPOINT [ "/entry.sh" ]

external_plugins/image_detecting_plugin/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,7 @@ services:
3030
privileged: true
3131
volumes:
3232
- ./image_data:/var/lib/motion
33+
environment:
34+
- MIN_SECONDS_BETWEEN_IMAGES=2
3335
depends_on:
3436
- engine
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# Start the motion program to monitor the /data directory
4-
motion
4+
#motion
55

66
# Start the image detecting plugin
77
python -u image_detecting_plugin.py

0 commit comments

Comments
 (0)