Enhance the Beehive

Using AI for bee object detection

Monitoring bee activity using camera vision

Created on: 08/06/2023 Last updated on 10/08/2023

Analyzing bee behavior at the entrance of the hive by object detection

The members of the Codecentric team have been developing a reliable and efficient system for monitoring bee activity using a camera and the PLCnext ML extension module. The main goal is to analyze bee behavior at the entrance of the beehive through object detection.

Extensive research, including conversations with beekeepers and studying scientific papers, was conducted to understand different methods for monitoring bees. Based on previous experience with computer vision and object detection applications at Codecentric, a computer vision-based approach was chosen. The system aims to provide insights into colony collapse disorder, bee population dynamics, hive diseases, and predator invasions. Training the model involved a dataset of bee images, and challenges were faced during the deployment phase, leading to the adoption of EfficientDet Lite as a more suitable architecture.

The project also addresses challenges with the dataset by using a custom entrance tunnel with controlled lighting conditions. The team is currently optimizing the system and setting up an infrastructure for device management to ensure smooth operation and updates.

Learn more details about the project

The Codecentric team aims to develop a reliable and efficient system for monitoring bee activity using a camera and the PLCnext ML extension module. By analyzing bee behavior at the entrance of the beehive through object detection, beekeepers can gain insights into colony collapse disorder, bee population dynamics, hive diseases, and predator invasions.

Extensive research was conducted, including consultations with beekeepers and studying scientific papers. Computer vision-based approaches were chosen based on Codecentric’s expertise in the field. Ultralytics Yolov8, a powerful object detection algorithm, was used to train the initial model on a dataset of bee images captured from various angles, distances, and lighting conditions.

Challenges were encountered during deployment, as the Yolov8 model was incompatible with the PLCnext ML extension module. To address this, EfficientDet Lite, a lightweight and optimized object detection model, was adopted. The model was retrained, achieving comparable results with improved performance. Another challenge was the use of a general-purpose bee image dataset, which introduced noise and inconsistency. To overcome this, a custom entrance tunnel with controlled lighting conditions was employed to capture high-quality and consistent images.

The project is now in the final stage of preparing for the first prototype deployment. Efforts are focused on optimizing the dataset, fine-tuning model parameters, and ensuring robustness and accuracy. An infrastructure for device management has been established, utilizing tools such as Portainer, Prometheus, Teleport, and Grafana to ensure smooth operation and updates.

Four questions to the team

We are curious to get to know the people behind the ideas. Who are the members of the team?

Tom is a full stack developer and IT consultant at codecentric, specializing in infrastructure, machine learning, and digitalization of processes. He is currently studying business informatics in Münster.

Ihsan loves artificial intelligence and privacy preserving technologies. He is doing an internship at codecentric as a developer, with a focus on machine learning and its subfield federated learning. Applying cutting edge technologies to traditional settings to improve efficiency is a huge interest to him.

Meike is passionate about technology and nature. She works at codecentric as the Head of Industrial Solutions and is always interested in learning and trying out new things.

Aside from developing smart technologies for bees, what else do you do in your spare time?

Ihsan spends his free time cycling around Münster and always looks for new places to explore. Apart from that he is working on a climate simulation environment for plants with his friends and aims to grow tasty plants regardless of the climate.

Meike enjoys spending a lot of time outdoors in the Teutoburg Forest with her family. Her curiosity for innovation often accompanies her outside: together with the group “Code for Bielefeld,” she buries soil moisture sensors to objectively visualize the changes in the forest caused by climate change and provide inspiration for innovative solutions to this problem.

In his spare time, Tom likes to keep busy and engage in hands-on activities that allow him to use his creativity and problem-solving skills, like repairing bikes for himself and his friends. This year he also started growing different kinds of vegetables on his balcony and is counting on the help of bees to pollinate his plants.

How did you come up with this idea and what was your motivation behind it?

Our solution is based on a camera that detects the bees at their hive entrance. Therefore, this solution is very similar to other projects we have worked on, where we use cameras for object recognition in production facilities or visual quality control. We want to leverage that knowledge to be able to classify different situations at the hive entrance and also provide an indication of the approximate number of bees inside the hive.

Bees are remarkable animals, but which bee fact surprised or impressed you the most?

We were very impressed by the fact that the honeybee, alongside cattle and pigs, is the third most important domesticated animal for humans, and the pollination of plants cannot be easily replaced or substituted by other solutions.

The test phase of using an AI camera to monitor the bee movement at the flight hole of the hive was successful. To improve the visibility of the bees the project team has come up with the idea of applying a white board within the entrance area of the hive. Thus, the camera can better spot the little flying insects and analyze their movements much more accurately.

Read more

Another advancement of the project is the fact that Codecentric now has access to the PLCnext Controls inside the company’s own smart beehive located on the compound of the Phoenix Contact global headquarters in Bad Pyrmont, Germany. The next step will be to run the AI-camera bee-tracking solution by Codecentric on that hive.

1. Step: Camera

To detect and count the bees via video-feed, a camera that continually captures images is essential.

2. Step: Evaluation

The individual images are being evaluated utilizing Codecentric’s EfficientDet-Lite based machine-learning-model. This model monitors the position of each bee as well as a score of how exact the model’s prediction is.

3. Step: Analysis

When overlapping all positions of a video feed, we can see clearly, where the bees are staying mostly. In this case it is on the left side of the flight hole, as indicated by the green dots.

Leave a Reply

Please login/register to comment

Let’s talk about it

Get in contact You would like to learn more about this project or how you can transfer it into your own application? Then get in contact with us or subscribe to our buzzletter.
Never miss a new article
Sign up for the newsletter
Never miss news about PLCnext Technology
Get interesting content via newsletter four times a year
Receive exclusive information before all other users