Bear Repellent Program

Contents

1

Introduction

This program detects harmful animals such as bears and repels them by sending push notifications and playing sounds.

The program is similar to the standard AI detection program, but it has an additional feature that not only sends push notifications when detection occurs, but also repeatedly plays a pre-prepared WAV file for a specified duration.

GitHub Available on GitHub
2

Registering Audio Output Docker Image

AIBOX OS comes with a Docker Image that can run YOLO11 with NCNN by default.

docker images
REPOSITORY TAG aicap/arm64/ultralytics 1.0.250923 aicap/arm64/ultralytics 1.0.250923-audio-bt

This image is based on the YOLO11 image published by Ultralytics, with necessary modules for NCNN conversion and execution installed, as well as environment setup for running the aicap command. Basic detection programs using YOLO11 running on AIBOX OS can operate in containers launched from this image.

Images tagged with only a version number (1.0.250923) are base images with no additional components included.

Images with the suffix “-audio-bt” after the version number (1.0.250923-audio-bt) are base images with additional modules required for audio playback and Bluetooth device access.

The bear deterrence program to be executed this time requires not only object detection using YOLO, but also additional functionality to output audio. Therefore, we will use the “1.0.250923-audio-bt” image, which includes audio playback capabilities.

GitHub Dockerfile for creating audio output image

3

How to Replace the Program

The basic file structure is the same as the standard AI detection program.
(The audio file alert.wav has been added)
However, the docker-compose.yml content has been modified to use the audio-enabled Docker image and includes additional parameters to grant the Docker container access to USB-connected sound output devices.
The files that have been changed or added from the standard AI detection program are as follows:

File NameDescription
extmod.pyPython program that performs object detection
alert.wavSound file to play when detection occurs
docker-compose.ymlFile containing Docker container configuration and settings

A script is available to update these files.

Log in to the AIBOX and run the following commands to download update.zip published on GitHub. After extracting the archive, execute update.sh to update all required files at once.

$ wget https://github.com/daddyYukio/AICAPTURE/raw/refs/heads/main/programs/bear_repellent/update.zip

After updating, connect a USB sound output device to AIBOX and reboot.

By default, the detection object is set to bear, so try pointing the camera at a photo of a bear.
When detected, you will receive a push notification on your smartphone and an alert sound will play for 10 seconds.

4

Real-Time Preview of Detection Results

To view detection results in real time, please enable the detection result preview feature.

You will then be able to check the detection results in real time via a web browser.

5

Detection Program Explanation

The detection program explanation has been posted as an article on Zenn, so please refer to it there.

Zenn [AI CAPTURE] Bear Repellent Program
6

Changing Detection Objects, Alert Sound, and Duration

The method for changing detection objects and modifying detection accuracy is the same as the standard AI detection program.

The alert sound played when detection occurs is alert.wav, saved in the same location as the program file.
It is a short WAV format file that is played on repeat.
To change the sound, replace this alert.wav file.
※The format must be WAV.

The playback duration is defined in the following external variable:


# Playback duration (seconds)
WAV_PLAY_TIME_SEC = 10